Search code examples
c#image-processingnui

Detecting a blob of color in an image


I have an image that is a depth heatmap that I've filtered out anything further away than the first 25% of the image.

It looks something like this: enter image description here

There are two blobs of color in the image, one is my hand (with part of my face behind it), and the other is the desk in the lower left corner. How can I search the image to find these blobs? I would like to be able to draw a rectangle around them if possible.

I can also do this (ignore shades, and filter to black or white): enter image description here


Solution

  • It might be overkill for what you need, but there's a great wrapper for C# for the OpenCV libraries.

    I have successfully used OpenCV in C++ for blob detection, so you might find it useful for what you're trying to do.

    http://www.emgu.com/wiki/index.php/Main_Page

    and the wiki page on OpenCV:

    http://en.wikipedia.org/wiki/OpenCV

    Edited to add: Here is a blobs detection library for Emgu in C#. There is even some nice features of ordering the blobs by descending area (useful for filtering out noise).

    http://www.emgu.com/forum/viewtopic.php?f=3&t=205

    Edit Again:

    If Emgu is too heavyweight, Aforge.NET also includes some blob detection methods

    http://www.aforgenet.com/framework/