# Synopse

Color-image histogram.

• hc: Image.
• f: Image.
```01. def iacolorhist(f, mask=None):
02.     import numpy as np
03.     from iahistogram import iahistogram
04.
05.     WFRAME=5
06.     f = np.asarray(f)
07.     if len(f.shape) == 1: f = f[np.newaxis,:]
08.     if not f.dtype == 'uint8':
09.       raise Exception,'error, can only process uint8 images'
10.     if not f.shape[0] == 3:
11.       raise Exception, 'error, can only process 3-band images'
12.
13.     r,g,b = f[0].astype(np.int), f[1].astype(np.int), f[2].astype(np.int)
14.
15.     n_zeros = 0
19.
20.     hrg = np.zeros((256,256), np.int32); hbg=hrg+0; hrb=hrg+0
21.     img = 256*r + g; m1 = img.max()
22.     aux = iahistogram(img.astype(np.int32)); aux[0] = aux[0] - n_zeros
23.     np.put(np.ravel(hrg), range(m1+1), aux)
24.     img = 256*b + g; m2 = img.max()
25.     aux = iahistogram(img.astype(np.int32)); aux[0] = aux[0] - n_zeros
26.     np.put(np.ravel(hbg), range(m2+1), aux)
27.     img = 256*r + b; m3 = img.max()
28.     aux = iahistogram(img.astype(np.int32)); aux[0] = aux[0] - n_zeros
29.     np.put(np.ravel(hrb), range(m3+1), aux)
30.     m=max(hrg.max(),hbg.max(),hrb.max())
31.     hc=m*np.ones((3*WFRAME+2*256,3*WFRAME+2*256))
32.     hc[WFRAME:WFRAME+256,WFRAME:WFRAME+256] = np.transpose(hrg)
33.     hc[WFRAME:WFRAME+256,2*WFRAME+256:2*WFRAME+512] = np.transpose(hbg)
34.     hc[2*WFRAME+256:2*WFRAME+512,WFRAME:WFRAME+256] = np.transpose(hrb)
35.     return hc```

# Description

Compute the histogram of a color image and return a graphical image suitable for visualization with the 3 marginal histograms: red-green at top-left, blue-green at top-right and red-blue at bottom-left. If the optional mask image is available, the histogram is computed only for those pixels under the mask.

# Examples

## Example 1

```1. from ia636 import iacolorhist, iaimginfo, ianormalize
2.
```<type 'numpy.ndarray'> (3, 257, 256) uint8 0.000000 218.000000