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

7 次查看(过去 30 天)
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?

采纳的回答

Walter Roberson
Walter Roberson 2016-7-4
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 个评论

请先登录,再进行评论。

更多回答(1 个)

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

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by