import cv2
# Load the raw data using OpenCV
raw_data = np.fromfile(file_path, dtype=np.uint16).reshape((height, width))
# Convert the raw data to an 8-bit image for OpenCV processing
raw_data_8bit = (raw_data >> 8).astype(np.uint8)
# Debayer the image using OpenCV
rgb_image_cv = cv2.cvtColor(raw_data_8bit, cv2.COLOR_BAYER_RG2RGB)
# Display the image using OpenCV
plt.figure(figsize=(10, 6))
plt.imshow(cv2.cvtColor(rgb_image_cv, cv2.COLOR_BGR2RGB))
plt.axis('off')
plt.show()
it looks like alignment issue, please also note that we should have follow VI’s 64 byte aligned to set the correct stride.
here’s an example, your active width 1928/64=30.125 which should be configure to 31*64=1984 to follow width alignment.
besides,
you may download MMAPI with… $ sudo apt install nvidia-l4t-jetson-multimedia-api
here’s also another example to demosaic Raw with CUDA. /usr/src/jetson_multimedia_api/argus/samples/cudaBayerDemosaic
The sensor maximum resolution is 1928x1208, so you would advise to reduce the active window to 1920x1208 or 1920x1080 ?
I would need to configure the sensor’s active window and update the device tree.