1 | initial version |
it gets slightly advanced here, but to find the 2d position of your marker on the screen, you have to project it from the 3d space of the rvec / tvec back to 2d, in the very same way, drawAxis() does it.
untested (i don't have any aruco markers), but something like this:
# a list with a single point in it:
pt = [[0,0,0]] # maybe you want some x or y offset, so it does not interfere with drawAxis() !
imgpts = cv2.projectPoints(pt, self.rvecs[i], self.tvecs[i], camera_matrix, dist_coeffs)
cv2.putText(cv_image, imgpts[0], sometext, ...)
2 | No.2 Revision |
it gets slightly advanced here, but to find the 2d position of your marker on the screen, you have to project it from the 3d space of the rvec / tvec back to 2d, in the very same way, drawAxis() does it.
untested (i don't have any aruco markers), but something like this:
# a list with a single point in it:
pt = [[0,0,0]] # maybe you want some x or y offset, so it does not interfere interfer with drawAxis() !
imgpts pt = [[0,0,0]]
imgpts, _ = cv2.projectPoints(pt, self.rvecs[i], self.tvecs[i], camera_matrix, dist_coeffs)
cv2.putText(cv_image, imgpts[0], imgpts[0][0][0], sometext, ...)
3 | No.3 Revision |
it gets slightly advanced here, but to find the 2d position of your marker on the screen, you have to project it from the 3d space of the rvec / tvec back to 2d, in the very same way, drawAxis() does it.
untested (i don't have any aruco markers), but something like this:
# a list with a single point in it:
# maybe you want some x or y offset, so it does not interfer with drawAxis() !
pt = [[0,0,0]]
imgpts, _ = cv2.projectPoints(pt, self.rvecs[i], self.tvecs[i], camera_matrix, dist_coeffs)
cv2.putText(cv_image, imgpts[0][0][0], imgpts[0][0], sometext, ...)
4 | No.4 Revision |
it gets slightly advanced here, but to find the 2d position of your marker on the screen, you have to project it from the 3d space of the rvec / tvec back to 2d, in the very same way, drawAxis() does it.
untested (i don't have any aruco markers), but something like this:
# a list with a single point in it:
# maybe you want some x or y offset, so it does not interfer interfere with drawAxis() !
pt = [[0,0,0]]
imgpts, _ = cv2.projectPoints(pt, self.rvecs[i], self.tvecs[i], camera_matrix, dist_coeffs)
cv2.putText(cv_image, imgpts[0][0], sometext, ...)
5 | No.5 Revision |
it gets slightly advanced here, but to find the 2d position of your marker on the screen, you have to project it from the 3d space of the rvec / tvec back to 2d, in the very same way, drawAxis() does it.
untested (i don't have any aruco markers), but something like this:
# a list with a single point in it:
it (relative to the tvec position):
# maybe you want some x or y offset, so it does not interfere with drawAxis() !
pt = [[0,0,0]]
imgpts, _ = cv2.projectPoints(pt, self.rvecs[i], self.tvecs[i], camera_matrix, dist_coeffs)
cv2.putText(cv_image, imgpts[0][0], sometext, ...)
6 | No.6 Revision |
it gets slightly advanced here, but to find the 2d position of your marker on the screen, you have to project it from the 3d space of the rvec / tvec back to 2d, in the very same way, drawAxis() does it.
untested (i don't have any aruco markers), but something like this:
# a list with a single point in it (relative to the tvec position):
# maybe you want some x or y offset, so it does not interfere with drawAxis() !
pt = [[0,0,0]]
np.array([[-12, -12, 0]], dtype=np.float)
imgpts, _ = cv2.projectPoints(pt, self.rvecs[i], self.tvecs[i], camera_matrix, dist_coeffs)
cv2.putText(cv_image, imgpts[0][0], sometext, ...)