vector convert to mat rule
Hi all, I have a question about vector convert to mat
for example: the code below from generalContours_demo2.cp
for( size_t i = 0; i < contours.size(); i++ )
{ minRect[i] = minAreaRect( Mat(contours[i]) );
if( contours[i].size() > 5 )
{ minEllipse[i] = fitEllipse( Mat(contours[i]) ); }
}
it can be like
for( size_t i = 0; i < contours.size(); i++ )
{ minRect[i] = minAreaRect( contours[i] );
if( contours[i].size() > 5 )
{ minEllipse[i] = fitEllipse( contours[i] ); }
}
is any rule to follow ?
thanks.
findContours expects an 8bit binary img as 1st argument, so your first 2 lines won't work.
the last one won't work, too because of vector of vector.
please pick a better example!
hi berak,yes, the last contourArea(contourB) can't work,it should be contour(contourB[index]). I think i should try the other function.:)
i edited the question because i also want to get an answer.