为什么Pi Camera将分辨率四舍五入到最近的16倍

时间:2017-11-09 10:08:58

标签: camera raspberry-pi resolution

我有兴趣从Raspberry Pi Camera V1.3和V2.1中读取原始数据。我达到了一个程度,Picamera模块文档提供了一个非常有用的代码来提取数据。

但是,为什么传感器最初将分辨率最接近16的最接近的倍数。我引用文档,完整代码here

# For the V1 module, the data consists of 1952 rows of 3264 bytes of data.
# The last 8 rows of data are unused (they only exist because the maximum
# resolution of 1944 rows is rounded up to the nearest 16).
#
# For the V2 module, the data consists of 2480 rows of 4128 bytes of data.
# There's actually 2464 rows of data, but the sensor's raw size is 2466
# rows, rounded up to the nearest multiple of 16: 2480.
#
# Likewise, the last few bytes of each row are unused (why?). Here we
# reshape the data and strip off the unused bytes.

reshape, crop = {
    1: ((1952, 3264), (1944, 3240)),
    2: ((2480, 4128), (2464, 4100)),
    }[ver]
data = data.reshape(reshape)[:crop[0], :crop[1]]

非常感谢。

0 个答案:

没有答案