Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

extract forground of image thermal

Asked by fatemeh on 23 Jun 2013

Hi everyone,

I working on breast thermal images. I want extract body of background and used of many approch for example chan-vese, gradient and morphology and wavelet but because of the amorphous nature and the lack of clear limits in these images, extracting not successful. I want have a robust approch for this work. regrads

2 Comments

Walter Roberson on 23 Jun 2013

What is foreground and what is background for your purpose? Is the background the black part and the foreground is everything else? Is the background the black part together with the arms, with the torso being the foreground? Is the foreground only the breast?

fatemeh on 23 Jun 2013

All parts of the body including the neck, arms ,shoulder and breasts are foreground and side black part is background.

fatemeh

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 23 Jun 2013

You can find three of the sides with a simple horizontal and vertical histogram.

maybe_foreground = YourImage > YourImage(1,1);
vert_profile = any(maybe_foreground, 1);
horz_profile = any(maybe_foreground, 2);
vert_start = find(vert_profile,1,'first');
vert_end   = find(vert_profile,1,'last');
horz_start = find(horz_profile,1,'first');
horz_end   = find(horz_profile,1,'last');

the ROI is now contained within

YourImage(horz_start : horz_end, vert_start : vert_end)

I say "contained within" because of that text at the bottom, which you probably want to crop out. I am not sure at the moment what the best way to do that would be.

2 Comments

fatemeh on 23 Jun 2013

I want have a method to create binary output so that pixels of foreground be 1 and pixels related to background be 0.

Walter Roberson on 23 Jun 2013

The first step after the above computation of horz_end and so on, would be:

roimask = false(size(YourImage));
roimask(horz_start : horz_end, vert_start : vert_end) = true;

This mask would not be accurate with respect to the text.

Beyond that gets tricky as it appears that a fraction of the elbow that touches the edge might have some all-0 pixels.

After that... if you ran a max() operation on a window around the inside edge of the window I constructed, that should mostly be able to pick out inside the limbs vs pure background. Use the result as a mask to bw close boundaries, then throw away that mask; with the limbs now closed, you can run a solid fill operation to get the "inside" of the body, and the result of that would be the ROI you are looking for. Except for the bit about getting rid of the pesky text.

Walter Roberson

Contact us