I think it might help actually to capture raw camera images, with the same exposure and gain, and compare them. That would pin the differences down to the way they're being processed, or to something else. Getting a DNG file from the modern camera stack is of course easy (use the -r option). From the legacy camera stack, it's not so straightforward. You can use -r to tack the raw data onto the end of the JPEG, and then the following quick hack will extract it as a numpy array.But do note that the above is rather nasty. It assumes 12-bit raw, it assumes there are no "bonus" occurrences of "BRCM" in the actual JPEG data. And so on.
Code:
import numpy as npdef read16(b, idx): return b[idx] + 256 * b[idx + 1]with open("imx477.jpg", "rb") as fp: buf = fp.read()offset = buf.find(bytearray("BRCM", 'utf-8'))w, h, pad = read16(buf, offset+208), read16(buf, offset+210), read16(buf, offset+212)stride = (((w + pad + 1) >> 1) * 3 + 31) & ~31array = np.frombuffer(buf[offset + 32768:offset + 32768 + stride*h], dtype=np.uint8)array = array.reshape((h, stride))[:, :w * 3 // 2].reshape((h, w // 2, 3)).astype(np.uint16)raw = np.empty((h, w), dtype=np.uint16)raw[:, 0::2] = (array[:, :, 0] << 4) + (array[:, :, 2] & 15)raw[:, 1::2] = (array[:, :, 1] << 4) + (array[:, :, 2] >> 4)
Statistics: Posted by therealdavidp — Mon Jul 22, 2024 9:44 am