How to separate an object from the background in the image?

I have a segmented image that looks like this:

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

// Turns out I can't send two hyperlinks, so I'm going to post a link to the map file.

Edit: I can now send images:

alt text http://img4.imageshack.us/img4/917/test0seg.jpg

I also have a map file that clearly shows segments:

alt text http://img4.imageshack.us/img4/6904/test0map.jpg

Now I need to create a binary image file consisting only of a deer in the center, painted in white, the rest of the image is painted in black.

What methods do you offer for merging segments?

I have something like this:

  • Calculate the average color values ​​for each segment.
  • Compare them and combine the most similar segments.

If I do this, I get 3 segments: floor (white part), wall (combined black and light gray) and object (gray part).

In this case, what can be done to get the object correctly?

Please note that the object should not be in the center, it may be partially disabled.

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

I would really appreciate any help. Thanks in advance.

+4
source share
3 answers

This is a somewhat complicated question, since “object” is a subjective term. Obviously, you need the most interesting object, so we just need to decide what the interesting object looks like. It must be something statistical.

Suppose, as in your images, your object of interest is one of a small number of segments. We simply calculate the score for each segment and name the highest result for the object.

I would just play around with the addition of various rating functions. Some good ones might be:

  • the distance or the square of the distance from the center of the line to the exact center of the image (this will find your example object.)
  • the number of segment pixels located on the border of the image (this may find your approximate object, since bad clusters have large borders)
  • the number of Canyy edges within the segment divided by the number of pixels in the segment if you think your object will be “more interesting” than the background
  • the number of SIFT key points divided by the number of pixels is the same rationale as the previous
  • break the RGB space into a relatively small number of boxes, for example 512 (so break each of R, G, B into 8 coarse levels, for example 0-31, 32-63, etc., if you work with 8-bit images ) and consider the properties of each segment, considered as a distribution over this space. An interesting object may have a distribution with higher entropy or lower entropy, depending on your context.
+3
source

I don’t understand, have you already created a segmentation map (what did you contact)?

Or is the link an image? If in Matlab, if you have a segmentation map, you can easily create a binary matrix from it and simply multiply it by the original image. Therefore, everything else is the part you want.

0
source

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

publication since 2005, and the MATLAB library is available at http://www.mathworks.com/matlabcentral/fileexchange/19091-growcut-image-segmentation

Do you know in advance what your object of interest is?

For example, deer are brown, and this can help compare the histogram.

0
source

Source: https://habr.com/ru/post/1299236/


All Articles