Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOW-TO] How to capture images with the picamera2 app continuously without exiting the app and save the images with continuous names/numbers (for example image_1, image_2, image_3, etc.) so that i can capture multiple images without needing to write the file name each time? #1029

Open
biprav opened this issue May 1, 2024 · 7 comments

Comments

@biprav
Copy link

biprav commented May 1, 2024

Also, if possible can you tell me how to add the ISO control option in the picamera2 app?

Thank you.

@davidplowman
Copy link
Collaborator

davidplowman commented May 2, 2024

Hi, please do have a look at some of the introductory sections of the manual. Also, Picamera2 does not have a concept of ISO, instead you need to set the "AnalogueGain" of the sensor. There's information on this in section 5 of the manaul.

There are also many examples here.

Please do get back to us if you are encountering specific difficulties with your code. It's often helpful to post small code examples so that we can see how to help you - remember to include them within "triple backquotes" so that they are formatted correctly. Thanks!

@biprav
Copy link
Author

biprav commented May 2, 2024

Actually I'm very new to programming and I don't have as such knowledge regarding it. Can you just tell me which lines of code to include in the code of the app_full.py application for changing the filename of images taken continuously as stated above.
A help in this regard would be highly appreciated.
Thank you.

@davidplowman
Copy link
Collaborator

The image file names look like they are created here. I would say that that's a fairly complicated app just for capturing a sequence of images - but obviously you need to do what fits with your requirements. Good luck!

@sandyol55
Copy link

sandyol55 commented May 2, 2024

Apologies for jumping in.
Might be worth looking at the timelapse example, where the range counter i is embedded in the file name to give an incrementing list of file names?
https://github.com/raspberrypi/picamera2/blob/main/examples/capture_timelapse.py#L19

@davidplowman
Copy link
Collaborator

Apologies for jumping in. Might be worth looking at the timelapse example, where the range counter i is embedded in the file name to give an incrementing list of file names? https://github.com/raspberrypi/picamera2/blob/main/examples/capture_timelapse.py#L19

On the contrary, good suggestion. Thanks!

@biprav
Copy link
Author

biprav commented May 3, 2024

Apologies for jumping in. Might be worth looking at the timelapse example, where the range counter i is embedded in the file name to give an incrementing list of file names? https://github.com/raspberrypi/picamera2/blob/main/examples/capture_timelapse.py#L19

On the contrary, good suggestion. Thanks!

Apologies for jumping in. Might be worth looking at the timelapse example, where the range counter i is embedded in the file name to give an incrementing list of file names? https://github.com/raspberrypi/picamera2/blob/main/examples/capture_timelapse.py#L19

Thank you so much for the response. Just another query. In which lines of the app_full.py code should I put the range counter i code? I am a beginner, so asking such common questions. Apologies for that.
Thanks.

@davidplowman
Copy link
Collaborator

app_full.py is an event-driven GUI app, so there's not really an obvious place where you would put a loop with a range counter. You could store a counter variable somewhere, and increment it when the user clicks the capture button, but I'm really not clear if this is what you want. Also, if you're new to programming, there's a lot of not-so-easy code there, so I'd consider starting from something much simpler. Maybe:

import time
from picamera2 import Picamera2

picam2 = Picamera2()
capture_config = picam2.create_still_configuration()
picam2.start()

for i in range(5):
    time.sleep(1)
    picam2.switch_mode_and_capture_file(capture_config, f"test_{i}.jpg")

Or maybe you can give a more precise description of exactly what you wish to accomplish? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants