Measure the average intensity of pixels in a specified area repeatedly in the same image
12 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (3)
Image Analyst
il 3 Mar 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 Commenti
Tim Sanborn
il 8 Mar 2017
1 Commento
Image Analyst
il 8 Mar 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.
Vedere anche
Categorie
Scopri di più su Image Segmentation and Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!