M-File Help: idisplabel | View code for idisplabel |
Display an image with mask
idisplabel(im, labelimage, labels) displays only those image pixels which belong to a specific class. im is a greyscale (HxW) or color (HxWx3) image, and labelimage (HxW) contains integer pixel class labels for the corresponding pixels in im. The pixel classes to be displayed are given by labels which is either a scalar or a vector of class labels. Non-selected pixels are displayed as white by default.
idisplabel(im, labelimage, labels, bg) as above but the grey level of the non-selected pixels is specified by bg in the range 0 to 1 for a float image or 0 to 255 for a uint8 image..
We will segment the image flowers into 7 color classes
cls = colorkemans(flowers, 7);
where the matrix cls is the same size as flowers and the elements are the corresponding pixel class, a value in the range 1 to 7. To display pixels of class 5 we use
idisplabel(flowers, cls, 5)
and to display pixels belong to class 1 or 5 we use
idisplabel(flowers, cls, [1 5])
© 1990-2012 Peter Corke.