Borrar filtros
Borrar filtros

How to find the CDF using the histogram (PDF) of an image?

4 visualizaciones (últimos 30 días)
Em Bus
Em Bus el 22 de Oct. de 2018
I'm currently working on a project where I need to implement the histeq function on my own. I'm trying to write the transformation part where I have the grayscale image's histogram (PDF) and I need my transformation function to take that histogram in, then compute the transformation function, which is the CDF. I can't figure out how to go about doing this without having the function take in the image first.
I've seen plenty of things online on how to have the transformation function take in the image then calculate the histogram then the CDF, but I have already written a function (see below) that computes the histogram of a given image.
%%%compute the histogram of a grayscale image %%%
function h = histogram(image)
[m,n] = size(image);
h = zeros(256);
for i = 1:m
for j = 1:n
p = double(imageSource(i,j))+1;
h(p) = h(p)+1;
end
end
total_pixels = m*n;
h = h./total_pixels;
end

Respuestas (0)

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by