- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个字段中的点列表(如 upper_goal_point
/left_upper_outer_corner
等)
我知道它们在目标图像中的对应坐标 - 所以我可以计算单应性:
h, status = cv2.findHomography(pts_src, pts_dst)
我在上角线也有蓝点(看上图),我只知道他们目的地的y
坐标是0(因为他们在上线),但我不知道它们在那条线上的确切位置。
我可以使用那些蓝点来提高单应性吗?
附言
可以看到单应图中的上角
线不是水平线,是对角线,这当然是不正确的:
最佳答案
实际上可以在查找单应性中使用线对应。
几年前,我们在一个项目中实现了这种方法。在简化所有数学的过程中,我们想出了一个简单的技巧。我们将每一行 a*x + b*y + c = 0
转换为指向 (a/c, b/c)
// *** Don't copy paste this code, read below! ***//
Point2f convertPointsToHomogeneousLine(Point2f p1, Point2f p2) {
Point3f p1h(p1.x, p1.y, 1);
Point3f p2h(p2.x, p2.y, 1);
Point3f lineHomo(p1h.y*p2h.z - p1h.z*p2h.y,
p1h.z*p2h.x - p1h.x*p2h.z,
p1h.x*p2h.y - p1h.y*p2h.x);
Point2f lineHomoNorm(lineHomo.x / lineHomo.z,
lineHomo.y / lineHomo.z);
return lineHomoNorm;
}
然后把这个点传进去。我记得我还深入了解了 findHomography
的 OpenCV 实现,并将此行插入到内部某处以解决步骤。在 OpenCV 内部,在通过求解步骤之前,对点应用了一些归一化。所以这类点需要跳过这一步。
我们不在生产中使用它。用户需要通过在图像和仪表系统中提供线和点来手动校准相机。界面过于复杂,稳定性差。但就您而言,我认为它可以更好地工作。如果你会自动找到行和信件。
P.S. Please note that in paper they use some normalization technique.It will improve stability. We faced with stability problem, do notsolved it in our journey.
关于python-3.x - 通过点和线计算 CV2 单应性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72852992/
我是一名优秀的程序员,十分优秀!