Info
此问题已关闭。 请重新打开它进行编辑或回答。
value of the pixel
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
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
0 个评论
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
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!