LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Bash script to capture pictures using webcam (https://www.linuxquestions.org/questions/linux-software-2/bash-script-to-capture-pictures-using-webcam-716955/)

Mogli 04-05-2009 05:25 AM

Bash script to capture pictures using webcam
 
Hi friends,
I have a laptop with integrated web cam. I am using "cheese" to capture photos and taking video.

Now I want to write a script with following features:
>>> It should start at the time of login
>>> Automatically it will capture one photo (to identify who is there in front of system), saves that photo in a specified folder and it will be closed automatically....


If there is a tool like this then I will be happy. Otherwise let me know how to write a script....

Thanks in advance...

mesiol 04-05-2009 06:04 AM

Hi,

take a look for streamer, which is part from xawtv package. This can capture pictures from your webcam
Code:

streamer -c /dev/video0 -b 16 -o outfile.jpeg
creates a jpeg picture from device video0.

You can use this tool to script your required action.

Also a good source is Webcam-Howto

H_TeXMeX_H 04-05-2009 06:10 AM

Also see:
http://www.linuxquestions.org/questi...webcam-705453/

Mogli 04-05-2009 09:34 AM

Hi mesiol and H_TeXMeX_H,
Very thanks for your quick response.... I am using FC9. streamer is not there in my system... But stream is there. Are both same??? I tried to install using yum as follows
Quote:

yum install streamer
But no package named with this name....

Mogli 04-05-2009 09:56 AM

I used this command
Quote:

$ streamer -c /dev/video0 -b 16 -o out.jpeg
out put is
Quote:

WARNING: no plugins found [/usr/local/lib/xawtv]
files / video: JPEG (JFIF) / audio: none
no grabber device available
What is the problem

Mogli 04-05-2009 09:59 AM

For
Quote:

$ xawtv -hwscan
out put is:
Quote:

This is xawtv-3.95, running on Linux/i686 (2.6.27.19-78.2.30.fc9.i686)
looking for available devices
port 280-311
type : Xvideo, image scaler
name : NV17 Video Texture

/dev/video0: OK [ -device /dev/video0 ]
type : v4l2
name : Laptop Integrated Webcam
flags: capture
I think xawtv is working fine

Mogli 04-05-2009 10:14 AM

Now I copied /usr/lib/xawtv/ into /usr/local/lib/

Then also it showing following error
Quote:

files / video: JPEG (JFIF) / audio: none
no way to get: 320x240 JPEG (JFIF)
movie writer initialisation failed
What to do...

Mogli 04-05-2009 11:09 AM

My Laptop configuration:
Dell inspiron 1420
with nvidia graphics card Ge Force 8-series and Integrated web cam.

I hope it can help....

H_TeXMeX_H 04-05-2009 11:12 AM

I think you need to mess with the settings, it looks like it can't get 320x240 resolution. Also, avoid copying stuff around in the system directories, I doubt it will help, but you could really mess up your system.

Mogli 04-05-2009 12:54 PM

ok... But how to change settings... can anybody suggest me or is there any link.

H_TeXMeX_H 04-05-2009 01:41 PM

On the main site it lists all the options and what they do:
http://xawdecode.sourceforge.net/htm.../indexUS.shtml
See the record options, I think that's what need adjusting.

Mogli 04-06-2009 09:17 AM

I have tried in google search but I am not able to find proper solution....
GUI is not opening for "xawtv"... So, how can change settings through command line????
Please help me....

H_TeXMeX_H 04-06-2009 09:35 AM

Try running 'xdtv' and post what the error is.

Chris.len 04-06-2009 09:46 AM

Are you kidding? How a webcam can identify a person??
Perhaps it has a function that can capture pictures by the webcam and save them to a specified folder?

I have no idea how a webcam can identify a person!! any idea.. tell me pls!

Mogli 04-06-2009 10:17 AM

first thing I want save photo at every login.... Can make a software to identify a person using matlab or something else....

If it is possible tell me how to solve above error....


All times are GMT -5. The time now is 06:13 PM.