Function ialblshow

Synopse

Display a labeled image assigning a random color for each label.

  • g = ialblshow(f)
    • g: Image.
    • f: Image. input image
01. import numpy as np
02. from numpy.random import rand
03. 
04. def ialblshow(f):
05.     from iaapplylut import iaapplylut
06. 
07.     nblobs = f.max()
08.     r = np.floor(0.5 + 255*rand(nblobs, 1))
09.     g = np.floor(0.5 + 255*rand(nblobs, 1))
10.     b = np.floor(0.5 + 255*rand(nblobs, 1))
11.     ct = np.concatenate((r,g,b), 1)
12.     ct = np.concatenate(([[0,0,0]], ct))
13. 
14.     g = iaapplylut(f, ct)
15.     return g

Description

Displays the labeled input image (uint8 or uint16) with a pseudo color where each label appears with a random color.

Examples

Example 1

1. from ia636 import ialblshow, iaramp
2. 
3. f = iaramp([200,300], 10, [0,255])
4. adshow(f)
5. adshow(ialblshow(f))