Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions deeplabcut/pose_estimation_3d/camera_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
matplotlib_axes_logger.setLevel("ERROR")


def calibrate_cameras(config, cbrow=8, cbcol=6, calibrate=False, alpha=0.4):
def calibrate_cameras(config, cbrow=8, cbcol=6, calibrate=False, alpha=0.4, search_window_size=(11, 11)):
"""This function extracts the corners points from the calibration images, calibrates the camera and stores the calibration files in the project folder (defined in the config file).

Make sure you have around 20-60 pairs of calibration images. The function should be used iteratively to select the right set of calibration images.
Expand Down Expand Up @@ -57,6 +57,9 @@ def calibrate_cameras(config, cbrow=8, cbcol=6, calibrate=False, alpha=0.4):
i.e. the rectified images are zoomed in. When alpha = 1, all the pixels from the original images are retained.
For more details: https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html

search_window_size: tuple of int
Half of the side length of the search window when refining detected checkerboard corners for subpixel accuracy.

Example
--------
Linux/MacOs/Windows
Expand Down Expand Up @@ -139,7 +142,7 @@ def calibrate_cameras(config, cbrow=8, cbcol=6, calibrate=False, alpha=0.4):
img_shape[cam] = gray.shape[::-1]
objpoints[cam].append(objp)
corners = cv2.cornerSubPix(
gray, corners, (11, 11), (-1, -1), criteria
gray, corners, search_window_size, (-1, -1), criteria
)
imgpoints[cam].append(corners)
# Draw the corners and store the images
Expand Down