Skip to content

Commit 7011e1b

Browse files
committed
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
2 parents d0d8669 + d01edbd commit 7011e1b

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

modules/rgbd/samples/linemod.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// This file is part of OpenCV project.
2-
// It is subject to the license terms in the LICENSE file found in the top-level directory
3-
// of this distribution and at http://opencv.org/license.html
4-
5-
// This code is also subject to the license terms in the LICENSE_WillowGarage.md file found in this module's directory
6-
7-
#define CV__ENABLE_C_API_CTORS // enable C API ctors (must be removed)
8-
91
#include <opencv2/core.hpp>
102
#include <opencv2/core/utility.hpp>
113
#include <opencv2/imgproc/imgproc_c.h> // cvFindContours
@@ -75,7 +67,7 @@ int Mouse::m_y;
7567

7668
static void help()
7769
{
78-
printf("Usage: openni_demo [templates.yml]\n\n"
70+
printf("Usage: example_rgbd_linemod [templates.yml]\n\n"
7971
"Place your object on a planar, featureless surface. With the mouse,\n"
8072
"frame it in the 'color' window and right click to learn a first template.\n"
8173
"Then press 'l' to enter online learning mode, and move the camera around.\n"
@@ -237,10 +229,10 @@ int main(int argc, char * argv[])
237229
{
238230
// Compute object mask by subtracting the plane within the ROI
239231
std::vector<CvPoint> chain(4);
240-
chain[0] = pt1;
241-
chain[1] = cv::Point(pt2.x, pt1.y);
242-
chain[2] = pt2;
243-
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);
244236
cv::Mat mask;
245237
subtractPlane(depth, mask, chain, focal_length);
246238

@@ -580,9 +572,9 @@ void subtractPlane(const cv::Mat& depth, cv::Mat& mask, std::vector<CvPoint>& ch
580572
{
581573
mask = cv::Mat::zeros(depth.size(), CV_8U);
582574
std::vector<IplImage*> tmp;
583-
IplImage mask_ipl = mask;
575+
IplImage mask_ipl = cvIplImage(mask);
584576
tmp.push_back(&mask_ipl);
585-
IplImage depth_ipl = depth;
577+
IplImage depth_ipl = cvIplImage(depth);
586578
filterPlane(&depth_ipl, tmp, chain, f);
587579
}
588580

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

603595
cv::Mat mask_copy = mask.clone();
604-
IplImage mask_copy_ipl = mask_copy;
596+
IplImage mask_copy_ipl = cvIplImage(mask_copy);
605597
cvFindContours(&mask_copy_ipl, lp_storage, &lp_contour, sizeof(CvContour),
606598
CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);
607599

0 commit comments

Comments
 (0)