[HOW-TO] speed up still image capture_array?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 28/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python, raspberry-pi
- Domain
- embedded-iot, performance
Research direction
Start with the capture_array.py example and the Picamera2 capture_array entry point, then reproduce the reported 0.12-second timings using the shown still configuration on the Raspberry Pi Camera Module 3. Compare the measured behavior with the requested 480x270 output and determine whether a supported configuration change can improve it; document the result and evidence when done.
Written by the indexing model from the issue text.
Description
Hi there, I'm using a Raspberry Pi Camera Module 3 with a Raspberry pi 4b. I'm trying to capture still images with the full field of view of the camera, but then scale them down to a smaller size. I'm trying to do this as fast as possible.
Here's my code:
import picamera2
import time
picam2 = picamera2.Picamera2()
config = picam2.create_still_configuration(
main={"size": (480, 270)}, # scale down the 4608x2592 image, but maintain the full field of view
raw={'size': picam2.sensor_resolution}, # 4608x2592
buffer_count=2
)
picam2.configure(config)
picam2.start()
while True:
loop_start = time.time()
output_orig = picam2.capture_array()
img_capture_elapsed_s = round(time.time() - loop_start, 3)
print(f"Image capture took {img_capture_elapsed_s} s. {output_orig.shape}")
I'm seeing capture_array performance timings of about 0.12 seconds. Is there any way to speed this up, or is this as fast as it goes? Here are the logs that this program generates:
% python3 capture_array.py
[1:10:13.600190093] [2801] INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f
[1:10:13.717678717] [2804] INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media4 and ISP device /dev/media1
[1:10:13.717763491] [2804] INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[1:10:13.725368945] [2801] INFO Camera camera.cpp:1033 configuring streams: (0) 480x270-BGR888 (1) 4608x2592-SBGGR10_CSI2P
[1:10:13.726000376] [2804] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 4608x2592-SBGGR10_1X10 - Selected unicam format: 4608x2592-pBAA
Image capture took 0.693 s. (270, 480, 3)
Image capture took 0.12 s. (270, 480, 3)
Image capture took 0.12 s. (270, 480, 3)
Image capture took 0.119 s. (270, 480, 3)
Image capture took 0.12 s. (270, 480, 3)
Image capture took 0.122 s. (270, 480, 3)
Image capture took 0.118 s. (270, 480, 3)
...
Thanks!
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 258
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/picamera2
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
raspberrypi/picamera2#1405 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
raspberrypi/picamera2#1404 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 57/100
raspberrypi/picamera2#1403 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
raspberrypi/picamera2#1392 · 13 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
raspberrypi/picamera2#1389 · 4 comments ·
All issues in raspberrypi/picamera2
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100