简体   繁体   English

在Emgu CV中执行Dougman't方法(橡胶板模型)

[英]Perform Dougman't Method (Rubber Sheet Model) in Emgu CV

I've a problem with how to make rubber sheet model from circle in emgu cv , this is my code in c# : 我在emgu cv中如何从圆形制作橡胶板模型时遇到问题,这是我在c#代码:

   // looking for iris

        CircleF[] circles = cannyEdges.HoughCircles(
                  cannyThreshold,
                  circleAccumulatorThreshold,
                  3.6, //Resolution of the accumulator used to detect centers of the circles
                  cannyEdges.Height / 2, //min distance 
                  2, //min radius
                  0 //max radius
               )[0]; //Get the circles from the first channel
        var img = myImage.Clone();
        var img2 = myImage.Clone();

        foreach (CircleF circle in circles)
            img.Draw(circle, new Bgr(Color.Brown), 10);
            pictureBox3.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox3.Image = img.ToBitmap();

I solve it with my own code. 我用自己的代码解决它。 This code return value from input image to sheet model 116 x 360 pixel. 此代码从输入图像到图纸模型116 x 360像素的返回值。

// Fungsi untuk merubah bentuk donnut menjadi lembaran
        public Image<Gray, Byte> dougman(Image<Gray,Byte> cit, Double radiris) 
        {
            double xP, yP, r, theta;
            Image<Gray, Byte> grayT = new Image<Gray, Byte>(360, 116);

            for (int i = 0; i < 116; i++)
            {
                for (int j = 0; j < 360; j++)
                {
                    r = i;
                    theta = 2.0 * Math.PI * j / 360;
                    xP = r * Math.Cos(theta);
                    yP = r * Math.Sin(theta);
                    xP = xP + radiris + 10; //sekitar 115
                    yP = yP + radiris + 10;
                    grayT[116 - 1- i, j] = cit[(int)xP, (int)yP];
                }
            }
            return grayT;
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM