What happens to negative readings after dark-frame subtraction?

Eight-bit subtract takes a difference, applies scale and offset, and clips out-of-range values.

Pixel experiment and interpretation

A background estimate of 10 exceeds the first reading of 6. The residual clips to zero. Use a signed representation if negative residuals matter.

from PIL import Image, ImageChops

def row(values):
    return Image.frombytes('L', (len(values), 1), bytes(values))

list(ImageChops.subtract(row([6,18]),row([10,10])).tobytes())

Result [0, 8]

中文

从传感器图像扣除暗场时负值会怎样?

八位 subtract 先求差,再按 scale 和 offset 调整,超界结果被截断。

像素实验与适用边界

背景估计 10 高于第一格的读数 6,扣除后只剩零。若负残差有统计含义,应换有符号表示。

from PIL import Image, ImageChops

def row(values):
    return Image.frombytes('L', (len(values), 1), bytes(values))

list(ImageChops.subtract(row([6,18]),row([10,10])).tobytes())

结果 [0, 8]

References / 参考来源

Keep reading / 继续阅读