Image intensity histogram - radial

조회 수: 9 (최근 30일)
Johnathan Viernik
Johnathan Viernik 2016년 8월 17일
댓글: Johnathan Viernik 2016년 8월 18일
I have an image with (reasonable) radial symmetry. I would like to generate an intensity histogram as a function of distance from the origin, i.e. average the intensity over small "rings" and display the mean intensity of each ring.
I wrote the following code, but obviously it's very inefficient due to loop usage. Is there a more elegant solution for this problem, perhaps a built-in one? I haven't found on the web. Thanks.
x = 609; y = 513; % captured from snapshot
distmat = zeros(size(getsnapshot(vid1)));
[r,c] = size(distmat);
for i = 1:r
for j = 1:c
distmat(i,j) = sqrt((i-y)^2+(j-x)^2);
end
end
uni = unique(distmat);
rad = zeros(size(uni));
for i = 1:length(uni);
rad(i) = sum(avgim(distmat == uni(i))) / length(avgim(distmat == uni(i)));
end
bar(rad)

채택된 답변

Image Analyst
Image Analyst 2016년 8월 17일
Been there, done that, see attached demos.
  댓글 수: 1
Johnathan Viernik
Johnathan Viernik 2016년 8월 18일
Thanks, that was very helpful!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Filtering and Enhancement에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by