Raw image is already JPEG compressed
I am using the Orbbec Femto Mega to take one picture at a time (color, and depth). this is how I configured the stream:
depth_profile_list = pipeline.get_stream_profile_list(OBSensorType.DEPTH_SENSOR)
depth_profile = profile_list.get_video_stream_profile(1024, 1024, OBFormat.Y16, 5)
color_profile_list = pipeline.get_stream_profile_list(OBSensorType.COLOR_SENSOR)
depth_profile = profile_list.get_video_stream_profile(1920, 1080, OBFormat.RGB, 5)
and this is the function I use to save the pictures:
def save_color_frame(self,color_frame, index, timestamp,dir_path):
color_data = frame_to_bgr_image(color_frame)
color_filename = os.path.join(dir_path, f"color_{index}_{timestamp}.png")
cv2.imwrite(color_filename, color_data,[cv2.IMWRITE_PNG_COMPRESSION, 0])
def save_depth_frame(self,depth_frame, index, timestamp,dir_path):
depth_data = np.frombuffer(depth_frame.get_data(), dtype=np.uint16).reshape((depth_frame.get_height(), depth_frame.get_width()))
depth_data = (depth_data * depth_frame.get_depth_scale()).astype(np.uint16)
depth_filename = os.path.join(dir_path, f"depth_{index}_{timestamp}.png")
cv2.imwrite(depth_filename, depth_data,[cv2.IMWRITE_PNG_COMPRESSION, 0])
The depth image quality is excellent. But when I zoom in the color image with matplotlib for example, I can notice a blocks of 8 by 8 appearing which is a sign of JPEG compression. So I wanted to know how can I do to get raw color images.
The RGB format in OBFormat.RGB is internally obtained by capturing a JPEG image and then decoding it into an RGB image. If you want to get the raw image, you can set it to output in YUV format (OBFormat.YUYV).
@zhonghong322 When will YUYV format be supported in net device? I find it only when I connect the femto mega via USB.