Save images with saturated pixels

If any pixels in the manually processed raw image end up
saturated (>255), this causes an error. I've now manually
clamped the values between 0 and 255 to fix this.

It would probably be a good idea to warn when this happens,
as it does mean we're losing data.
This commit is contained in:
Richard Bowman 2024-02-15 17:34:29 +00:00
parent 08e74ac020
commit 41f03958c6

View file

@ -562,6 +562,8 @@ class SmartScanThing(Thing):
def process_raw_image(img):
normed = img/white_norm
corrected = np.dot(colour_correction_matrix, normed.reshape((-1, 3)).T).T.reshape(normed.shape)
corrected[corrected < 0] = 0
corrected[corrected > 255] = 255
return gamma_8bit(corrected)
logger.info(
f"Generated normalisation image with shape {white_norm.shape}, "