scriptorron / indi_pylibcamera

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

PHD2 debayer and CCD_CFA attribute #68

Open scriptorron opened 6 months ago

scriptorron commented 6 months ago

PHD2 preview shows Bayer pattern of HQ camera. Star profile has many peaks. This happens with binning 1 and 2. The issue disappears when enabling 2x2 averaging in the PHD2 settings. For now the 2x2 averaging is the only workaround.

It seems, PHD2 does not know that the image data are from a CFA with Bayer filters. A code analysis showed that PHD2 detects Bayer data when the camera has the CCD_CFA/CFA_TYPE attribute. Than the code seems to debayer the data only for binning 1 and independent of the CFA_TYPE value.

Any string in CFA_TYPE is enough to tell PHD2 that the camera provides Bayer data. This decision can not be reverted by deleting the CCD_CFA attribute! (Missing feature in PHD2?)

If PHD2

the frame gets a simple debayer (sliding 2x2 window) to calculate luminance. Image resolution stays unchanged. This is exactly the same algorithm as used for 2x2 averaging.

At least the missing debayering for binning 2 will be critical (is that a missing feature in PHD2?).

Open questions:

Implementing the CCD_CFA attribute in indi_pylibcamera can lead to unexpected behavior in PHD2! It is safer to force the luminance calculation by enabling the "2x2 averaging".

scriptorron commented 6 months ago

INDI CCD_CFA attribute according to https://www.indilib.org/developers/deveioper-manual/101-standard-properties.html and code analysis of indi_lib:

Values of CFA_TYPE seen in code: