How to find the CDF using the histogram (PDF) of an image?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Histograms 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!