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:
parent
08e74ac020
commit
41f03958c6
1 changed files with 2 additions and 0 deletions
|
|
@ -562,6 +562,8 @@ class SmartScanThing(Thing):
|
||||||
def process_raw_image(img):
|
def process_raw_image(img):
|
||||||
normed = img/white_norm
|
normed = img/white_norm
|
||||||
corrected = np.dot(colour_correction_matrix, normed.reshape((-1, 3)).T).T.reshape(normed.shape)
|
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)
|
return gamma_8bit(corrected)
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Generated normalisation image with shape {white_norm.shape}, "
|
f"Generated normalisation image with shape {white_norm.shape}, "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue