Skip to content

Commit cde48f4

Browse files
committed
Merge pull request #2373 from alalek:issue_15990
2 parents e70a4c4 + d930ad9 commit cde48f4

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

modules/rgbd/samples/linemod.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define CV__ENABLE_C_API_CTORS // enable C API ctors (must be removed)
2-
31
#include <opencv2/core.hpp>
42
#include <opencv2/core/utility.hpp>
53
#include <opencv2/imgproc/imgproc_c.h> // cvFindContours
@@ -69,7 +67,7 @@ int Mouse::m_y;
6967

7068
static void help()
7169
{
72-
printf("Usage: openni_demo [templates.yml]\n\n"
70+
printf("Usage: example_rgbd_linemod [templates.yml]\n\n"
7371
"Place your object on a planar, featureless surface. With the mouse,\n"
7472
"frame it in the 'color' window and right click to learn a first template.\n"
7573
"Then press 'l' to enter online learning mode, and move the camera around.\n"
@@ -231,10 +229,10 @@ int main(int argc, char * argv[])
231229
{
232230
// Compute object mask by subtracting the plane within the ROI
233231
std::vector<CvPoint> chain(4);
234-
chain[0] = pt1;
235-
chain[1] = cv::Point(pt2.x, pt1.y);
236-
chain[2] = pt2;
237-
chain[3] = cv::Point(pt1.x, pt2.y);
232+
chain[0] = cvPoint(pt1);
233+
chain[1] = cvPoint(pt2.x, pt1.y);
234+
chain[2] = cvPoint(pt2);
235+
chain[3] = cvPoint(pt1.x, pt2.y);
238236
cv::Mat mask;
239237
subtractPlane(depth, mask, chain, focal_length);
240238

@@ -574,9 +572,9 @@ void subtractPlane(const cv::Mat& depth, cv::Mat& mask, std::vector<CvPoint>& ch
574572
{
575573
mask = cv::Mat::zeros(depth.size(), CV_8U);
576574
std::vector<IplImage*> tmp;
577-
IplImage mask_ipl = mask;
575+
IplImage mask_ipl = cvIplImage(mask);
578576
tmp.push_back(&mask_ipl);
579-
IplImage depth_ipl = depth;
577+
IplImage depth_ipl = cvIplImage(depth);
580578
filterPlane(&depth_ipl, tmp, chain, f);
581579
}
582580

@@ -595,7 +593,7 @@ std::vector<CvPoint> maskFromTemplate(const std::vector<cv::linemod::Template>&
595593
CvSeq * lp_contour = 0;
596594

597595
cv::Mat mask_copy = mask.clone();
598-
IplImage mask_copy_ipl = mask_copy;
596+
IplImage mask_copy_ipl = cvIplImage(mask_copy);
599597
cvFindContours(&mask_copy_ipl, lp_storage, &lp_contour, sizeof(CvContour),
600598
CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);
601599

0 commit comments

Comments
 (0)