⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 roicolor.m

📁 有关matlab的电子书籍有一定的帮助希望有用
💻 M
字号:
function dout=roicolor(a,low,high)
%ROICOLOR Select region of interest based on color.
%   ROICOLOR selects a region of interest 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 a region of interest
%   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 a region of interest 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 can be of class uint8 or double. The output
%   image BW is of class uint8.
%
%   Example
%   -------
%       I = imread('rice.tif');
%       BW = roicolor(I,128,255);
%       imshow(I), figure, imshow(BW)
%
%   See also ROIPOLY.

%   Clay M. Thompson 2-10-93
%   Copyright 1993-1998 The MathWorks, Inc.  All Rights Reserved.
%   $Revision: 5.8 $  $Date: 1997/11/24 15:36:18 $

error(nargchk(2,3,nargin));

if (isrgb(a))
    error('RGB images not supported.');
end

if nargin==2,
    v = low(:);
    d = repmat(logical(uint8(0)), size(a));
    for i=1:length(v),
        d(:) = d | (a==v(i));
    end
else
    d = uint8(a >= low) & uint8(a <= high);
end

if nargout==0,
    b = ones(size(a));
    b(d) = a(d);
    if min(a(:))<1, 
        imagesc(b);
    else 
        image(b), 
    end
    return
end
dout = d;






⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -