Binarizing an image using mean gray value

조회 수: 1 (최근 30일)
eman
eman 2013년 9월 11일
Hi, I need to binarizing an image according to mean gray value.
The image i'm working in is the Y (Luiminance) Channel of YCbCr color space.
the function im2bw takes grayscale, so I need to convert the image to gray scale( I don't know how to do that because of working on Y channel of YCbCr image) OR getting another procedure.
The Code:
m1 = imread('car1.jpg');
m2 = rgb2ycbcr(m1); sample1=m2(:,:,1);
sample1_mean = mean(mean(sample1))
%Binarizing samples area
BINsample1 = im2bw(sample1, sample1_mean);
I hope if any one can help me.
Thanks in advance,
Eman

채택된 답변

Tallha Akram
Tallha Akram 2013년 9월 11일
m1 = imread('peppers.png');
m2 = im2double(rgb2ycbcr(m1)); sample1=m2(:,:,1);
sample1_mean = mean(mean(sample1))
%Binarizing samples area
BINsample1 = im2bw(sample1, sample1_mean);
imshow(BINsample1);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by