can’t reproduce:
import os
import picamera2 as pc2
import time
class PicameraTest:
def __init__(self):
self.picamera2 = pc2.Picamera2()
self.rawModes = [
{"size":(1332, 990),"format":"SRGGB10"},
{"size":(2028, 1080),"format":"SRGGB12"},
{"size":(2028, 1520),"format":"SRGGB12"},
{"size":(4056, 3040),"format":"SRGGB12"}
]
def setMode(self, para):
# stop the camera
self.picamera2.stop()
time.sleep(0.2)
config = self.picamera2.create_still_configuration(raw={})
config['raw'] = self.rawModes[int(para)]
config['main'] = {"size":self.rawModes[int(para)]['size'], 'format':'RGB888'}
self.picamera2.configure(config)
self.picamera2.start()
print('Video mode is now: %d' % int(para))
request = self.picamera2.capture_request()
request.save_dng(str(int(para)) + ".dng")
request.release()
def stop(self):
self.picamera2.stop()
def main():
# Print OS version
os_version = os.popen('cat /etc/os-release').read()
print(os_version)
cam_test = PicameraTest()
for i in range(len(cam_test.rawModes)):
cam_test.setMode(i)
time.sleep(0.1)
# Test modes in reverse order
for i in reversed(range(len(cam_test.rawModes))):
cam_test.setMode(i)
time.sleep(0.1)
cam_test.stop()
print("Test completed!")
if __name__ == "__main__":
main()
output:
python playground/raw.py
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
[13:14:48.686884019] [49017] INFO Camera camera_manager.cpp:284 libcamera v0.1.0+52-a858d20b
[13:14:48.735091973] [49025] WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[13:14:48.738268576] [49025] INFO RPI vc4.cpp:387 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media0 and ISP device /dev/media1
{'format': 'SRGGB10_CSI2P', 'size': (1332, 990)} 0.0
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1080)} 1396.121212121212
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1520)} 1340.2320574162677
{'format': 'SRGGB12_CSI2P', 'size': (4056, 3040)} 2227.2320574162677
[13:14:48.950545490] [49017] INFO Camera camera.cpp:1213 configuring streams: (0) 1332x990-RGB888 (1) 1332x990-SBGGR10
[13:14:48.951211295] [49025] INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 1332x990-SBGGR10_1X10 - Selected unicam format: 1332x990-BG10
Video mode is now: 0
{'format': 'SRGGB10_CSI2P', 'size': (1332, 990)} 4168.969696969697
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1080)} 0.0
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1520)} 1740.7017543859647
{'format': 'SRGGB12_CSI2P', 'size': (4056, 3040)} 2627.7017543859647
[13:14:50.038766698] [49029] INFO Camera camera.cpp:1213 configuring streams: (0) 2028x1080-RGB888 (1) 2028x1080-SBGGR12
[13:14:50.040098901] [49025] INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1080-SBGGR12_1X12 - Selected unicam format: 2028x1080-BG12
Video mode is now: 1
{'format': 'SRGGB10_CSI2P', 'size': (1332, 990)} 3456.2165071770337
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1080)} 1083.8377192982457
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1520)} 0.0
{'format': 'SRGGB12_CSI2P', 'size': (4056, 3040)} 887.0
[13:14:51.150796721] [49029] INFO Camera camera.cpp:1213 configuring streams: (0) 2028x1520-RGB888 (1) 2028x1520-SBGGR12
[13:14:51.155711782] [49025] INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected unicam format: 2028x1520-BG12
Video mode is now: 2
{'format': 'SRGGB10_CSI2P', 'size': (1332, 990)} 10552.216507177034
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1080)} 8179.837719298245
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1520)} 7096.0
{'format': 'SRGGB12_CSI2P', 'size': (4056, 3040)} 0.0
[13:14:52.287965560] [49029] INFO Camera camera.cpp:1213 configuring streams: (0) 4056x3040-RGB888 (1) 4056x3040-SBGGR12
[13:14:52.294560245] [49025] INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 4056x3040-SBGGR12_1X12 - Selected unicam format: 4056x3040-BG12
Video mode is now: 3
{'format': 'SRGGB10_CSI2P', 'size': (1332, 990)} 10552.216507177034
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1080)} 8179.837719298245
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1520)} 7096.0
{'format': 'SRGGB12_CSI2P', 'size': (4056, 3040)} 0.0
[13:14:53.982813619] [49029] INFO Camera camera.cpp:1213 configuring streams: (0) 4056x3040-RGB888 (1) 4056x3040-SBGGR12
[13:14:54.005717909] [49025] INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 4056x3040-SBGGR12_1X12 - Selected unicam format: 4056x3040-BG12
Video mode is now: 3
{'format': 'SRGGB10_CSI2P', 'size': (1332, 990)} 3456.2165071770337
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1080)} 1083.8377192982457
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1520)} 0.0
{'format': 'SRGGB12_CSI2P', 'size': (4056, 3040)} 887.0
[13:14:58.614531579] [49029] INFO Camera camera.cpp:1213 configuring streams: (0) 2028x1520-RGB888 (1) 2028x1520-SBGGR12
[13:14:58.637439998] [49025] INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected unicam format: 2028x1520-BG12
Video mode is now: 2
{'format': 'SRGGB10_CSI2P', 'size': (1332, 990)} 4168.969696969697
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1080)} 0.0
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1520)} 1740.7017543859647
{'format': 'SRGGB12_CSI2P', 'size': (4056, 3040)} 2627.7017543859647
[13:14:59.757508562] [49029] INFO Camera camera.cpp:1213 configuring streams: (0) 2028x1080-RGB888 (1) 2028x1080-SBGGR12
[13:14:59.763868769] [49025] INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1080-SBGGR12_1X12 - Selected unicam format: 2028x1080-BG12
Video mode is now: 1
{'format': 'SRGGB10_CSI2P', 'size': (1332, 990)} 0.0
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1080)} 1396.121212121212
{'format': 'SRGGB12_CSI2P', 'size': (2028, 1520)} 1340.2320574162677
{'format': 'SRGGB12_CSI2P', 'size': (4056, 3040)} 2227.2320574162677
[13:15:00.900468898] [49029] INFO Camera camera.cpp:1213 configuring streams: (0) 1332x990-RGB888 (1) 1332x990-SBGGR10
[13:15:00.905269776] [49025] INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 1332x990-SBGGR10_1X10 - Selected unicam format: 1332x990-BG10
Video mode is now: 0
Test completed!