From: Tony on
Hi all,

I am working on 2D image ROI extraction using region growing. However, the resultant black/white image has undesirable convex boundaries and concave boundaries. I would like to ask if there is a way that can fill in the "caves" and cut off the convex areas.

concave boundary
\
\
______\ _______ _______________
/ \_/ \ / \
| white / ====> | white /
\_________ ____/ \_______________/
\_/
/
/
/
convex boundary

Thank you very much.

Ken
From: Tony on
Hi all,
Sorry that the website has trimmed out the spaces. What I mention should be like that:

concave boundary
\
\ black black
\
///////////\___//////\\\ //////////////////\\\\\\
|||||||||||white//////// ====> |||||||||white||||||||/
\\\\\\\\\\\\\\\\\\////// \\\\\\\\\\\\\\\\\//////
\\\\/
/ black black
/
/
convex boundary
(black surrounding the white region as above)

Thanks~~
Tony

"Tony " <fomchan(a)hkucc.hku.hk> wrote in message <hjoph0$mae$1(a)fred.mathworks.com>...
> Hi all,
>
> I am working on 2D image ROI extraction using region growing. However, the resultant black/white image has undesirable convex boundaries and concave boundaries. I would like to ask if there is a way that can fill in the "caves" and cut off the convex areas.
>
> concave boundary
> \
> \
> ______\ _______ _______________
> / \_/ \ / \
> | white / ====> | white /
> \_________ ____/ \_______________/
> \_/
> /
> /
> /
> convex boundary
>
> Thank you very much.
>
> Ken
From: ImageAnalyst on
Ken:
For the concave parts, that's easy. In the Image Processing Toolbox
there is the convex hull. I think the function name is convhull().

Getting rid of the "bulge" is not so straightforward. You could try
imopen() to try to nip it off but it won't do a perfect job like you
showed because it will later all the boundaries not just those
sticking out. Probably the only way to do it perfectly might be some
kind of ad hoc modeling of your perimeter shape, like you know or
assume it will be a perfect ellipse or rectangle.

From: Steven Lord on

"Tony " <fomchan(a)hkucc.hku.hk> wrote in message
news:hjoph0$mae$1(a)fred.mathworks.com...
> Hi all,
>
> I am working on 2D image ROI extraction using region growing. However, the
> resultant black/white image has undesirable convex boundaries and concave
> boundaries. I would like to ask if there is a way that can fill in the
> "caves" and cut off the convex areas.
>
> concave boundary
> \
> \
> ______\ _______ _______________
> / \_/ \ / \
> | white / ====> | white /
> \_________ ____/ \_______________/
> \_/
> /
> /
> /
> convex boundary
>
> Thank you very much.
>
> Ken

So you have something that looks sort of like this graph:

x = [0 1 2 3 4 4 3 2 1 0 0];
y = [1 1 0 1 1 3 3 2 3 3 1];
plot(x, y);
axis([-1 5 -1 4])

and you want to "fill in" the concave area and cut off any convex area?
Well, CONVHULL will fill in the concave area, but it will do more than you
want, resulting in the green object.

K = convhull(x, y);
hold on;
plot(x(K), y(K), 'g')

You could consider the bottom 'peak' to be a convex outcropping or you could
consider the regions between that bottom peak and the bottom corners to be
concave areas that need to be filled. CONVHULL will take the latter
approach while "filling in" the upper concave area.

Now of course you could "chop off" all the convex regions first, but from
your description that's not what you'd want to do either, as it would result
in the red area:

plot([0 4 4 0 0], [1 1 2 2 1], 'r')

when really, what you've described sounds like you want the black region:

plot([0 4 4 0 0], [1 1 3 3 1], 'k')

I'm thinking, unless you're very careful, you're more likely to receive the
red or green regions from your algorithm than the black region.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ