大家好,又见面了,我是你们的朋友全栈君。Circle
,中文含义指:即圆形。cvCircle是指绘制圆形的一个程序函数。
定义
参数
-
img 图像
-
center
圆心坐标 -
radius 圆形的半径
-
color 线条的颜色
-
thickness 如果是正数,表示组成圆的线条的粗细程度。否则,表示圆是否被填充
-
line_type 线条的类型。见 cvLine 的描述
-
shift 圆心坐标点和半径值的小数点位数
解释
Mat gray;
cvtColor(img, gray, CV_BGRA2GRAY);
int img_height = img.rows;
imshow(“gray”,gray);
int img_width = img.cols;
vector<Point2f> corners(4);
corners[0] = Point2f(0,0);
corners[1] = Point2f(img_width-1,0);
corners[2] = Point2f(0,img_height-1);
corners[3] = Point2f(img_width-1,img_height-1);
vector<Point2f> corners_trans(4);
corners_trans[0] = Point2f(15,25);
corners_trans[1] = Point2f(77,20);
corners_trans[2] = Point2f(10,65);
corners_trans[3] = Point2f(65,65);
/*corners_trans[2] = Point2f(0,img_height-1);
corners_trans[3] = Point2f(65,img_height-1);*/
for(int i = 0;i <corners_trans.size();i ++)
{
for(int j = 0;j < corners_trans.size();j++)
{
circle(img,Point2f(i,j),10,Scalar(0),2);
}
}


发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/161517.html原文链接:https://javaforall.net