help needed for opencvExample,blob center identifying

Hello,

I am currently using the pre-release v.0062
http://www.openframeworks.cc/versions/preRelease-v0.062/of-preRelease-v0062-win-cb-FAT.zip

and i am working with the opencvExample in the addons example folder.

I was wondering if i would be able to identify the center (x,y) of the blob being drawn by this program.

I tried simply using

  
getX = lockedContours.blobs.at(0).centroid.x;  
getY = lockedContours.blobs.at(0).centroid.y;  

it compiles but the whole program simply closes after i run it.

and it gives me an error in the command prompt…

This application has requested the Runtime to terminate it in an unusal way. Please contact the application’s support team for more information

anybody has any idea how to identify the center of a single blob.

are you sure your blobs vector is popoluated (ie. there’s at least 1 blob inside)?

if it’s empty you’ll try to read garbage memory and the app will close

Oh, thanks, fixed by using

  
    for (int i = 0; i < contourFinder.nBlobs; i++){  
        contourFinder.blobs[i].draw(360,20);  
  
        getX = contourFinder.blobs.at(i).centroid.x;  
        getY = contourFinder.blobs.at(i).centroid.y;  
  
    }  

Thanks man!