Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

LINE-MOD/LINE-2D: Why does the OpenCV implementation only silhouettes?

On his website (section "Software") Hinterstoisser notes that OpenCV implementation of LINE-MOD/LINE-2D uses only sihouettes when learning templates, but doesn't reason why. So here's my question: Why is that?

The lines of code that I'm talking about can be found in file opencv/modules/objectdetect/src/linemod.cpp:

For LINE-2D:

bool ColorGradientPyramid::extractTemplate(Template& templ) const
{
  // Want features on the border to distinguish from background
  Mat local_mask;
  if (!mask.empty())
  {
    erode(mask, local_mask, Mat(), Point(-1,-1), 1, BORDER_REPLICATE);
    subtract(mask, local_mask, local_mask);
  }
//... 
}

And same for LINE-MOD:

bool DepthNormalPyramid::extractTemplate(Template& templ) const
{
  // Features right on the object border are unreliable
  Mat local_mask;
  if (!mask.empty())
  {
    erode(mask, local_mask, Mat(), Point(-1,-1), 2, BORDER_REPLICATE);
  }
//...
}

Why erode the mask? Why not just leave it what it is and take all the gradients anywhere on the object like Hinterstoisser et al. originally proposed in their paper? (As I understood it, LINE-MOD/LINE-2D is for detecting textureless object, not for detecting silhouttes of objects.)

LINE-MOD/LINE-2D: Why does the OpenCV implementation use only silhouettes?silhouettes of the object?

On his website (section "Software") Hinterstoisser notes that OpenCV implementation of LINE-MOD/LINE-2D uses only sihouettes when learning templates, but doesn't reason why. So here's my question: Why is that?

The lines of code that I'm talking about can be found in file opencv/modules/objectdetect/src/linemod.cpp:

For LINE-2D:

bool ColorGradientPyramid::extractTemplate(Template& templ) const
{
  // Want features on the border to distinguish from background
  Mat local_mask;
  if (!mask.empty())
  {
    erode(mask, local_mask, Mat(), Point(-1,-1), 1, BORDER_REPLICATE);
    subtract(mask, local_mask, local_mask);
  }
//... 
}

And same for LINE-MOD:

bool DepthNormalPyramid::extractTemplate(Template& templ) const
{
  // Features right on the object border are unreliable
  Mat local_mask;
  if (!mask.empty())
  {
    erode(mask, local_mask, Mat(), Point(-1,-1), 2, BORDER_REPLICATE);
  }
//...
}

Why erode the mask? Why not just leave it what it is and take all the gradients anywhere on the object like Hinterstoisser et al. originally proposed in their paper? (As I understood it, LINE-MOD/LINE-2D is for detecting textureless object, not for detecting silhouttes of objects.)