no error but crash on opencvExample on centroid access

hi , i am trying to get the cntroid of the blobs in the opencvExemple

i haded this code to the void testApp::draw()

for (int i = 0; i<3; i++){  
        ofRect(contourFinder.blobs[i].centroid.x,contourFinder.blobs[i].centroid.y, 3, 3);  

it compile and start , but crash with the console still open

can somebody tell my what i am doing wrong

if there’s no blobs in the image and you try to access 3 of them as in your for loop. the application is going to crash.

try changing the condition of the for to i<blobs.size() instead of i<3

thanks it is working
(not as i expected but that s because i was expecting wrong)

i got the error where
blobs was not defined in this scope

but i put


and it worked

thank you Arturo

, i am just wondering

isn t there a contourFinder.blobs “number” instead of “size”?

i ll have to continue analyse the ofxopencv addon a little bit more to learn more about this amazing addon