matlab中如何给特定区域填充色彩?

如题所述

使用fill函数,具体的方法是
fill(x,y,c)
其中区域是使用x和y来指定,c来指定颜色
例如fill([0 1 1 0],[0 0 1 1],'r')是给一个矩形区域填充红色

FILL(X,Y,C) fills the 2-D polygon defined by vectors X and Y
with the color specified by C. The vertices of the polygon
are specified by pairs of components of X and Y. If necessary,
the polygon is closed by connecting the last vertex to the first.

If C is a single character string chosen from the list 'r','g','b',
'c','m','y','w','k', or an RGB row vector triple, [r g b], the
polygon is filled with the constant specified color.

祝你学习愉快!
温馨提示:内容为网友见解,仅供参考
第1个回答  推荐于2017-09-17
使用fill函数,具体的方法是:
fill(x,y,c)。
其中区域是使用x和y来指定,c来指定颜色。
例如fill([0 1 1 0],[0 0 1 1],'r')是给一个矩形区域填充红色。
FILL(X,Y,C) fills the 2-D polygon defined by vectors X and Y with the color specified by C. The vertices of the polygon are specified by pairs of components of X and Y. If necessary,
the polygon is closed by connecting the last vertex to the first.
If C is a single character string chosen from the list 'r','g','b',
'c','m','y','w','k', or an RGB row vector triple, [r g b], the polygon is filled with the constant specified color.
第2个回答  2011-02-05
把每个像素按照rgb分量分别赋值,最后用imshow显示图像即可
相似回答