大家好,又见面了,我是你们的朋友全栈君。Circle ,中文含义指:即圆形。cvCircle是指绘制圆形的一个程序函数。
void cvCircle( CvArr* img, CvPoint center, int radius, CvScalar color, int thickness=1, int line_type=8, int shift=0 );
函数cvCircle绘制或填充一个给定圆心和半径的圆。圆被感兴趣矩形所裁剪。 若指定圆的颜色,可以使用宏 CV_RGB ( r, g, b )。
Mat img=imread(“1.jpg”); 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.cn/161517.html原文链接:https://javaforall.cn