Skip to content

Fix calibrate#23757

Closed
siilats wants to merge 2 commits intoopencv:4.xfrom
siilats:fix-calibrate
Closed

Fix calibrate#23757
siilats wants to merge 2 commits intoopencv:4.xfrom
siilats:fix-calibrate

Conversation

@siilats
Copy link
Copy Markdown
Contributor

@siilats siilats commented Jun 7, 2023

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

siilats added 2 commits June 6, 2023 22:03
functioning version with a default set of flags that works with the broken charuco boards
fixed small bug
@asmorkalov asmorkalov self-requested a review June 7, 2023 06:48
@asmorkalov asmorkalov added this to the 4.8.0 milestone Jun 7, 2023
Comment on lines +145 to +146
# cv.drawChessboardCorners(vis, pattern_size, corners, found)
cv.aruco.drawDetectedCornersCharuco(vis, corners, charucoIds=_charucoIds)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sample supports both chessboards and charuco boards. The change breaks the first one.

Comment on lines +191 to +202
fov = 60
focal_length = width / (2 * np.tan(fov * np.pi / 360))
mtx = np.array([[focal_length, 0, w / 2],
[0, focal_length, h / 2],
[0, 0, 1]])
dist = np.array([[0, 0, 0, 0, 0]], dtype=np.float32)
flags = cv2.CALIB_USE_INTRINSIC_GUESS + cv2.CALIB_FIX_K3 + cv2.CALIB_FIX_K4 + cv2.CALIB_FIX_K5 + cv2.CALIB_FIX_K6
flags += cv2.CALIB_FIX_K2
flags += cv2.CALIB_ZERO_TANGENT_DIST
flags += cv2.CALIB_FIX_PRINCIPAL_POINT
flags += cv2.CALIB_FIX_ASPECT_RATIO
rms, camera_matrix, dist_coefs, _rvecs, _tvecs = cv.calibrateCamera(obj_points, img_points, (w, h), mtx, dist, flags=flags)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not relevant to the sample

for (corners, pattern_points) in chessboards:
img_points.append(corners)
obj_points.append(pattern_points)
obj_points_tmp, img_points_tmp = matchImagePointsforcharuco(board, corners, _charucoIds)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asmorkalov asmorkalov removed this from the 4.8.0 milestone Jun 20, 2023
@asmorkalov asmorkalov mentioned this pull request Jun 23, 2023
6 tasks
@asmorkalov asmorkalov closed this Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants