# OpenCV的circle函数画圆的小技巧

## 前言

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

## 分析

//(a)图
circle(imgSrc, Point(c, r),3*round(dvecSigma[i])*,Scalar(0, 255, 0);

//(b)图
circle(imgSrc, Point(c*(1<<4), r*(1<<4)),
3*round(dvecSigma[i])*(1<<4), Scalar(0, 255, 0), 1,CV_AA,4);

//就是这个变量
const int draw_shift_bits = 4;
const int draw_multiplier = 1 << draw_shift_bits;

namespace cv
{

/*
* Functions to draw keypoints and matches.
*/
static inline void _drawKeypoint( Mat& img, const KeyPoint& p,
const Scalar& color, int flags )
{
CV_Assert( !img.empty() );
//中心点*(1<<4)
Point center( cvRound(p.pt.x * draw_multiplier), cvRound(p.pt.y * draw_multiplier) );

if( flags & DrawMatchesFlags::DRAW_RICH_KEYPOINTS )
{
//半径*(1<<4)
int radius = cvRound(p.size/2 * draw_multiplier); // KeyPoint::size is a diameter

// 画圆
circle( img, center, radius, color, 1, CV_AA, draw_shift_bits );

// draw orientation of the keypoint, if it is applicable
if( p.angle != -1 )
{
);
line( img, center, center+orient, color, 1, CV_AA, draw_shift_bits );
}
...

• 本文已收录于以下专栏：

举报原因： 您举报文章：OpenCV的circle函数画圆的小技巧 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)