Hello,
I'm working with solvePnp with some bad results for a planar marker. The marker is a basket ball court. So the model size is 14 x 15.
Marker is (-7,-7.5,0) to (7,7.5,0). (Should this be normalized to 1 for homogeneous coordinates??) The chessboard size was 6x9 with 0.025 square size. Chessboard and marker are in same units of measurement.
We have 3d Object points and 2d image points. The image is undistorted when when 2d points are detected so distCoeffs can be cv::Mat() from here on out. (i.e. no distortion)
The 2d points are for a marker that is of known size is 14m by 15m. The chessboard square size was also in meters (0.025m square size).
//Make sure 64bit
rvec = cv::Mat(3, 1, CV_64F);
tvec = cv::Mat(3, 1, CV_64F);
bool flag = cv::solvePnP(allImagePoints3d, allImagePoints, camMatrix64, cv::Mat(), rvec, tvec);
std::vector projectedPoints;
cv::Mat J;
cv::projectPoints(allImagePoints3d, rvec, tvec, camMatrix64, cv::Mat(), projectedPoints, J);
cv::Mat Sigma = cv::Mat(J.t() * J, cv::Rect(0,0,6,6)).inv();
// Compute standard deviation
cv::Mat std_dev;
sqrt(Sigma.diag(), std_dev);
std::cout << "rvec1, tvec1 standard deviation:" << std::endl << std_dev << std::endl;
I then draw these projected points in red and original points in green.

Any ideas? Other posts have suggested that rvec and tvec should be 64bit.
Using CV_P3P gets three correct marker locations, but the final point is waay out. (CV_EPNP fails entirely)

Full model...
- Green line: marker points detected.
Used for homography.
- Hollow circles:
model points under homography
transform (z=0 ignored).
- Full
circles: projectedPoints following
solvePnp.

solvePnpRansac

↧