OpenCV circle图像上画圆
生活随笔
收集整理的這篇文章主要介紹了
OpenCV circle图像上画圆
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
OpenCV中circle與rectangle函數(shù)顯示,只不過rectangle在圖像中畫矩形,circle在圖像中畫圓。
?
?
void circle(Mat img, Point center, int radius, Scalar color, int thickness=1, int lineType=8, int shift=0)img為源圖像
center為畫圓的圓心坐標(biāo)
radius為圓的半徑
color為設(shè)定圓的顏色,規(guī)則根據(jù)B(藍(lán))G(綠)R(紅)
thickness 如果是正數(shù),表示組成圓的線條的粗細(xì)程度。否則,表示圓是否被填充
line_type 線條的類型。默認(rèn)是8
shift 圓心坐標(biāo)點(diǎn)和半徑值的小數(shù)點(diǎn)位數(shù)
?
示例程序:
#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;}?
?
總結(jié)
以上是生活随笔為你收集整理的OpenCV circle图像上画圆的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: matlab reshape矩阵维度变换
- 下一篇: matlab exist()判断目录文件