我在运行以下代码时遇到问题:Mat cameraMatrix, distCoeffs;cameraMatrix = (Mat1f(3, 3) << 462.71, 0, 338.630, 0, 465.97, 177.780, 0, 0, 1);distCoeffs = (Mat1f(4, 1) << 0.133013, -0.322199, -0.001524, 0.004866);//skipMat color(Size(color_information.width, color_information.height), CV_8UC3, (void*)color_data.planes[0], color_data.pitches[0] / sizeof(uchar));Mat imageCopy;double tick = (double)getTickCount();vector<int>ids;vector<vector<Point2f>>corners, rejected;vector<Mat>rvecs, tvecs;aruco::detectMarkers(color, dictionary, corners, ids, detectorParams, rejected);double currentTime = ((double)getTickCount() - tick) / getTickFrequency();// draw resultscolor.copyTo(imageCopy);if (ids.size() > 0){ aruco::drawDetectedMarkers(imageCopy, corners, ids); vector<Mat>rvecs, tvecs; estimatePoseSingleMarkers(corners, 20, cameraMatrix, distCoeffs, rvecs, tvecs); for (int i = 0; i<ids.size(); i++) drawAxis(imageCopy, cameraMatrix, distCoeffs, rvecs[i], tvecs[i],0.1);}问题是程序执行到estimatePoseSingleMarkers(corners, 20, cameraMatrix, distCoeffs, rvecs, tvecs);时我收到这样的错误消息: OpenCV Error: Assertion failed (0 <= i && i < (int)v.size()) in cv::_InputArray::getMat_, file C:\opencv-3.0\source\opencv\modules\core\src\matrix.cpp, line 1253是由错误的格式引起的吗? (cameraMartix和distCoeffs)我需要一些帮助来找出问题所在。谢谢。 最佳答案 请尝试distCoeffs =(Mat1f(5,1)
07-28 01:27