%load rgb image
src = 'C:\rainbow.jpg';
rgbI = imread(src);
grayI = rgb2gray(rgbI);
%get image histogram
[counts bins]=imhist(grayI);
%fit histogram into polynomial to get smooth curve
fit = polyfit(bins,counts,10);
fit_samples = polyval(fit,bins);
%show histogram
plot(bins,counts,'.g',bins,fit_samples,'-b');
No comments:
Post a Comment