-智神 2019-01-10 09:48 采纳率: 0%
浏览 2534
已结题

初学C#的OpenCVsharp,霍夫圆变换时圆心如何定义

VectorOfVec3f circles = new VectorOfVec3f();

        //Mat element = new Mat(, Size(13, 13));
        //Cv2.ImShow("Demo", source);
        //element = new Mat();
        //element=
        Cv2.HoughCircles(tempImage, HoughMethods.Gradient, 1.5, 50, 100, 100, 0, 0);
        for (int i = 0; i < circles.Size; i++)
        {

Point center = new Point((int)Math.Round(circles()), (int)Math.Round(circles(i,0))); //定义圆心

int radius = (int)Math.Round(circles.radius);

                            加黑一段的代码不知道这么写才对,求大神解惑,或者有没有opencvsharp的相关学习资料提供也相当感谢。
  • 写回答

2条回答

  • smallspirite 2019-03-19 15:36
    关注
    1. CircleSegment[] circles = Cv2.HoughCircles(tempImage, HoughMethods.Gradient, 1.5, 50, 100, 100, 0, 0);
    2. for (int i = 0; i < circles.Length; i++)
    3. {
    4. //绘制圆心
    5. Cv2.Circle(dstImage, Convert.ToInt32(circles[i].Center.X), Convert.ToInt32(circles[i].Center.Y), 3, new Scalar(0, 255, 0), -1, LineTypes.Link8, 0);
    6. //绘制圆轮廓
    7. Cv2.Circle(dstImage, Convert.ToInt32(circles[i].Center.X), Convert.ToInt32(circles[i].Center.Y), Convert.ToInt32(circles[i].Radius), new Scalar(155, 50, 255), 3, LineTypes.Link8, 0);
    8. }
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?