【发布时间】:2015-09-15 13:53:34
【问题描述】:
我一直在尝试获取如下所述的坐标: How to get coordinates of pixel after shape was rectified? 在 Emgu CV 3.0.0 中。 我可以使用以下代码扭曲图像(从上面的链接中窃取)
Image<Bgr, byte> theWarpedImage = new Image<Bgr, byte>(@"C:\myImage.jpg");
PointF[] srcs = new PointF[4];
srcs[0] = new PointF(1533, 2393);
srcs[1] = new PointF(4169, 1817);
srcs[2] = new PointF(1765, 1177);
srcs[3] = new PointF(3717, 621);
PointF[] dsts = new PointF[4];
dsts[0] = new PointF(0, 0);
dsts[1] = new PointF(2950, 0);
dsts[2] = new PointF(0, 2100);
dsts[3] = new PointF(2950, 2100);
PointF[] test = new PointF[4];
Mat mywarpmat = CvInvoke.GetPerspectiveTransform(srcs, dsts);
Image<Bgr, byte> theWarpedImage2 = new Image<Bgr, byte>(@"C:\myImage.jpg");
CvInvoke.WarpPerspective(theWarpedImage, theWarpedImage2, mywarpmat, theWarpedImage2.Size, Emgu.CV.CvEnum.Inter.Linear, Emgu.CV.CvEnum.Warp.Default, Emgu.CV.CvEnum.BorderType.Constant, new MCvScalar(0));
但我无法让 Luca Del Tongo 提供的解决方案在 3.0.0.0 版本中工作
你有什么建议吗?
感谢 MIKI:
var test2=CvInvoke.PerspectiveTransform(srcs, mywarpmat);
有效。
【问题讨论】:
-
我认为你应该在你的点坐标上使用
mywarpmat来调用cv::perspectiveTransform的等价物。 -
Miki 你可以添加你的评论作为答案吗?
-
我无法发布 C# 代码.. 发布您的解决方案并接受它。很高兴它有帮助。
标签: c# .net opencv image-processing emgucv