Thanks for the info :-)
Hopefully last question 😃 We use the Pro Wide camera so in order to align the RGB and Depth, we had to use at first the manual undistortion via OpenCV: https://docs.luxonis.com/software/perception/rgb-d. We came across problematic behaviour. There is some discrepancy between measured depth values between this setting and setting when Alpha scaling is not set.
If I understand it correctly, we ought to use the Alpha scaling, since we want 100% align with undistorted RGB and its Depth. However, if we just undistort and not scale via Alpha, the measured distances jump around our needed 4-5cm and not 7-10cm like with the set scaling. Is the scaling set by some default value?
Below is the code we used, plus without scaling, we just commented out the setAlphaScaling().
alpha = 0
stereo.setAlphaScaling(alpha)
rgb_w = camRgb.getResolutionWidth()
rgb_h = camRgb.getResolutionHeight()
rgbIntrinsics = np.array(calibData.getCameraIntrinsics(rgbCamSocket, rgb_w, rgb_h))
rgb_d = np.array(calibData.getDistortionCoefficients(rgbCamSocket))
rgb_new_cam_matrix, _ = cv2.getOptimalNewCameraMatrix(rgbIntrinsics, rgb_d, (rgb_w, rgb_h), alpha)
map_x, map_y = cv2.initUndistortRectifyMap(rgbIntrinsics, rgb_d, None, rgb_new_cam_matrix, (rgb_w, rgb_h), cv2.CV_32FC1)
frameRgb = cv2.remap(frameRgb, map_x, map_y, cv2.INTER_LINEAR)