views:

225

answers:

3

I have a segmentated image, looks like this:

// I am not allowed to post pictures since I am a new member, so only the link:

// Turns out I cannot post two hyperlinks either, so I am only going to post the link of the map file.

Edit: I believe now I can post images:

alt text

I also have a map file that clearly shows the segments:

alt text

Now, what I need to do is to create a binary image file that consists of just the deer in the center painted white, rest of the image painted black.

What methods do you suggest for merging segments?

I have something like this in mind:

  1. Calculate color averages for each segment.
  2. Compare them and merge the most similar segments.

If I do that, I end up with 3 segments: Floor (white part), wall (black and light grey part combined) and the object (grey part).

At this points what can be done to correctly obtain the object?

Note that object does not have to be in the center, it may even be partly off-screen.

(I also thought about calculating the area each segment takes and labeling the smallest area as the object; but there may be times when objects cover most of the image, so it may not produce correct results.)

I'd really appreciate any help. Thanks in advance.

A: 

I didn't understand, you already created a segmentation map (What you linked to)?

Or the link is the image itself? If it's in Matlab, once you have a segmentation map you can easily create a binary matrix out of it and just multiply it by the original image. Hence all left is the part you want.

Drazick
Yes it is a segmentation map.But as you can see, that segmentation map has at least 4 different regions. I need to reduce it to 2 regions: Just the object and background.
quad65
What could you be assuming you know about the object?If it's necessarily the image in you example, why not make a hard thresholding by the grey level?
Drazick
At the moment, I can only assume object's color is somehow different from background and wall. But I don't want to hard-code any values for background and wall colors into the program.
quad65
If you could assume it is darker / lighter then you could use Adaptive Thresholding.How the map was created?You could use K-Mean Clustering to create 3 different binary images (For each grey color) and let the user chose what he wants.Without any specific assumption about the object, how do you expect the code to recognize it?
Drazick
A: 

For segmentation try whit grow cut algorhitm http://en.wikipedia.org/wiki/GrowCut_algorithm

publication is from 2005 and there is MATLAB library avaliable at http://www.mathworks.com/matlabcentral/fileexchange/19091-growcut-image-segmentation

Do you know in advance what is your interest object?

For instance, deers are brown and that could help whit histogram comparison.

ralu
In my situation, object must be recognized without any user interaction.So, I don't think this algorithm is suitable. Let me know if I misunderstood anything.
quad65
+1  A: 

This is a somewhat difficult question, since "the object" is a subjective term. Clearly, you want the most interesting object, so we just have to decide what an interesting object looks like. This will have to be something statistical.

Let's assume that, like in your images, your object of interest is one of a small number of segments. We will just compute a score for every segment, and call the highest-scoring one the object.

I would just play around with adding together various score functions. Some good ones might be:

  • distance or squared distance of a segment's center to the exact center of the image (this would find your example object.)
  • number of pixels of the segment that are on the border of the image (this would find your example object, since the bad clusters have large borders)
  • number of Canny edges inside the segment divided by number of pixels in the segment, if you think your object will be "more interesting" than the background
  • number of SIFT keypoints divided by number of pixels, same rationale as previous
  • break RGB space into a relatively small number of bins, like 512 (so, break each of R,G,B into 8 rough levels, like 0-31, 32-63, etc. if you are working with 8-bit images) and look at properties of each segment considered as a distribution over this space. An interesting object might have a higher-entropy distribution, or a lower-entropy one, depending on your context.
forefinger
This is a very nice answer. An evaluation function sounds right. I'll look into the methods and select the appropriate one.Thanks a lot for taking the time to answer. Much appreciated.
quad65