scriptorron / indi_pylibcamera

INDI libcamera driver made in Python
MIT License
13 stars 4 forks source link

columns with 0 in HQ frame #8

Closed scriptorron closed 1 year ago

scriptorron commented 1 year ago

The HQ camera adds a number of 0-filled columns to the frame:

The black level of real data is higher than 0. Leaving the 0-filled columns in the data will lead to trouble with histogram based post-processing. These columns must be removed.

Instead of removing 6 columns (1.5 Bayer pattern) it is likely better to remove 8 (2 Bayer pattern) to avoid trouble with de-bayer algorithms.

It still needs to be investigated if:

The V1 camera does not have 0-filled columns in its raw modes.

Up to now it was not needed to implement camera specific processing in the driver. All processing was generic and based on parameter delivered by libcamera. For instance the Bayer pattern rotation could be determined by the Rotation number provided by libcamera. That made the driver universal to all camera models. To fix the 0-filled columns the driver must now implement a special processing for IMX477 cameras. Other image sensors may also have 0- or garbage-filled columns, but the workaround for IMX477 will not work for them automatically.

scriptorron commented 1 year ago

RGB frames from HQ camera do not have 0-filled columns.

Raw frames and their 0-filled columns:

{'bit_depth': 10, 'crop_limits': (696, 528, 2664, 1980), 'exposure_limits': (31, 667234896, None), 'format': SRGGB10_CSI2P, 'fps': 120.05, 'size': (1332, 990), 'unpacked': 'SRGGB10'}, data shape: 1344, 990 0-filled columns: 12 true frame size: 1332 x 990

{'bit_depth': 12, 'crop_limits': (0, 440, 4056, 2160), 'exposure_limits': (60, 674181621, None), 'format': SRGGB12_CSI2P, 'fps': 50.03, 'size': (2028, 1080), 'unpacked': 'SRGGB12'}, data shape: 2032, 1080 0-filled columns: 6 (removing 8 columns!) true frame size: 2024 x 1080

{'bit_depth': 12, 'crop_limits': (0, 0, 4056, 3040), 'exposure_limits': (60, 674181621, None), 'format': SRGGB12_CSI2P, 'fps': 40.01, 'size': (2028, 1520), 'unpacked': 'SRGGB12'}, data shape: 2032, 1520 0-filled columns: 6 (removing 8 columns!) true frame size: 2024 x 1520

{'bit_depth': 12, 'crop_limits': (0, 0, 4056, 3040), 'exposure_limits': (114, 694422939, None), 'format': SRGGB12_CSI2P, 'fps': 10.0, 'size': (4056, 3040), 'unpacked': 'SRGGB12'} data shape: 4064, 3040 0-filled columns: 8 true frame size: 4056 x 3040