Average pixel values of several ROIs
Show older comments
I need to know how to calculate the average pixel value of a region of interest in an image (some images have several ROIs and I need to calculate the value for each of those ROI within an image). I used the Image Batch Processor from the Image Processing Toolbox (Matlab 2015a) to obtain masks containing my ROIs. I understand binary images to be the input image with 1s inside the ROI object h and 0s everywhere else, but I do not know how to use this information. I can use the Image Region Analyzer to access ROI properties, i.e. area, perimeter, etc., from the mask, but I do not know if this information is relevant to calculating the average pixel values of the ROI.
I know there is documentation online about how to do this for freehand ROIs, etc., but Matlab is brand new to me (without the Image Processing Toolbox, I would not have been able to detect my ROIs or to create the mask), so I am having trouble following the documentation, especially because I have a folder of binary images (the output of using the Image Batch Processor) and I am not defining my ROIs individually. Any help is greatly, greatly appreciated!
Accepted Answer
More Answers (1)
Image Analyst
on 30 Mar 2015
0 votes
I don't know about that batch utility you're usingn, but it's certainly possible if you write your own program as illustrated in my Image Segmentation Tutorial http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 which uses regionprops() to get the areas of all the ROI's at one time.
4 Comments
j
on 2 Apr 2015
Image Analyst
on 2 Apr 2015
I get the same error. A lot of things changed starting with R2014b so something is not working anymore. I will fix it, though I hope it will still work in R2014a and earlier.
Image Analyst
on 2 Apr 2015
Edited: Image Analyst
on 3 Apr 2015
Attached is a new one. Evidently the handle graphics in R2015a don't like me using set() like that. I changed it to use the line() function instead of the stem() function and everything works fine now.
j
on 2 Apr 2015
Categories
Find more on ROI-Based Processing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!