![](/img/trans.png)
[英]How to find the transformation matrix for warpPerspective to bring the rotated image to the normalized position?
[英]Rotated image when using “findHomography” and “warpPerspective”
我目前正在開發ALPR系統。 首先,我要使用此處描述的方法檢測印版。
問題出在某些圖像上。 使用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包含板的四個點(並且是正確的,因為用於在蒙版中繪制白色框)。
有任何想法嗎? 提前致謝!
正如nico所說,問題在於plate_polygon中點的順序 。 生成它們的算法在起點上並不一致(在我的情況下,是從較低處開始)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.