疑问:undistortPoints()与remap()畸变校正后,结果相差很大
????最近在做圖像點畸變校正相關的項目,發現OpenCV中的校正函數:undistortPoints()與remap()二者矯正畸變后,結果相差很大,原因不明,這里記錄下來,如有大神知其中差異,請賜教,感激不盡,歡迎在博客下方評論。
????下面先說一下函數的用法
undistortPoints()函數用法說明
void undistortPoints(InputArray src, OutputArray dst, InputArray cameraMatrix, InputArray distCoeffs, InputArrayR=noArray(), InputArray P=noArray())
參數說明:
正確調用方法:
調用方法
std::vectorcv::Point2f inputDistortedPoints = …
std::vectorcv::Point2f outputUndistortedPoints;
cv::Mat cameraMatrix = …
cv::Mat distCoeffs = …
cv::undistortPoints(inputDistortedPoints, outputUndistortedPoints, cameraMatrix, distCoeffs, cv::noArray(), cameraMatrix);
不要像下面這樣調用,輸出的點為圖像物理坐標系下坐標,結果很小,需再乘內參矩陣得到像面點坐標
cv::undistortPoints(inputDistortedPoints, outputUndistortedPoints, cameraMatrix, distCoeffs)
關于initUndistortRectifyMap()和remap()組合進行畸變校正的用法可參考如下博客,這里不再詳述:
remap()畸變校正參考博客
????二者進行畸變校正后的比較,首先提取出了未進行畸變校正的一些特征點,如圖1所示
??????????????????????????????????????????????????????????????????????????????????圖1
使用undistortPoints()進行校正特征點,結果如圖2
??????????????????????????????????????????????????????????????????????????????????圖2
使用initUndistortRectifyMap()和remap()組合進行畸變校正結果如圖3
??????????????????????????????????????????????????????????????????????????????????圖3
????從結果可看出undistortPoints()校正效果特別不明顯,原因不明,如有懂得小伙伴請指點一二,非常感謝~
更新
????最近有時間,根據下面博友評論中的鏈接重新做了一次兩種畸變校正方法效果對比,發現二者差異不大,現附上鏈接,有興趣的伙伴可以試試,歡迎討論~
????在此也非常感謝“stick02”這位博友的評論,解開了本人好久的困惑,同時也印證了分享的重要性,遂花了些時間再次寫篇博客和大家分享,覺得寫得不錯的歡迎點贊打賞哦~
OpenCV 畸變校正函數undistortPoints()與remap()詳解及校正效果對比
總結
以上是生活随笔為你收集整理的疑问:undistortPoints()与remap()畸变校正后,结果相差很大的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 张正友平面标定法的一些注意事项
- 下一篇: std::max,std::min错误: