【问题标题】:Draw circles on the image after applying hough transform?应用霍夫变换后在图像上画圆圈?
【发布时间】:2014-03-29 15:44:41
【问题描述】:

我正在使用 AForge 的 HoughCircleTransformation 类来检测圆圈。我想在检测到圆圈的图像上绘制圆圈(以突出显示原始图像上的圆圈)。我如何修改“foreach 循环”来做到这一点?

 public Bitmap hough(Bitmap bmp)
    {
        HoughCircleTransformation circleTransform = new HoughCircleTransformation(35);
        // apply Hough circle transform
        circleTransform.ProcessImage(bmp);
        Bitmap houghCirlceImage = circleTransform.ToBitmap();
        // get circles using relative intensity
        HoughCircle[] circles = circleTransform.GetCirclesByRelativeIntensity(0.5);
        int numCircles = circleTransform.CirclesCount;
        MessageBox.Show("Number of circles found : " + numCircles.ToString());
        foreach (HoughCircle circle in circles)
        {

          //code to draw circle
        }
        return bmp;
    }

【问题讨论】:

    标签: c# asp.net image-processing aforge


    【解决方案1】:

    你有 X,Y 和半径。

    要在位图上绘图,请使用 System.Drawing.Graphics。

    例如

      var g = Graphics.FromBitmap(bmp); 
      g.DrawEllipse(...);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-30
      • 2016-12-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多