Effacer les filtres
Effacer les filtres

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

27 vues (au cours des 30 derniers jours)
shimul
shimul le 6 Sep 2013
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 commentaires
Doug Hull
Doug Hull le 6 Sep 2013
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.
shimul
shimul le 13 Sep 2013
Yap I have done this. However thanks

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 6 Sep 2013
Modifié(e) : Image Analyst le 6 Sep 2013
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 commentaires
Image Analyst
Image Analyst le 6 Mai 2016
You should start your own question for this.
sana saleeme
sana saleeme le 6 Mai 2016
will you answer me there?

Connectez-vous pour commenter.

Plus de réponses (1)

Upeka Somaratne
Upeka Somaratne le 2 Avr 2018
How can I get the pixel coordinates of the pixels which have intensity value greater than 200? (in matlab)
  1 commentaire
shimul
shimul le 2 Avr 2018
Modifié(e) : Image Analyst le 2 Avr 2018
[rows, cols] = find(yourImage > 200);
considering the image is grayscale.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by