File Exchange

## Color Histogram of an RGB Image

version 1.4 (2.17 KB) by

computes color histogram of an RGB image, number of bins is user input and is same for R,G and B.

Updated

Computes color histogram of an RGB image, number of bins(for each color component) is user input and is same for R,G and B. The output histogram can be un-normalized, l1-normalized or l2-normalized. The functin can compute color histogram for an image for a patch also.

Sidra

Srinivasan Raman

### Srinivasan Raman (view profile)

why it is nbins^3 long ?

Sagar Mahajan

### Sagar Mahajan (view profile)

Konda Reddy Mopuri

### Konda Reddy Mopuri (view profile)

@vijaya: If i understood your issue correctly, you are trying to cluster the rgb histograms. Which can be done using different clustering approaches. You can look from the simple K-means clustering. Many of clustering approaches are there in the literature like meanshift based, spectral etc. Most of them are implemented in MATLAB and you can get the codes in file-exchange.

Vijaya

### Vijaya (view profile)

can u tell me how to cluster the features which i have extracted using ur rgbhist_fast program. i need to extract the rgb features for videos and need to cluster them. please help me with the code.

Konda Reddy Mopuri

### Konda Reddy Mopuri (view profile)

@Ibrahim
It seems, you have executed the function directly (without the input parameters 'I' ans 'nBins'). Can you please read an rgb image into a variable 'I' using 'imread' and pass it as the input argument. For example, H=rgbhist_fast(I,4); will give the histogram into a variable 'H'.

Ibrahim Thorig

### Ibrahim Thorig (view profile)

dear, when i tried this code it gives me error

??? Input argument "I" is undefined.

Error in ==> rgbhist_fast at 16
if (size(I, 3) ~= 3)

could you explain me why it happens

Tai Tran

Nikolay S.

### Nikolay S. (view profile)

Good implementation- short and efficient. A little bit straight forward- implemented pixel-wise. Will be best for small images.

Vijaya

### Vijaya (view profile)

sir can u tell me how to get the 32 dimensional RGB color histograms of an image in the range of [0,1] using matlab.help me with the code sir. please.