Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 28 Jul 2017, 00:46
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to take a snapshot from webcam?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
arivas_2005

Joined: 25 Feb 2007
Posts: 169

PostPosted: Mon 12 Oct 2015, 18:50    Post subject:  How to take a snapshot from webcam?  

Cheers
excuse my english

I need to capture images of the webcam (take photo)

VLC works well with webcam (Is ver. 2.0.3 in puppy linux)
I see images in your window (VLC)

I Use the command

Code:

#vlc -I dummy v4l:///dev/video0 --video-filter=scene  --scene-prefix=snap --scene-replace --scene-path=/ --scene-format jpeg --run-time=20

or also

Code:

#vlc -vvv --color v4l:///dev/video0 --video-filter=scene  --scene-prefix=snap --scene-replace --scene-path=/ --scene-format jpeg --run-time=20


but it happens that images snap.jpeg are files of 0 bytes.

The file that is created is empty. 0 bytes, without the image I need to capture

my thanks
Back to top
View user's profile Send private message 
mister_electronico


Joined: 20 Jan 2008
Posts: 955
Location: Asturias_ España

PostPosted: Sun 22 Nov 2015, 10:38    Post subject: Hi arivas_2005  

Hi arivas_2005 I was thinking about how to capture an image of the webcam.
The problem I see is that the camera does not start to work immediately, it takes time for the first capture is black.

I came up with this script.

Code:
#!/bin/sh
ffmpeg -f video4linux2 -s 640x480 -t 00:00:04 -i /dev/video0 -f avi /tmp/out.avi
sleep 2
ffmpeg -i /tmp/out.avi -r 1 -ss 00:00:03 -t 1 /tmp/out.jpg
gview /tmp/out.jpg
rm /tmp/out.avi


The problem is that the output image is not of good quality, the video input
/de/video0 not support almost any configuration.

This script can be improved quite sure, you have to take into account the following considerations:

1) open your camera in /dev/video0
2) The camera has enough time to open in 4 seconds
-t 00:00:04 I think it's enough.
3) erase the image /tmp/out.jpg to use the script again.

You can also use the mencoder command but I have not tried it yet

I try to think more about it and improve it.

Cheers
takeshot.tar.gz
Description 
gz

 Download 
Filename  takeshot.tar.gz 
Filesize  245 Bytes 
Downloaded  61 Time(s) 
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger 
mister_electronico


Joined: 20 Jan 2008
Posts: 955
Location: Asturias_ España

PostPosted: Sun 22 Nov 2015, 12:03    Post subject: I found another way  

I found another way

Code:
ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 -vframes 1 /tmp/out.jpeg


The image is stored in /tmp/out.jpeg

It depends on the quality of the webcam with a camera that I get images of 640x480 and 1280x720 with another

Cheers
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger 
arivas_2005

Joined: 25 Feb 2007
Posts: 169

PostPosted: Sun 18 Dec 2016, 01:36    Post subject:  

greetings
Excuse my english

I will use the same thread because it is vlc and webcam capture

After a while I need to use vlc and webcam again

My problem is to rotate the webcam image capture

I use the following code in a line:
Code:
 vlc -I dummy   v4l2:///dev/video0 --transform-type=vflip --video-filter scene --scene-path "$dir1" --scene-prefix ccc2- --scene-format png --scene-replace  vlc://quit --run-time=3


With that code snapshot the image well
but,
I need to turn 90 degrees

I already experimented with:
Quote:
--rotate-angle=90
--transform-type=90
--video-filter=transform{type=90}


And others... Without results. Image not captured (not snapshot)

thanks
Back to top
View user's profile Send private message 
souleau


Joined: 23 Oct 2016
Posts: 80

PostPosted: Mon 19 Dec 2016, 15:37    Post subject:  

If you have ImageMagick, then maybe you could use that

the code would be something like

Code:
convert -rotate "-90>" original_image_name.png new_image_name.png


Here's what it says about rotating in the ImageMagick documentation:

http://www.imagemagick.org/script/command-line-options.php#rotate
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0446s ][ Queries: 12 (0.0082s) ][ GZIP on ]