xingma0910

学习中……

导航

cvRectangle 用法

Rectangle
绘制简单、指定粗细或者带填充的 矩形 

void cvRectangle( CvArr* img, CvPoint pt1, CvPoint pt2, CvScalar color,
                  int thickness=1, int line_type=8, int shift=0 );
img 
图像. 
pt1 
矩形的一个顶点。 
pt2 
矩形对角线上的另一个顶点 
color 
线条颜色 (RGB) 或亮度(灰度图像 )(grayscale image)。 
thickness 
组成矩形的线条的粗细程度。取负值时(如 CV_FILLED)函数绘制填充了色彩的矩形。 
line_type 
线条的类型。见cvLine的描述 
shift 
坐标点的小数点位数。 
  
函数 cvRectangle 通过对角线上的两个顶点绘制矩形。
如:
cvRectangle( ResImage, cvPoint(x1,y1), cvPoint(x2,y2), CV_RGB(255,250,250), 2, 8, 0 );
其中(x1,y1)是坐标为x1,y1的点。这里要注意,x1对应Width,y1代表Height.具体应用的时候不要搞反了。

posted on 2012-07-24 15:18  xingma0910  阅读(3873)  评论(0编辑  收藏  举报