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
-
9
1
#include < opencv2/core.hpp>
10
2
#include < opencv2/core/utility.hpp>
11
3
#include < opencv2/imgproc/imgproc_c.h> // cvFindContours
@@ -75,7 +67,7 @@ int Mouse::m_y;
75
67
76
68
static void help ()
77
69
{
78
- printf (" Usage: openni_demo [templates.yml]\n\n "
70
+ printf (" Usage: example_rgbd_linemod [templates.yml]\n\n "
79
71
" Place your object on a planar, featureless surface. With the mouse,\n "
80
72
" frame it in the 'color' window and right click to learn a first template.\n "
81
73
" Then press 'l' to enter online learning mode, and move the camera around.\n "
@@ -237,10 +229,10 @@ int main(int argc, char * argv[])
237
229
{
238
230
// Compute object mask by subtracting the plane within the ROI
239
231
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 );
244
236
cv::Mat mask;
245
237
subtractPlane (depth, mask, chain, focal_length);
246
238
@@ -580,9 +572,9 @@ void subtractPlane(const cv::Mat& depth, cv::Mat& mask, std::vector<CvPoint>& ch
580
572
{
581
573
mask = cv::Mat::zeros (depth.size (), CV_8U);
582
574
std::vector<IplImage*> tmp;
583
- IplImage mask_ipl = mask;
575
+ IplImage mask_ipl = cvIplImage ( mask) ;
584
576
tmp.push_back (&mask_ipl);
585
- IplImage depth_ipl = depth;
577
+ IplImage depth_ipl = cvIplImage ( depth) ;
586
578
filterPlane (&depth_ipl, tmp, chain, f);
587
579
}
588
580
@@ -601,7 +593,7 @@ std::vector<CvPoint> maskFromTemplate(const std::vector<cv::linemod::Template>&
601
593
CvSeq * lp_contour = 0 ;
602
594
603
595
cv::Mat mask_copy = mask.clone ();
604
- IplImage mask_copy_ipl = mask_copy;
596
+ IplImage mask_copy_ipl = cvIplImage ( mask_copy) ;
605
597
cvFindContours (&mask_copy_ipl, lp_storage, &lp_contour, sizeof (CvContour),
606
598
CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);
607
599
0 commit comments