Info

この質問は閉じられています。 編集または回答するには再度開いてください。

value of the pixel

1 回表示 (過去 30 日間)
javeed miyandad
javeed miyandad 2011 年 4 月 26 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
sir i have a edged image(img) ,i need to check a specific pixel whether it is white or black. how to check?
that is in an image of size 1024X768, i need to check(100X343)Th pixel, how to do please help in coding

回答 (2 件)

Matt Fig
Matt Fig 2011 年 4 月 26 日
That would depend somewhat on the datatype, and how exact you want to be in calling something black. Do you want a tolerance? What kind of image is it? I.e., if myimage is the name of your image, what does this return:
whos myimage

Walter Roberson
Walter Roberson 2011 年 4 月 26 日
if any(img(100,343,:) ~= 0)
%it is not pure black. Might be very very dark gray, though.
else
%it is pure black
end
For a 2D binary image, you can reduce this test to
if img(100,343)
%it is white
else
%it is black
end

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by