[英]How can I draw a circle with antialiasing and gaussian line intensity using EmguCV (OpenCV)?
I need to draw the most perfect circle possible. 我需要画出最完美的圆圈。 EmguCV seems to lack an anti-aliasing option.
EmguCV似乎缺乏抗锯齿选项。
I'm trying to use SmoothGaussian, but the circle still does not look good/smooth enough. 我正在尝试使用SmoothGaussian,但圆圈仍然不够好/光滑。
Also, the circle line intensity should have Gaussian shape (ie: brighter in the center). 此外,圆线强度应具有高斯形状(即:在中心更亮)。
How can I achieve that? 我怎样才能做到这一点?
Here is what I'm doing now: 这是我现在正在做的事情:
using (Image<Gray, Byte> img = new Image<Gray, byte>(800, 800, new Gray(0)))
{
PointF center = new PointF(img.Width / 2, img.Height / 2);
//Center line
float r = 200.0f;
CircleF circle = new CircleF(center, r);
img.Draw(circle, new Gray(255), 1);
img._SmoothGaussian(7, 7, 3, 3);
}
If you use Brg, Brga or Gray color you can use that hack: 如果您使用Brg,Brga或Grey颜色,您可以使用该黑客:
using(var graph = Graphics.FromImage(image.Bitmap))
{
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graph.DrawEllipse(new Pen(color.BackColor), x, y, d`i`ameter, diameter);
}
` Edit: You can also use cvInvoke `编辑:你也可以使用cvInvoke
var center = new Point(x, y);
var color = new Bgr(this.color.BackColor);
CvInvoke.cvCircle(image.Ptr, center, radius, color.MCvScalar, thickness, Emgu.CV.CvEnum.LINE_TYPE.CV_AA, 0);
` `
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.