OpenCV circle图像上画圆

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/caomin1hao/article/details/81876836

OpenCV中circle与rectangle函数显示,只不过rectangle在图像中画矩形,circle在图像中画圆。

 

 

void circle(Mat  img, Point center, int radius, Scalar color, int thickness=1, int lineType=8, int shift=0)

img为源图像

center为画圆的圆心坐标

radius为圆的半径

color为设定圆的颜色,规则根据B(蓝)G(绿)R(红)

thickness 如果是正数,表示组成圆的线条的粗细程度。否则,表示圆是否被填充

line_type 线条的类型。默认是8

shift 圆心坐标点和半径值的小数点位数

 

示例程序:

#include <iostream>  

#include <opencv2/core/core.hpp>

#include <opencv2/imgproc/imgproc.hpp>

#include <opencv2/opencv.hpp>

using namespace std;

using namespace cv;


int main()

{

    Mat src = imread("C:\\tupian\\test1.jpg", 3);

    circle(src, Point(src.cols/ 2, src.rows / 2), 30, Scalar(0, 0, 255));

    imshow("src", src);

    waitKey(0);

    return 0;

}

 

 

猜你喜欢

转载自blog.csdn.net/caomin1hao/article/details/81876836
今日推荐