Skip to content

Commit ea9f80d

Browse files
authored
Merge branch 'main' into bell-one-main
2 parents 7c7c104 + 69ae4ab commit ea9f80d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nerfstudio/data/datamanagers/full_images_datamanager.py

+5
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ def _undistort_image(
395395
"We doesn't support the 4th Brown parameter for image undistortion, "
396396
"Only k1, k2, k3, p1, p2 can be non-zero."
397397
)
398+
# because OpenCV expects the order of distortion parameters to be (k1, k2, p1, p2, k3), we need to reorder them
399+
# see https://docs.opencv.org/4.x/dc/dbb/tutorial_py_calibration.html
398400
distortion_params = np.array(
399401
[
400402
distortion_params[0],
@@ -420,6 +422,9 @@ def _undistort_image(
420422
# crop the image and update the intrinsics accordingly
421423
x, y, w, h = roi
422424
image = image[y : y + h, x : x + w]
425+
# update the principal point based on our cropped region of interest (ROI)
426+
newK[0, 2] -= x
427+
newK[1, 2] -= y
423428
if "depth_image" in data:
424429
data["depth_image"] = data["depth_image"][y : y + h, x : x + w]
425430
if "mask" in data:

0 commit comments

Comments
 (0)