# Synopse

Color-image histogram.

• hc = iacolorhist(f)
• hc: Image.
• f: Input Image.
``` 1 def iacolorhist(f):
2     import numpy as np
3     from iahistogram import iahistogram
4
5     WFRAME=5
6     f = np.asarray(f)
7     if len(f.shape) == 1: f = f[np.newaxis,:]
8     if not f.dtype == 'uint8':
9       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
16     hrg = np.zeros((256,256), np.int32)
17     h = iahistogram(256*r + g)
18     hrg.ravel()[:h.size] = h
19
20     hbg = np.zeros_like(hrg)
21     h = iahistogram(256*b + g)
22     hbg.ravel()[:h.size] = h
23
24     hrb = np.zeros_like(hrg)
25     h = iahistogram(256*r + b)
26     hrb.ravel()[:h.size] = h
27
28     m =max(hrg.max(),hbg.max(),hrb.max())
29     hc=m*np.ones((3*WFRAME+2*256,3*WFRAME+2*256))
30     hc[WFRAME:      WFRAME+256,  WFRAME:WFRAME+256        ] = np.transpose(hrg)
31     hc[WFRAME:      WFRAME+256,  2*WFRAME+256:2*WFRAME+512] = np.transpose(hbg)
32     hc[2*WFRAME+256:2*WFRAME+512,WFRAME:WFRAME+256        ] = np.transpose(hrb)
33     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.

# Examples

## Example 1

```1 import numpy as np
2 import ia636 as ia
3
```<type 'numpy.ndarray'> (3, 257, 256) uint8 0 218