Measure the average intensity of pixels in a specified area repeatedly in the same image
10 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (3 件)
Image Analyst
2017 年 3 月 3 日
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 件のコメント
Tim Sanborn
2017 年 3 月 8 日
1 件のコメント
Image Analyst
2017 年 3 月 8 日
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.
参考
カテゴリ
Help Center および File Exchange で Image Segmentation and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!