Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot display largest blob #24

Open
GoogleCodeExporter opened this issue Apr 18, 2015 · 0 comments
Open

Cannot display largest blob #24

GoogleCodeExporter opened this issue Apr 18, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. First i declare the maxBlob: CBlob * maxBlob;
2. Display the blob by using maxBlob->Fillblob(destination, 
CV_RGB(255,255,255));
3. The code is:

//load binary image
IplImage * inputImage = cvLoadImage("fill.jpg");

CBlobResult blobs;
blobs = CBlobResult( inputImage, NULL, 0 ); 

// number of blobs
int n = blobs.GetNumBlobs();
cout<<"number of blobs: "<<n<<endl;

CBlob *currentBlob;
CBlob *maxBlob;
double max=0.0,currentBlobArea=0.0;
IplImage * imgBlob=cvCreateImage(cvGetSize(inputImage),8,1);

for (int i=0; i<n; i++ )
{   
currentBlob = blobs.GetBlob(i);
//if currentBlob area is largest, fill the imgBlob;
currentBlobArea = currentBlob->Area();

    if(currentBlobArea>max){
        max = currentBlobArea;
        maxBlob = currentBlob;
    }
}   
cout<<"largest area is: "<<max<<endl;
maxBlob->FillBlob(imgBlob, CV_RGB(255,255,255));


What is the expected output? What do you see instead?
I expected to see the largest blob with a black background. But what i get is a 
totally grey output.

What version of the product are you using? On what operating system?
I am using OpenCV 2.1. Cvblob i downloaded from wiki. I am using window7

Please provide any additional information below.
I follow the instruction in the wiki to install the lib. I can detect the 
number of blobs in the image, and can identify their area. But when i want to 
print the largest blob, the image is, don't know whey stretched, or totally 
grey image is come out.

Please help me. Tq.

Original issue reported on code.google.com by [email protected] on 1 Sep 2011 at 9:00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant