Image intensity histogram - radial

9 visualizaciones (últimos 30 días)
Johnathan Viernik
Johnathan Viernik el 17 de Ag. de 2016
Comentada: Johnathan Viernik el 18 de Ag. de 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)

Respuesta aceptada

Image Analyst
Image Analyst el 17 de Ag. de 2016
Been there, done that, see attached demos.

Más respuestas (0)

Categorías

Más información sobre Image Filtering and Enhancement en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by