blob function returning zero blobs

Posted on 2007-08-09
Last Modified: 2013-11-05
Hi folks, I have implemented an opencv blob finding function, to find blobs in an image. When I try  to find blobs in a binarized image, the function GetNumBlobs returns a zero as it isn't finding any blobs. I have confirmed this with showing the image that would contain them as well (there are none). But I when I view the binarized image, there are clearly well demarcated white blobs in a black and white image.

Here is the library link:

code snippet.:(configured the function wrong?).
        //threshold the image
        cvThreshold( HImageHueExtracted, HueExtracted_Binary, 1, 255, CV_THRESH_BINARY );
        //find & filter blobs
             CBlobResult blobs, filteredBlobs;
             blobs = CBlobResult( HueExtracted_Binary, NULL, 100, true );
             blobs.Filter( blobs, B_INCLUDE, CBlobGetArea(), B_GREATER, 1);
             BlobImageResult = cvCloneImage( HueExtracted_Binary );
             cvSetZero( BlobImageResult );

            for(i = 0; i < filteredBlobs.GetNumBlobs();i++)
             filteredBlobs.GetBlob(i)->FillBlob( BlobImageResult, CV_RGB( 255, 0, 0), 0 , 0 );

Any thoughts on why its not picking up the blobs?
Thanks in advance,
Question by:Wanderinglazyeye
    LVL 86

    Accepted Solution

    What happens if you skip the call to

            cvThreshold( HImageHueExtracted, HueExtracted_Binary, 1, 255, CV_THRESH_BINARY );


    Author Comment

    Nothing; but looking at it that way led me to question other assumptions,and I fixed the line:

    for(i = 0; i < blobs.GetNumBlobs();i++)
                    blobs.GetBlob(i)->FillBlob( BlobImageResult, CV_RGB( 255, 0, 0), 0 , 0 );

    And now its returning blobs.

    Thx jkr

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    C++ assignment question 7 112
    Problem to save 10 100
    object oriented programming on screen browser tutorial lesson 2 59
    valid enum? 6 45
    This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
    What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
    The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now