This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Select region of interest (ROI) based on color


BW = roicolor(A,low,high)
BW = roicolor(A,v)


roicolor selects a region of interest (ROI) within an indexed or intensity image and returns a binary image. (You can use the returned image as a mask for masked filtering using roifilt2.)

BW = roicolor(A,low,high) returns an ROI selected as those pixels that lie within the colormap range [low high].

BW = (A >= low) & (A <= high)

BW is a binary image with 0's outside the region of interest and 1's inside.

BW = roicolor(A,v) returns an ROI selected as those pixels in A that match the values in vector v. BW is a binary image with 1's where the values of A match the values of v.

Class Support

The input image A must be numeric. The output image BW is of class logical.


collapse all

Load an indexed image.

load clown

Create binary mask image based on color.

BW = roicolor(X,10,20);

Display the original image and the binary mask.



See Also


Introduced before R2006a

Was this topic helpful?