From 997720d18c09050619b00b652e18075a6f065f51 Mon Sep 17 00:00:00 2001 From: Antoine Villeret Date: Thu, 10 Jan 2013 12:16:41 +0000 Subject: - update build instructions - add contour length to infos output of pix_opencv_contours svn path=/trunk/externals/pix_opencv/; revision=16850 --- pix_opencv_contours.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pix_opencv_contours.cc') diff --git a/pix_opencv_contours.cc b/pix_opencv_contours.cc index 6032d1b..d8f162d 100644 --- a/pix_opencv_contours.cc +++ b/pix_opencv_contours.cc @@ -149,7 +149,7 @@ void pix_opencv_contours :: processGrayImage(imageStruct &image) t_atom*info; info = new t_atom[(int) m_contours.size()*20+2]; // info : 20x(contour_nb) matrix - // info for each contour : area, rotrect corner (8 float), rotrect center, rotrect size, rotation angle, segments number, other are reserved for future use + // info for each contour : area, rotrect corner (8 float), rotrect center, rotrect size, rotation angle, number of segments, length of contour, other are reserved for future use int count(0); SETFLOAT(info+1, 20.); int info_offset(2); @@ -162,6 +162,7 @@ void pix_opencv_contours :: processGrayImage(imageStruct &image) cv::RotatedRect rot_rect = cv::minAreaRect(m_contours[i]); cv::Point2f corners[4]; rot_rect.points(corners); + double length = cv::arcLength(m_contours[i],true); for (int j=0;j<4;j++) { SETFLOAT(info+info_offset+j*2+1, corners[j].x/image.xsize); SETFLOAT(info+info_offset+j*2+2, corners[j].y/image.ysize); @@ -173,7 +174,7 @@ void pix_opencv_contours :: processGrayImage(imageStruct &image) SETFLOAT(info+info_offset+12, rot_rect.size.height/image.xsize); SETFLOAT(info+info_offset+13, rot_rect.angle); SETFLOAT(info+info_offset+14, m_contours[i].size()); // number of points in segment - SETFLOAT(info+info_offset+15, 0); + SETFLOAT(info+info_offset+15, (float) length); SETFLOAT(info+info_offset+16, 0); SETFLOAT(info+info_offset+17, 0); SETFLOAT(info+info_offset+18, 0); -- cgit v1.2.1