Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

SolvePNP Bad Result Planar Marker

Hello,

I'm working with solvePnp with some bad results for a planar marker.

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<cv::Point2d> 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.

image description

Any ideas? Other posts have suggested that rvec and tvec should be 64bit.

SolvePNP Bad Result Planar Marker

Hello,

I'm working with solvePnp with some bad results for a planar marker.

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<cv::Point2d> 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.

image description

Any ideas? Other posts have suggested that rvec and tvec should be 64bit.

Using CV_P3P gets three correct marker locations, but the third on is waay out.

image description

SolvePNP Bad Result Planar Marker

Hello,

I'm working with solvePnp with some bad results for a planar marker.

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<cv::Point2d> 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.

image description

Any ideas? Other posts have suggested that rvec and tvec should be 64bit.

Using CV_P3P gets three correct marker locations, but the third on final point is waay out.out. (CV_EPNP fails entirely)

image description

SolvePNP Bad Result Planar Marker

Hello,

I'm working with solvePnp with some bad results for a planar marker.

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<cv::Point2d> 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.

image description

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)

image description

Solid circles are projected points and hollow (correct locations) are from the homography matrix for the same points used in solvePnp. (3d points have z value dropped).

image description

SolvePNP Bad Result Planar Marker

Hello,

I'm working with solvePnp with some bad results for a planar marker.

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<cv::Point2d> 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.

image description

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)

image description

Solid circles are projected points and hollow (correct locations) are from the homography matrix for the same points used in solvePnp. (3d points have z value dropped).

image descriptionimage description

SolvePNP Bad Result Planar Marker

Hello,

I'm working with solvePnp with some bad results for a planar marker.

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<cv::Point2d> 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.

image description

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)

image description

Solid Full model...

Green line - marker points detected. Used for homography. Hollow circles are projected points and hollow (correct locations) are from the - model points under homography matrix for the same points used in solvePnp. (3d points have z value dropped).transform (z=0 ignored). Full circles - projectedPoints following solvePnp.

image description

SolvePNP Bad Result Planar Marker

Hello,

I'm working with solvePnp with some bad results for a planar marker.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<cv::Point2d> 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.

image description

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)

image description

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.

image description

SolvePNP Bad Result Planar Marker

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<cv::Point2d> 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.

image description

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)

image description

Full model...

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

solvePnp.

image description

SolvePNP Bad Result Planar Marker

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<cv::Point2d> 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.

image description

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)

image description

Full model...

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

image description

SolvePNP Bad Result Planar Marker

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<cv::Point2d> 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.

image description

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)

image description

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.

image description

solvePnpRansac

image description