Why ?
- I have 2 dogs, and I wanted to monitor their activity during the day (especially when one of them was a puppy)
- I didn't want an expensive home monitoring solution (I have a couple of raspberry pi's lying around and wanted to just use an existing usb webcam)
Instructions
Install fswebcam on bare minimum install on a raspberry pi.
First check and make sure that your usb web cam is being detected
lsusbBus 001 Device 005: ID 17ef:6014 Lenovo Mini Wireless Keyboard N5901Bus 001 Device 004: ID 046d:0825 Logitech, Inc. Webcam C270Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet AdapterBus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Then, install the fswebcam package:
sudo apt-get install fswebcam
Basic usage
Enter the command
fswebcam followed by a filename and a picture will be taken using the webcam, and saved to the filename specified:fswebcam image.jpg
This command will show the following information:
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Adjusting resolution from 384x288 to 352x288.
--- Capturing frame...
Corrupt JPEG data: 2 extraneous bytes before marker 0xd4
Captured frame in 0.00 seconds.
--- Processing captured image...
Writing JPEG image to 'image.jpg'.
Note the small default resolution used, and the presence of a banner showing the timestamp.
SPECIFY RESOLUTION
The webcam used in this example has a resolution of
1280 x 720 so to specify the resolution I want the image to be taken at, use the -r flag:fswebcam -r 1280x720 image2.jpg
This command will show the following information:
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
--- Capturing frame...
Corrupt JPEG data: 1 extraneous bytes before marker 0xd5
Captured frame in 0.00 seconds.
--- Processing captured image...
Writing JPEG image to 'image2.jpg'.
Picture now taken at the full resolution of the webcam, with the banner present.
SPECIFY NO BANNER
Now add the
--no-banner flag:fswebcam -r 1280x720 --no-banner image3.jpg
which shows the following information:
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
--- Capturing frame...
Corrupt JPEG data: 2 extraneous bytes before marker 0xd6
Captured frame in 0.00 seconds.
--- Processing captured image...
Disabling banner.
Writing JPEG image to 'image3.jpg'.
I ended up selecting a smb share on my home file server and periodically storing the pictures to it
No comments:
Post a Comment