LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-05-2009, 05:25 AM   #1
Mogli
Member
 
Registered: Jun 2008
Posts: 41

Rep: Reputation: 15
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...
 
Old 04-05-2009, 06:04 AM   #2
mesiol
Member
 
Registered: Nov 2008
Location: Lower Saxony, Germany
Distribution: CentOS, RHEL, Solaris 10, AIX, HP-UX
Posts: 731

Rep: Reputation: 137Reputation: 137
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
 
Old 04-05-2009, 06:10 AM   #3
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Also see:
http://www.linuxquestions.org/questi...webcam-705453/
 
Old 04-05-2009, 09:34 AM   #4
Mogli
Member
 
Registered: Jun 2008
Posts: 41

Original Poster
Rep: Reputation: 15
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....
 
Old 04-05-2009, 09:56 AM   #5
Mogli
Member
 
Registered: Jun 2008
Posts: 41

Original Poster
Rep: Reputation: 15
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
 
Old 04-05-2009, 09:59 AM   #6
Mogli
Member
 
Registered: Jun 2008
Posts: 41

Original Poster
Rep: Reputation: 15
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
 
Old 04-05-2009, 10:14 AM   #7
Mogli
Member
 
Registered: Jun 2008
Posts: 41

Original Poster
Rep: Reputation: 15
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...
 
Old 04-05-2009, 11:09 AM   #8
Mogli
Member
 
Registered: Jun 2008
Posts: 41

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

I hope it can help....
 
Old 04-05-2009, 11:12 AM   #9
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
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.
 
Old 04-05-2009, 12:54 PM   #10
Mogli
Member
 
Registered: Jun 2008
Posts: 41

Original Poster
Rep: Reputation: 15
ok... But how to change settings... can anybody suggest me or is there any link.
 
Old 04-05-2009, 01:41 PM   #11
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
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.
 
Old 04-06-2009, 09:17 AM   #12
Mogli
Member
 
Registered: Jun 2008
Posts: 41

Original Poster
Rep: Reputation: 15
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....
 
Old 04-06-2009, 09:35 AM   #13
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Try running 'xdtv' and post what the error is.
 
Old 04-06-2009, 09:46 AM   #14
Chris.len
LQ Newbie
 
Registered: Apr 2009
Posts: 10

Rep: Reputation: 0
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!
 
Old 04-06-2009, 10:17 AM   #15
Mogli
Member
 
Registered: Jun 2008
Posts: 41

Original Poster
Rep: Reputation: 15
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....

Last edited by Mogli; 04-06-2009 at 11:15 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script- capture cdparanoia text output code-breaker Linux - Software 7 08-03-2006 10:13 PM
bash script Want to capture return key and assign a value procfs Programming 9 07-07-2006 01:38 AM
Getting pictures from webcam Four Programming 5 08-28-2005 06:19 PM
webcam creative don't capture pitufobcn Slackware 0 12-19-2004 11:26 AM
Taking pictures with webcam shinkm Linux - Newbie 1 01-13-2004 10:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration