首页 > 编程知识 正文

在c中的使用方法,cv2.rectangle函数

时间:2023-05-03 17:24:47 阅读:58597 作者:2427

Circle,中文的意思是“圆形”。 cvCircle是指画圆的程序函数。 定义voidcvcircle (cvarr * img,CvPoint center,int radius,CvScalar color,int thickness=1,int line_type=8,int shift=0

如果参数img图像center圆的中心坐标radius圆的半径color线的颜色thickness为正数,则表示构成圆的线的粗细。 否则,指示圆是否用line_type线类型填充。 请参照cvLine的说明。 描述shift圆的中心坐标点和半径值的小数位数描述函数cvCircle绘制或填充指定圆的中心和半径圆。 圆被感兴趣的矩形切掉。 指定圆的颜色时,可以使用宏cv_RGB(r、g、b )。

matimg=imread('1.jpg );

马特格雷;

cvtcolor(img,gray,CV_BGRA2GRAY );

int img_height=img.rows;

imshow(gray )、gray );

int img_width=img.cols;

Vectorpoint2fCorners(4;

corners [0]=point 2f (0,0 );

corners [1]=point 2f (img _ width-1,0 );

corners[2]=point2f(0,img_height-1 );

Corners[3]=point2f(img_width-1,img_height-1 );

vectorpoint2fCorners_trans(4;

corners _ trans [0]=point 2f (15,25 );

corners _ trans [1]=point 2f (77,20 );

corners _ trans [2]=point 2f (10,65 );

corners _ trans [3]=point 2f (65,65 );

/*Corners_trans[2]=point2f(0,img_height-1 );

corners_trans[3]=point2f(65,img_height-1 ); */

for(intI=0; i corners_trans.size (; I )

{

for(intj=0; j corners_trans.size (; j )

{

circle(img,point2f(I,j ),10,Scalar(0) ),2 );

}

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。