Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

hierachy[u][2] find moments.x moments.y

findContours(imgRes1, contours3, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0,0));}
....
for(int u = 0; u < contours3.size(); u++)
Moments moment = moments(contours3[hierarchy[u][2]]);
.....}

I try to find center of contours with [u][2] hierarchy ... obviously this function not work because contours3 is a vector not a mat image ...there is some way to do that?

hierachy[u][2] find moments.x moments.y

findContours(imgRes1, contours3, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0,0));}
....
for(int u = 0; u < contours3.size(); u++)
Moments moment = moments(contours3[hierarchy[u][2]]);
.....}

I try to find center of contours with [u][2] hierarchy ... obviously this function not work because contours3 is a vector not a mat image ...there is some way to do that?