histogramcv

Computes the histogram of the red, green and blue colors of an image.

Syntax

R = histogramcv(handle, bins, dims)

[R, R1] = histogramcv(handle, bins, 1)

Inputs

handle
Handle of an image.
Type: integer
bins
Number of bins in the histogram, the value must be a positive integer.
Type: integer
dims
Dimension of the histogram. Valid values are 1 or 2. A value of 1 will generate a 1D histogram and a value of 2 will generate A 2D histogram.
Type: integer

Outputs

R
Handle of the histogram image.
Type: integer
R1
Handle of the histogram image with axes information. This is valid only for 1-dimensional histograms.
Type: integer

Examples

Generate a 1D histogram for the input image:

handle = imreadcv('image1.jpg');
bins = 256;
dims = 1;
R = histogramcv(handle, bins, dims);
plothandle = imshowcv(R);


Figure 1. Source image


Figure 2. Histogram of source image
Generate 1D histograms with axes information:

handle = imreadcv('image1.jpg');
bins = 256;
[R, R1] = histogramcv(handle, bins, 1);
plothandle = imshowcv(R1);


Figure 3. Source image


Figure 4. Histogram of source image with axes information