Re: Fuzzy C-Means Usage - Image Segmentation
- From: "jkvdpoel" <jkvdpoel@xxxxxxxxx>
- Date: 22 Aug 2006 11:22:11 -0700
Dear Ofek:
Thank you for your answer. I understood the difference between "hard"
and "fuzzy/soft" (quoting you :-) segmentation, and I will stick with
the "hard" one (because it is suitable to me).
The second question arises from the fact that in the Step 4 of the demo
(label every pixel in the image using the results from kmeans), it says
that for every object in the input, kmeans returns an index
corresponding to a cluster (named cluster_index), which is used to
label every pixel in the image, The steps to do this are:
pixel_labels = reshape(cluster_idx,nrows,ncols);
imshow(pixel_labels,[]), title('image labeled by cluster index');
This part here is fine: I could show what the demo calls "image labeled
by cluster index" even if I choose four or more colors to segment the
image.
BUT, when I choose more than three colors to segment the image, the
Step 5 of the demo (create images that segment the H&E image by color)
fails. In this step, by using pixel_labels, it is possible to separate
objects in "hestain.png" by color, which will result in three images
(if we use three colors to segment the image). Using nColors = 3, I can
show exactly three images (the same result as I can get from using
kmeans). BUT (again), choosing four colors, my code now is (nColors =
4):
% instead of "segmented_images = cell(1, 3);"
segmented_images = cell(1, 4);
% instead of "rgb_label = repmat(pixel_labels,[1 1 3]);"
rgb_label = repmat(pixel_labels,[1 1 4]);
for k = 1:nColors
color = he;
color(rgb_label ~= k) = 0;
segmented_images{k} = color;
end
Here, the for-loop causes the following error:
??? Attempt to grow array along ambiguous dimension.
Error in ==> color(rgb_label ~= k) = 0;
I noticed that "color = he;" makes color with dimensionallity [X, Y, 3]
and this is causing the error, but I couldn't manage to realise a way
to overcome it. What I am doing wrong here?
I will also try the same algorithm with my grayscale images.
Thanks in advance for any help.
Yours sincerely,
JanKees
Ofek Shilon wrote:
jkvdpoel, sorry i can't give fuller answers now - perhaps later
today. in the meantime:
1. What do you mean with "interpret the fcm results to a 'hard'
segmentation, as opposed to a fuzzy one". What is the difference
between these two ways of segmenting an image?
'hard' segmentation AFAIK is not an official term - what i meant is
some sort of a definite classification of a pixel to any of the K
clusters. that is what you get, e.g., from K means - or any
traditional clustering algorithm. C means can give you a 'soft'
segmentation (again, just a personal terminology): as all fuzzy
algorithms, it gives you a distribution. the pixel is in cluster 1
with probability P1, in cluster 2 with prob P2 etc - this actually
gives you more info than 'hard' clustering, but in typical
segmentation needs you can't really utilize this info (you typically
need just the bottom line - not knowing the details of your
application, of course). what i did in the previous post is choose
the segment with maximum probability out of C-means output for every
fragment, which is in a way forcing the (more expensive) C-means to
behave and output just the K-means output, and i indeed added a
remark questioning the rationale behind such a move.
2. I want, if possible, to do like the demo: show the segmented
images
in a separate figure. With three colors it performs as the original
demo, but the problem arises when I try to segment with more than
three
colors (four colors, for example). I know that in RGB space there
are
only three colors and this is causing the problem, but supose that
I
want to see if there is more than three classes of colors in the
image.
How can I show the other colors in separate figures?
in RGB space there are 256^3 colors, which is quite a bit more than
3. red, green or blue don't have any inherent special status. there
shouldn't be any problems in using the exact same algorithms in 4+
classes - can u specify which 'problem arises' in that case?
3. I also have grayscale images that I want to segment in various
classes (in my application the images are from a CAT scan). Is it
possible to apply the FCM to this kind of images? If so, how can I
do
it to find, for example, five types of different tissues?
this would, in fact, be easier, as your dataset here is 1-
dimensional, as opposed to the 2-dim 'ab' data (extracted from L*a*b
transform) in the demo.
Ofek
.
- Follow-Ups:
- Re: Fuzzy C-Means Usage - Image Segmentation
- From: Ofek Shilon
- Re: Fuzzy C-Means Usage - Image Segmentation
- References:
- Fuzzy C-Means Usage - Image Segmentation
- From: jkvdpoel
- Re: Fuzzy C-Means Usage - Image Segmentation
- From: Ofek Shilon
- Re: Fuzzy C-Means Usage - Image Segmentation
- From: jkvdpoel
- Re: Fuzzy C-Means Usage - Image Segmentation
- From: Ofek Shilon
- Fuzzy C-Means Usage - Image Segmentation
- Prev by Date: Profiler that goes into mex functions
- Next by Date: Re: Set of intervals
- Previous by thread: Re: Fuzzy C-Means Usage - Image Segmentation
- Next by thread: Re: Fuzzy C-Means Usage - Image Segmentation
- Index(es):
Relevant Pages
|