필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
Em Bus
Em Bus 2018년 10월 22일
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개)

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by