Measure the average intensity of pixels in a specified area repeatedly in the same image
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi
I'm trying to measure average intensity within specified locations repeatedly in the same image, and then iterate to do this over multiple images. I'm finding MATLAB can only handle so many cropped images at a time. There must be an easier way to do this. Here is what I have so far.
A = cat(2,B,Th); %Concatenate ROI array in form [X,Y,dX,dY] to create specified regions (1285x4x6) -> many regions
%Use ROI array to determine mean intensities of sensors
for j = 1:numframes
for a = 1:1285 %number of ROI per image -> can only be cut down by about 1/3 for future
c(:,:,a,j) = imcrop(z(:,:,j),A(a,:,j));
m = mean(mean(c(:,:,a,j)));
end
end
Is there another way to do this than with imcrop. It seems very inefficient. It is struggling with the first 6 images right now and I have to do this for 600 so I need a more efficient way.
Thanks
0 Kommentare
Antworten (3)
Image Analyst
am 3 Mär. 2017
Do the ROI overlap or are they all separate? If they're all separate, you can do it once to make up a binary image with all the masks, then call regionprops() to get the mean of all regions at once.
And you don't need to store all your c arrays. You can simply overwrite it each time:
thisSubImage = imcrop(z(:,:,j),A(a,:,j));
m(a) = mean2(thisSubImage); % Compute the mean for this 2-D channel of z.
0 Kommentare
Tim Sanborn
am 8 Mär. 2017
1 Kommentar
Image Analyst
am 8 Mär. 2017
There is no way a centroid can be outside the edges of the image. It might be outside of a blob, like the centroid of a fat C shape is in the center outside the C itself, but you can't have a centroid be outside the entire image itself.
Siehe auch
Kategorien
Mehr zu Image Segmentation and Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!