Image intensity histogram - radial

6 vues (au cours des 30 derniers jours)
Johnathan Viernik
Johnathan Viernik le 17 Août 2016
Commenté : Johnathan Viernik le 18 Août 2016
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)

Réponse acceptée

Image Analyst
Image Analyst le 17 Août 2016
Been there, done that, see attached demos.
  1 commentaire
Johnathan Viernik
Johnathan Viernik le 18 Août 2016
Thanks, that was very helpful!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Filtering and Enhancement dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by