フィルターのクリア

Multimodal histogram segmentation in image processing

4 ビュー (過去 30 日間)
Pooja
Pooja 2014 年 2 月 4 日
コメント済み: Image Analyst 2014 年 9 月 25 日
1)Select an initial estimate for T 2)Segment the image using T. This will produce two groups of pixels. G1 consisting of all pixels with gray level values >T and G2 consisting of pixels with values <=T. 3)Compute the average gray level values mean1 and mean2 for the pixels in regions G1 and G2. 4)Compute a new threshold value T=(1/2)(mean1 +mean2) 5)Repeat steps 2 through 4 until difference in T in successive iterations is smaller than a predefined parameter T0 Please give me a matlab code for this algorithm

採用された回答

Image Analyst
Image Analyst 2014 年 2 月 4 日
Do not use mean2 as the variable name - that is a function built in to the Image Processing Toolbox. What happens if you just take it one step at a time, like it's trying to walk you through?
% 1)Select an initial estimate for T
T = 128;
T0 = .5;
% 2)Segment the image using T. This will produce two
% groups of pixels. G1 consisting of all pixels with gray
% level values >T and G2 consisting of pixels with values <=T.
G1 = grayImage > T;
G2 = grayImage <= T;
% 3)Compute the average gray level values mean1 and
% mean2 for the pixels in regions G1 and G2.
meanGL1 = mean(grayImage(G1))
meanGL2 = mean(grayImage(G2))
% 4)Compute a new threshold value
Tnew=(1/2) * (meanGL1 +meanGL2)
if (Tnew - T) < T0
and so on. You just need to put that into a while loop and break when the condition of little change is met. I practically did the whole thing for you. You just have to add 4 lines of code.
  1 件のコメント
Image Analyst
Image Analyst 2014 年 4 月 25 日
You might or might not need to use a Gaussian filter. Can you post your image and tell me what you want to measure?

サインインしてコメントする。

その他の回答 (1 件)

osama
osama 2014 年 4 月 22 日
hello interesting .. i a;lready working on it ,,,, but where is the using of histogram in ur code ?? i wiating response
greetings
  6 件のコメント
Christina
Christina 2014 年 9 月 25 日
does this algorithm works for multispectral images?
Image Analyst
Image Analyst 2014 年 9 月 25 日
Yes. You could threshold each spectral image. You can combine the thresholded binary images if needed.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by