sangwoo3 / cvblob

Automatically exported from code.google.com/p/cvblob
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Cannot display largest blob #24

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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 venicele...@gmail.com on 1 Sep 2011 at 9:00