|
|
histogram difference
%
% Input = image (HxWxD)
% e.g.
% im = double(imread('test.jpg')); % Read in image 256x256x3
% % compute 16x16x16 colour histogram of the image
% h = getPatchHist(im, 16);
%
% Output = 1D histogram vector, h
%
% size(h) ==> (bins^D)x(1)
function h = getPatchHist(clip, bins)
if (nargin <= 1)
bins = 8;
end
z = size(clip,3);
clip2 = zeros(size(clip,1),size(clip,2));
f = 1;
for i = 1:z
clip2 = clip2 + f*floor(clip(:,:,i)*bins/256);
f=f*bins;
end
h = hist(makelinear(clip2), 0:(f-1));
h = h / sum(h);
can anyone explain me how the above code is working to calculate the histogram of a color image. just tell me wht the for loop is doing ?
|
|
0
|
|
|
|
Reply
|
kiran8049
|
5/11/2011 7:07:02 PM |
|
It's basically concatenating the histograms of the 3 color channels
together into one 1D hist that is 3 times as long. So clip2 will have
the red values in the range 0-15, the green values in the range 16-31,
and the blue values in the range 32 - 47. Taking the hist will give
you a 1D histogram with values in the range 0-47 with the values
representing the color channels.
I don't see the use of doing it this way rather than the
straightforward intuitive way.
|
|
0
|
|
|
|
Reply
|
imageanalyst (7590)
|
5/11/2011 9:00:59 PM
|
|
|
1 Replies
36 Views
(page loaded in 0.063 seconds)
Similiar Articles: Normalizing grayscale image - comp.soft-sys.matlabAnd what is the difference (code) between to normalize grayscale image and RGB image? ... ... For histogram equilazation, histeq function is there. For pixel value normalization ... Maximum dimension array - comp.lang.fortranI would define an array y(1:800e6) but it doesn't seem possible... ... Histogram normalization - comp.soft-sys.matlab... begining i had a histogram ... And what is the difference (code) between to normalize ... function is an image processing power function that ... how to perform histogram ... histogram error bar color - comp.graphics.apps.gnuplotSo set style fill solid 1.0 border 3 set style histogram errorbars lw 2 ... Note that this paper only covers bar chart-specific differences -- to see additional ... Logarithmic Scale in Boxplot - comp.soft-sys.matlabBox Plot: Display of Distribution - Tools for Science Notice the difference in ... ... graphics.api.opengl Logarithmic Scale in Boxplot - comp.soft-sys.matlab Histogram ... differences between imagesc, image, and imshow and how do you ...I'm just trying to work out what's the differences between the MATLAB built in ... between imagesc, image, and imshow and how do you ... rgb ... RGB Histogram - comp ... what different between random noise and gaussian noise produced by ...The difference is that awgn() allows you to do much more than randn() without work on ... Noise, histogram fitting, and residuals - comp.soft-sys.matlab ..... for Histogram ... YCbCr tiff color problem - comp.graphics.apps.gimpGIMP histogram shows Green values topping out at 191, while Red ranges from 83 to ... It seems to make absolutely no difference to anything. ImageMagic interprets the ... comp.soft-sys.matlab - page 134Fast 2D Histogram in Matlab 2 1 (11/17/2003 3:06:18 AM) Does anyone know a method of ... However, as a difference, I also need to specify the bin edges, rather tha... Extracting bit planes from Images - comp.soft-sys.matlab ...... There's a difference between bit planes and color planes, but assuming you want the ... RGB Histogram - comp ... extract the various bit planes from an Image ... The Difference Between Histograms & Bar Graphs | eHow.comAccording to "Statistics in a Nutshell" by Boslaugh and Watters, bar charts are appropriate for displaying discrete data with only a few categories. A histogram looks ... Bar Charts and HistogramsThe Difference Between Bar Charts and Histograms. Here is the main difference between bar charts and histograms. With bar charts, each column ... 7/15/2012 4:47:05 PM
|
|
|
|
|
|
|
|
|