简体   繁体   中英

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# :

   // 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.

// 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;
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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