在 Emgu CV 中执行 Dougman't 方法(Rubber Sheet 模型)
Perform Dougman't Method (Rubber Sheet Model) in Emgu CV
我有一个关于如何从 emgu cv 中的圆制作橡胶 sheet 模型的问题,这是我在 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();
我用自己的代码解决了。此代码 return 从输入图像到 sheet 模型 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;
}
我有一个关于如何从 emgu cv 中的圆制作橡胶 sheet 模型的问题,这是我在 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();
我用自己的代码解决了。此代码 return 从输入图像到 sheet 模型 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;
}