Effacer les filtres
Effacer les filtres

How to find sum of all pixel value of ROI in a grayscale image?

7 vues (au cours des 30 derniers jours)
Shashi TG
Shashi TG le 4 Juil 2016
Commenté : Image Analyst le 22 Mar 2018
I am trying to draw a ROI of a grayscale image using imfreehand. After drawing this, I want to count all the intensity levels contained in this ROI. How can I do this?

Réponse acceptée

Walter Roberson
Walter Roberson le 4 Juil 2016
Use the createMask method of the imfreehand object to create a binary mask. Suppose we call that mask . Then,
selected_values = YourImage(mask);
sum_of_selected = sum(selected_values);
count_intensity_values = length( unique(selected_values) );
  3 commentaires
Image Analyst
Image Analyst le 31 Juil 2017
Yes
Jonathan Avesar
Jonathan Avesar le 31 Juil 2017
Great thank you!

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 4 Juil 2016
See attached demo to freehand mask an image and find the drawn region's mean and centroid.
  6 commentaires
Fahad Alharbi
Fahad Alharbi le 22 Mar 2018
can I apply this demo on a folder of images insisted of one by one ? thanks again.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by