Commit b4dea4ef authored by Pavel Rojtberg's avatar Pavel Rojtberg

linemod: add drawFeatures method

parent 7670ff2c
......@@ -239,6 +239,15 @@ protected:
*/
CV_EXPORTS_W void colormap(const Mat& quantized, CV_OUT Mat& dst);
/**
* \brief Debug function to draw linemod features
* @param img
* @param templates see @ref Detector::addTemplate
* @param tl template bbox top-left offset see @ref Detector::addTemplate
* @param size marker size see @ref cv::drawMarker
*/
CV_EXPORTS_W void drawFeatures(InputOutputArray img, const std::vector<Template>& templates, const Point2i& tl, int size = 10);
/**
* \brief Represents a successful template match.
*/
......
......@@ -207,6 +207,29 @@ void colormap(const Mat& quantized, Mat& dst)
}
}
void drawFeatures(InputOutputArray img, const std::vector<Template>& templates, const Point2i& tl, int size)
{
#ifdef HAVE_OPENCV_IMGPROC
static Scalar colors[] = {{0, 0, 255}, {0, 255, 0}};
static int markers[] = {MARKER_SQUARE, MARKER_DIAMOND};
int modality = 0;
for(const Template& t : templates)
{
if(t.pyramid_level != 0) continue;
for(const Feature& f : t.features)
{
drawMarker(img, tl + Point(f.x, f.y), colors[int(modality != 0)], markers[int(modality != 0)], size);
}
modality++;
}
#else
CV_Assert(false, "functionality needs imgproc module");
#endif
}
/****************************************************************************************\
* Color gradient modality *
\****************************************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment