1 | initial version |
Here is my rough attempt at the code. I am assuming that there is only one blob though I see that there ate two in your example. You can modify the code to suit your needs.
for ( i = 0; i < blobs.GetNumBlobs(); i++ )
{
CBlob& current_blob = blobs.GetBlob ( i );
roi = current_blob.GetBoundingBox();
cv::Mat blob_roi = cv::Mat ( image, roi );
bitwise_not ( blob_roi, blob_roi );
IplImage ipl_blob_roi = blob_roi.operator IplImage();
CBlobResult& inv_blobs = CBlobResult ( *ipl_blob_roi, NULL, 0 );
int blob_area = inv_blobs.GetBlob(0).Area();
}
2 | Fixed the address for ipl_blob_roi (& instead of *) |
Here is my rough attempt at the code. I am assuming that there is only one blob though I see that there ate two in your example. You can modify the code to suit your needs.
for ( i = 0; i < blobs.GetNumBlobs(); i++ )
{
CBlob& current_blob = blobs.GetBlob ( i );
roi = current_blob.GetBoundingBox();
cv::Mat blob_roi = cv::Mat ( image, roi );
bitwise_not ( blob_roi, blob_roi );
IplImage ipl_blob_roi = blob_roi.operator IplImage();
CBlobResult& inv_blobs = CBlobResult ( *ipl_blob_roi, &ipl_blob_roi, NULL, 0 );
int blob_area = inv_blobs.GetBlob(0).Area();
}