Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you get the center position in estimateHomography() of Quad.cpp? #14

Open
DavidLeeDoosan opened this issue Jan 28, 2021 · 2 comments

Comments

@DavidLeeDoosan
Copy link

Hello, I deeply study your S-tag program.

I have a question. May I ask you some about making the center position of the mark?

// product of these transformations is the homography
H = HarInv * Haffsim;

// locate the projection of the center of the marker
Mat origCenter(3, 1, CV_64FC1);
origCenter.at<double>(0) = 0.5;
origCenter.at<double>(1) = 0.5;
origCenter.at<double>(2) = 1;

origCenter = H * origCenter;
center.x = origCenter.at<double>(0) / origCenter.at<double>(2);
center.y = origCenter.at<double>(1) / origCenter.at<double>(2);

Why do you divide "origCenter.at(2) " from each x, y Coordinator?

In addition, can I get Z Coordinator of the mark center in the camera pose if I take hand-eye calibration?

is it possible?

@bbenligiray
Copy link
Owner

Hi, @DavidLeeDoosan

Why do you divide "origCenter.at(2) " from each x, y Coordinator?

origCenter is represented as homogeneous coordinates. To convert that to Cartesian (i.e. regular) coordinates, I'm normalizing it. See the links below

http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/BEARDSLEY/node2.html (part c)

https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#convertpointsfromhomogeneous

In addition, can I get Z Coordinator of the mark center in the camera pose if I take hand-eye calibration?

Try using solvePnP to find the camera pose and look at tvec, that may be what you're looking for.

@DavidLeeDoosan
Copy link
Author

Hi, bbenligiray.

I got the marker's center from "origCenter = H * origCenter" of estimateHomography().
the marker's center is (x, y).
After I calculate cv::solvePnP(objectPoints, corners, cameraMatrix1, distCoeff1, rvec, tvec), I get rvec and tvec.
I would like to make X of transpose, Y of transpose and Z of transpose (Tx, Ty, Tz) by using tvec and marker's center.

How can I found transpose tvec of the marker's center?

Thank you for your attention.

Hi, @DavidLeeDoosan

Why do you divide "origCenter.at(2) " from each x, y Coordinator?

origCenter is represented as homogeneous coordinates. To convert that to Cartesian (i.e. regular) coordinates, I'm normalizing it. See the links below

http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/BEARDSLEY/node2.html (part c)

https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#convertpointsfromhomogeneous

In addition, can I get Z Coordinator of the mark center in the camera pose if I take hand-eye calibration?

Try using solvePnP to find the camera pose and look at tvec, that may be what you're looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants