How to find the intensity of each pixel of an image?

21 次查看(过去 30 天)
Consider an image sample.jpg Now I want to count the number of pixels on that image have intensity value larger than 200(white pixels).
If the image contain such pixels above 75% then I want to reject the image. How can I accomplish this in matlab?
  2 个评论
Doug Hull
Doug Hull 2013-9-6
What format is the image in? RGB or greyscale? If it is just a greyscale image, it is really just a matrix and you can do any calculations on it like you would any matrix in MATLAB.

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2013-9-6
编辑:Image Analyst 2013-9-6
If it's a color image, first convert to a gray image
[rows, columns, numberofColorChannels] = size(originalImage);
if numberofColorChannels > 1
grayImage = rgb2gray(originalImage);
else
grayImage = originalImage;
end
otherwise if it's already gray, you don't need to call rgb2gray(). Then threshold
binaryImage = grayImage >= 200;
Then count
numberOfWhitePixels = sum(binaryImage(:));
Note: MATLAB uses the American spelling of gray, not the English spelling of grey.
  14 个评论

请先登录,再进行评论。

更多回答(1 个)

Upeka Somaratne
Upeka Somaratne 2018-4-2
How can I get the pixel coordinates of the pixels which have intensity value greater than 200? (in matlab)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by