-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Description
Hello,
I obtained color and depth aligned frame using the D455 camera. Do I need to further perform distortion processing on the color images? I tried using OpenCV for distortion processing and remapping, and obtained internal parameters for multiple scenes. However, the internal parameters obtained for each scene have a 0.1 scale difference. Is this normal? Can you give me some advice.
Thank you.
Here is part of my code:
align_to = rs.stream.color
align = rs.align(align_to)
align_frames = align.process(frames)
frames = align_frames
frame_num = frames.frame_number
depth_frame = frames.get_depth_frame()
color_frame = frames.get_color_frame()
process rgb
color_img = np.asanyarray(color_frame.get_data())
img_bgr = cv2.cvtColor(color_img, cv2.COLOR_RGB2BGR)
camera_matrix = np.array([
[color_intrin.fx, 0, color_intrin.ppx],
[0, color_intrin.fy, color_intrin.ppy],
[0, 0, 1]
])
dist_coeffs = np.array(color_intrin.coeffs)
undistorted_color = cv2.undistort(img_bgr, camera_matrix, dist_coeffs)
new_camera_matrix, roi = cv2.getOptimalNewCameraMatrix(
camera_matrix, dist_coeffs, (undistorted_color.shape[1], undistorted_color.shape[0]), alpha=0)
mapx, mapy = cv2.initUndistortRectifyMap(
camera_matrix, dist_coeffs, None, new_camera_matrix, (undistorted_color.shape[1],
undistorted_color.shape[0]), cv2.CV_32FC1)
color_img = cv2.remap(undistorted_color, mapx_g, mapy_g, cv2.INTER_LINEAR)
'''then I will save <color_img>'''