Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

How to get the max i from for loop to be printed at console?

$
0
0
Hello, I'm doing the tutorial to get the moment. So as we have more than one area calculated, how can I display the total number of areas i.e. the max number of `i` to be printed in the console. This is the original code. /// Get the moments vector mu(contours.size() ); for( int i = 0; i < contours.size(); i++ ) { mu[i] = moments( contours[i], false );} what i have tried is by print out the `contours.size()` value like this and it return zero. Anyone can help on how i can get the number of max `i`? vector mc( contours.size() ); for( int i = 0; i < contours.size(); i++ ) { mc[i] = Point2f( mu[i].m10/mu[i].m00 , mu[i].m01/mu[i].m00 ); } printf("max:%.2f\n", contours.size() );

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>