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

Taking stills #43

Open
BrianP6 opened this issue Feb 15, 2019 · 3 comments
Open

Taking stills #43

BrianP6 opened this issue Feb 15, 2019 · 3 comments

Comments

@BrianP6
Copy link

BrianP6 commented Feb 15, 2019

Hello Dave,
Your PiStreaming is working superbly :-) thank you.

I would like to be able to take a still image/photo, would that be possible?
Using Raspistill doesn't want to work, presumably because other services have snaffled the resource.
I don't mind if the video stream flickers/pauses while the configuration modes are changed in order to get a higher resolution than 640x480 - in fact for a still image it is preferable.

Many thanks,
Brian.

@BrianP6
Copy link
Author

BrianP6 commented Feb 23, 2019

Just to add to this one. I've been reading in more and by modifying main() in the while loop for camera.wait_recording(1).

while True:
                camera.wait_recording(1)
                if (os.path.isfile("/home/pi/camphoto")):
                    os.remove("/home/pi/camphoto")
                    my_file = open('/home/pi/camphoto.jpg', 'wb')

#                    camera.stop_recording()
#                    camera.resolution = (2592, 1944)
                    camera.capture(my_file, format="jpeg", use_video_port=True)
#                    camera.resolution = (WIDTH, HEIGHT)
                    my_file.close()

                    f = open("/home/pi/camphoto.done", "a")
                    f.close()
					
#                    camera.start_recording(output,'yuv')

The use of 'camphoto' files are notifications from one program to another, in this case if 'camphoto' is present, remove it then take a photo.

This works like a charm, but only works at 640x480 - as long as I don't change the resolution.

If I remove the comments to stop recording, increase the resolution, take the photo, put the resolution back and restart recording then it fails.
The photo does get taken and at the correct resolution, but pistreaming then fails.
From the output it appears to complain at BroadcastOutput.write stating that the file is closed.

I assume it's because there are other threads running while I've got the camera recording stopped that is causing the issue here, wondered if there's a way around it.

Many thanks,
Brian.

@galed3e3
Copy link

galed3e3 commented Mar 7, 2019

Following. ..interested in doing similar.

@rshom
Copy link

rshom commented Sep 21, 2021

Also interested. I am trying to implement a button to the webpage that would take a picture.

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