How can I segment an Image based on gaussian mixture?

I have an image with four different kinds of colors - dark blue, light blue, an even lighter blue - background and white - background. I'd like to extract only the first two categories. This is what I tried.
bG= mat2gray(image);
his=imhisthistogram(bG);
sai = gmdistribution.fit(his,4);
m1=sai.mu(1);
v1=sai.Sigma(1);
m2=sai.mu(2);
v2=sai.Sigma(2);
imt=bG<m2+v2; % to get all pixels in original image with less than m2+v2
figure;
imagesc(~imt);
I get an Image with all pixels 1. The bG image matrix had values less than 1 but the mean and variance of each gaussian was way higher.
From what I understood, bG is an image matrix and hence will have intensity values. so all the values here are less than 1.
but the means of four guassians are: 0.8604 0.976 2.9182 6.6377. These don't seem to be intensities and so when I tried to get all the pixels in the image less than second mean, all the pixels passed the test. There is something that I am missing here. Can any one help me segment dark blue and light blue cells based on Gaussian mixture. Any help is appreciated!

Answers (0)

Asked:

on 23 Apr 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!