maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Terminal Command to take picture? (https://talk.maemo.org/showthread.php?t=38149)

bocaJ 2009-12-23 07:28

Terminal Command to take picture?
 
For the first time in 22 years, I'm spending the holidays away from my family. My Mom put together an amazing gift package for me with with cards, candy, gifts, and a build-it-yourself Christmas Tree! I took some pictures of the whole set-up, but I want to get one with me in the picture too. I didn't see a shutter delay in the camera functions, so I was hoping someone could give me a terminal command to take a picture, and I could set it off via SSH.

Thanks in advance - this is a wonderful community.

That One Guy 2009-12-23 08:11

Re: Terminal Command to take picture?
 
Make a little video of you in front of the tree and then just capture one of more frames off the video on your computer?

eiffel 2009-12-23 18:51

Re: Terminal Command to take picture?
 
Just hold the phone at arm's length, with the lens pointing towards you, and take the photo. For further inspiration see What is self-photography?

Regards,
Roger

mysticrokks 2009-12-23 18:59

Re: Terminal Command to take picture?
 
ok what about asking a mate or just a random human to take the pic for you

dvergin 2009-12-23 19:09

Re: Terminal Command to take picture?
 
I'm also interested in the question in the title (for other purposes). How would we go about controlling the camera from the command line or (better) from a python script?

Certainly there must be docs somewhere for this but all my Googling can find is tons of pages on using the default camera app, not scripting for the camera hardware or any reference to a camera API..

schettj 2009-12-23 19:21

Re: Terminal Command to take picture?
 
Quote:

Originally Posted by eiffel (Post 439401)
Just hold the phone at arm's length, with the lens pointing towards you, and take the photo.

AKA "The Facebook Effect"

Everyone has one arm trailing out of frame now ;)

There is a gstreamer command string you can put together to take a snapshot, but you probably need to enable the dev repository to install gstreamer? I don't recall what I've installed on mine and what is stock.

ah... so as root

apt-get install gstreamer-tools

and then...

gst-launch v4l2camsrc device=/dev/video0 num-buffers=1 ! dspjpegenc ! filesink location=test.jpg

Grabs a 640x480 shot from the back camera. Or /dev/video1 for the front cam

(if it complains about dspjpegenc, try omx_jpegenc)

qole 2009-12-23 19:31

Re: Terminal Command to take picture?
 
Just a follow-up. To get the focus and white balance right, take a picture of the scene with the camera app first, then run your gstreamer script.

You also won't be able to use the flash, so make sure there's lots of light.

Instead of using ssh, I would suggest just adding a "sleep 10 s" to wait 10 seconds before taking the picture...

dvergin 2009-12-23 19:35

Re: Terminal Command to take picture?
 
Quote:

Originally Posted by schettj (Post 439436)
...you probably need to enable the dev repository to install gstreamer?...

Actually, it's now in Extras. :-) So apt-get should find it without the need to enable Devel or Testing.

Thanks for the command line help.

schettj 2009-12-23 19:45

Re: Terminal Command to take picture?
 
Ah... this works a LOT better, too:

gst-launch v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=test.png

That'll get you the full-sized image in png format. Note that there is a delay after issuing the command of several seconds, which I can't seem to track down.

Indeed autofocus and flash are a bit tricky... you should be able to use the camerabin device, but its expecting to behave like the camera itself, so it doesn't play too well with gst-launch :(

qole 2009-12-23 20:34

Re: Terminal Command to take picture?
 
So: first rig up some kind of a tripod system. Then take a picture of the scene with the camera app, with the flash disabled. Finally, run a little script that waits 5 or 10 seconds then takes a picture, something like

Code:

sleep 5
gst-launch v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=$1.png

Ideally, you should add a gstreamer command line at the end to play the shutter sound, so you know the photo has been taken...


All times are GMT. The time now is 03:50.

vBulletin® Version 3.8.8