Skip to content

Commit 74455ea

Browse files
committed
Merge pull request #1936 from paroj:lmfeats
2 parents 2cb8399 + b4dea4e commit 74455ea

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

modules/rgbd/include/opencv2/rgbd/linemod.hpp

+9
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,15 @@ class CV_EXPORTS DepthNormal : public Modality
239239
*/
240240
CV_EXPORTS_W void colormap(const Mat& quantized, CV_OUT Mat& dst);
241241

242+
/**
243+
* \brief Debug function to draw linemod features
244+
* @param img
245+
* @param templates see @ref Detector::addTemplate
246+
* @param tl template bbox top-left offset see @ref Detector::addTemplate
247+
* @param size marker size see @ref cv::drawMarker
248+
*/
249+
CV_EXPORTS_W void drawFeatures(InputOutputArray img, const std::vector<Template>& templates, const Point2i& tl, int size = 10);
250+
242251
/**
243252
* \brief Represents a successful template match.
244253
*/

modules/rgbd/src/linemod.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,29 @@ void colormap(const Mat& quantized, Mat& dst)
207207
}
208208
}
209209

210+
void drawFeatures(InputOutputArray img, const std::vector<Template>& templates, const Point2i& tl, int size)
211+
{
212+
#ifdef HAVE_OPENCV_IMGPROC
213+
static Scalar colors[] = {{0, 0, 255}, {0, 255, 0}};
214+
static int markers[] = {MARKER_SQUARE, MARKER_DIAMOND};
215+
216+
int modality = 0;
217+
for(const Template& t : templates)
218+
{
219+
if(t.pyramid_level != 0) continue;
220+
221+
for(const Feature& f : t.features)
222+
{
223+
drawMarker(img, tl + Point(f.x, f.y), colors[int(modality != 0)], markers[int(modality != 0)], size);
224+
}
225+
226+
modality++;
227+
}
228+
#else
229+
CV_Assert(false, "functionality needs imgproc module");
230+
#endif
231+
}
232+
210233
/****************************************************************************************\
211234
* Color gradient modality *
212235
\****************************************************************************************/

0 commit comments

Comments
 (0)