Blob Detection in opencv Java.

asked 2015-03-20 05:12:31 -0600

Hi, I new to openCV. I am trying to implement tracking particular objects in a camera on android mobile. I trying out the procedure described in this link http://www.technical-recipes.com/2011/tracking-coloured-objects-in-video-using-opencv/.

Trying to implement the following method in Java. I cant figure out what equivalent method I need to use for CBlobResult(), Filter(), GetNumBlobs() and GetBlob() methods. Thanks in advance.

blobs = CBlobResult( imgThresh, NULL, 0 );    

    // Exclude white blobs smaller than the given value (10)    
    // The bigger the last parameter, the bigger the blobs need    
    // to be for inclusion    
    blobs.Filter( blobs,  
                  B_EXCLUDE,  
                  CBlobGetArea(),  
                  B_LESS,  
                  10 );           

    // Attach a bounding rectangle for each blob discovered  
    int num_blobs = blobs.GetNumBlobs();  

    for ( int i = 0; i < num_blobs; i++ )    
    {                 
        currentBlob = blobs.GetBlob( i );               
        cvRect = currentBlob->GetBoundingBox();  

        pt1.x = cvRect.x;  
        pt1.y = cvRect.y;  
        pt2.x = cvRect.x + cvRect.width;  
        pt2.y = cvRect.y + cvRect.height;  

        // Attach bounding rect to blob in orginal video input  
        cvRectangle( frame,  
                     pt1,   
                     pt2,  
                     cvScalar(0, 0, 0, 0),  
                     1,  
                     8,  
                     0 );  
    }
edit retag flag offensive close merge delete