From: Bill on
Hello all,

Im just starting with matlab. we are a group of lecturers that are very new to this software. we are interested in the image processing capabilities in matlab. We have a few questions.

1. If i have an image (eg http://bit.ly/dxTKGh) we have already done edge detection to find the different objects in this image. now we need to remove this object from the image and save it as a completely different image file, how can we achieve this? efficiently?

2. Is this a good technique to remove objects from images?

Thanks
From: ImageAnalyst on
Bill
It's a little bit challenging because it seems like they constructed
the image with a few things to intentionally more challenging, such as
a gradient in the background illumination, shadows, similar hues,
etc. It looks like they might intend for you to combine several
methods together to get a binary image (mask) of just the objects that
you're interested in. For example, you may have to combine
thresholding in RGB space with thresholding in HSV space, maybe might
need background correction, perhaps might have to use edge detection
and region filling, etc.

Here's a demo that might help you get started, but you'd have to adapt
it to color images.
http://www.mathworks.com/matlabcentral/fileexchange/25157

And here's a simple color detection algorithm that operates in RGB
space:
http://www.mathworks.com/matlabcentral/fileexchange/26420-simplecolordetection

So try a few things and post your code back here if you need help. I
do this stuff all day long in my career so I've seen quite a wide
variety of images and algorithms.
From: Ashish Uthama on
On Mon, 08 Feb 2010 13:34:06 -0500, Bill <lithiumstaging(a)gmail.com> wrote:

> Hello all,
>
> Im just starting with matlab. we are a group of lecturers that are very
> new to this software. we are interested in the image processing
> capabilities in matlab. We have a few questions.
>
> 1. If i have an image (eg http://bit.ly/dxTKGh) we have already done
> edge detection to find the different objects in this image. now we need
> to remove this object from the image and save it as a completely
> different image file, how can we achieve this? efficiently?
>
> 2. Is this a good technique to remove objects from images?
>
> Thanks

For starters:
Look at this demo
http://www.mathworks.com/products/demos/image/detect_cell/morph2.html

(Other demos here might be very useful)

Add these steps to extract the single cell out as an image:
rp=regionprops(BWfinal);
%Crop out the cell from the original image, using the bounding box of the
mask
exTractedCell=imcrop(I,r.BoundingBox);
imshow(exTractedCell)

In relation to the above demo, I guess you would have to add a couple of
steps to your existing pipeline to get to the binary masks of individual
objects. You could then filter out parts of REGIONPROPS output using total
area/centroid location etc. Have a look at its doc:

Please find more details online at:
http://www.mathworks.com/access/helpdesk/help/toolbox/images/regionprops.html
Or please paste this in the MATLAB command window:
web([docroot,'/toolbox/images/regionprops.html'])