hierachy[u][2] find moments.x moments.y [closed]
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?
moments can handle both contours and images.
but better check if hierarchy[u][2] is valid..