MATLAB: ROI Image Processing — Approach Question

image processingImage Processing Toolboximage segmentationroithreshold

Hello,
I currently have images of the following nature:
The goal is to have the code display the mean value of each of the squares. The position of each square slightly shifts from image to image. The images are stored as 1024 x 1024 matrices (type = double). Any suggestions on what approach to take in this case?
Thank you for your time!

Best Answer

Use regionprops
binaryImage = grayImage > 2e6;
binaryImage = bwareafilt(binaryImage, [3000, inf]);
labeledImage = bwlabel(binaryImage);
props = regionprops(labeledImage, grayImage, 'MeanIntensity');