Extracting max intensity coordinates from image sequence

조회 수: 10 (최근 30일)
Lai La 2022년 6월 22일
답변: yanqi liu 2022년 6월 22일
Hello, I'm a complete beginner and I'm currently trying to extract maximum intensity pixel coordinates from multiple images at one time (I have about 2500 images) and store them in a matrix with slice number that correspond. After doing some research here I came up with this code :
filedir = '...';
imds = imageDatastore(filedir);
for k=1:numel(imgs)
[x,y]=size(imgs(k));
max_int = max(imgs(:));
for i=1:x
for j=1:y
if (imgs(i,j)==max_int)
k;
i;
j;
end
end
end
end
I understand how to do it for one image but doing it in a loop for multiple images is quite difficult for me.
Can someone give me some hint or solution on how to modify this loop to have what I want ?
Thank you very much.

댓글을 달려면 로그인하십시오.

채택된 답변

yanqi liu 2022년 6월 22일
yes，sir，may be use some index to transfer，such as
[max_p, ~] = max(im(:));
disp(max_p)
204
ind = find(im(:)==max_p);
% use ind2sub
[r,c] = ind2sub([size(im,1) size(im,2)], ind);
% display
for i = 1 : length(r)
fprintf('(%d, %d) is max value %d\n', r(i), c(i), im(r(i), c(i)));
end
(51, 93) is max value 204 (51, 94) is max value 204 (52, 94) is max value 204 (52, 95) is max value 204 (70, 95) is max value 204 (53, 96) is max value 204 (69, 96) is max value 204 (70, 96) is max value 204 (71, 96) is max value 204 (69, 97) is max value 204 (70, 97) is max value 204 (68, 98) is max value 204 (69, 98) is max value 204 (68, 99) is max value 204 (68, 100) is max value 204 (83, 116) is max value 204

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Category Classification에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by