[英]Opencv undistortPoints Assertion failed
我正在嘗試使用opencv undistortPoints函數使圖像不失真。 我得到以下斷言。
OpenCV錯誤:斷言失敗(src.isContinuous()&&(src.depth()== CV_32F || src.depth()== CV_64F)&&(((src.rows == 1 && src.channels()== 2 )||| src.cols * src.channels()== 2))在cv :: undistortPoints中,文件D:\\ OpenCV \\ 2.4.11 \\ opencv \\ sources \\ modules \\ imgproc \\ src \\ undistort.cpp,第394行
我無法弄清楚為什么我得到這個主張。 這是代碼:
cv::Mat pixel_locations_src = cv::Mat(src.size(), CV_32FC2);
for (int i = 0; i < src.size().height; i++)
{
for (int j = 0; j < src.size().width; j++)
{
pixel_locations_src.at<cv::Point2f>(i,j) = cv::Point2f(j,i);
}
}
cv::Mat pixel_locations_dst = cv::Mat(src.size(), CV_32FC2);
std::cout<<cameraMatrix<<std::endl;
std::cout<<distCoeffs<<std::endl;
cv::undistortPoints(pixel_locations_src, pixel_locations_dst, cameraMatrix, distCoeffs);
輸入參數如下所示:
pixel_locations_src是1920x1080矩陣。 cameraMatrix是3x3。 distCoeffs是8x1。
謝謝你的幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.