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

조회 수: 1 (최근 30일)
Shashi TG
Shashi TG 2016년 7월 4일
댓글: Image Analyst 2018년 3월 22일
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