【问题标题】:Rotated image when using "findHomography" and "warpPerspective"使用“findHomography”和“warpPerspective”时的旋转图像
【发布时间】:2018-05-13 06:45:00
【问题描述】:

我目前正在开发一个 ALPR 系统。为了首先检测板块,我使用here描述的方法。

问题来自某些图像。使用 findHomography 和 warpPerspective 后,它给了我旋转的车牌图像。

这是给我带来问题的原始图像。

这是检测到的板块轮廓

这是扭曲的图像

如您所见,它旋转了 90 度。在其他示例中,检测效果惊人。

具体的一段代码

cv::Mat warpped_plate( PLATE_HEIGHT, PLATE_WIDTH, CV_8UC3 );
vector< cv::Point> real_plate_polygons;
real_plate_polygons = {cv::Point(PLATE_WIDTH, PLATE_HEIGHT), cv::Point(0, PLATE_HEIGHT), cv::Point(0, 0), cv::Point(PLATE_WIDTH, 0)};
cv::Mat homography = cv::findHomography( plate_polygons, real_plate_polygons );
cv::warpPerspective(source_img, warpped_plate, homography, cv::Size(PLATE_WIDTH, PLATE_HEIGHT));

其中 plate_polygons 包含板块的四个点(并且是正确的,因为用于绘制蒙版中的白色框)。

有什么想法吗?提前致谢!

【问题讨论】:

  • 那么,plate_polygon 的顺序显然是错误的。循环输入以达到您在real_plate_polygons 中的角顺序。

标签: c++ opencv computer-vision


【解决方案1】:

正如 nico 提到的,问题在于 plate_polygon 中点的顺序。生成它们的算法在起点上不一致(在我的例子中,从较低的起点开始)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-07
    • 2015-09-24
    • 2018-05-24
    • 1970-01-01
    • 1970-01-01
    • 2018-02-13
    • 1970-01-01
    • 2020-07-01
    相关资源
    最近更新 更多