User avatar
jbeale
Posts: 3492
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

webcam project

Wed May 22, 2013 2:42 pm

Just wanted to show how easy it was to make a wireless webcam with text overlay feature, just one evening's work modifying the case to have a slot for the camera's flex cable, and figuring out how to write the script using ImageMagick 'convert' and 'composite' ( sudo apt-get install imagemagick ). The perl command after 'date' is just to remove the newline at the end, which otherwise makes an extra blank line so the text does not fill the caption rectangle as well. Of course you can also add text from any command, like the one that reports internal CPU temperature.

Originally I used the '-t 0' option to raspistill so it would take a frame in about 1 second instead of 5 seconds, but that doesn't allow time for the exposure AGC to work. When the room light was on it was still OK, but with the light off, the image went completely black, even though the red LED display on the meter is always bright and is well visible in the images under any lighting taken without the '-t 0' option.

Code: Select all

cd /home/pi/pics
raspistill -vf -w 960 -h 448 -q 80 -o capture.jpg
date | perl -0777 -pe 's/\n$//' | convert -size 345x30 -gravity South \
  -background maroon -fill MistyRose4 label:@-  date.png
composite -gravity SouthWest date.png   capture.jpg   now.jpg
/usr/bin/curl -T now.jpg ftp://mywebsite.com --user myusername:mypassword
RPi-webcam-May22-2013.jpg
RPi-webcam-May22-2013.jpg (42.07 KiB) Viewed 2489 times
Example image from R-Pi wifi-cam (image is scaled down here)
Rpi-Cam-assy.JPG
Rpi-Cam-assy.JPG (56.5 KiB) Viewed 2489 times
Above: self-contained wifi webcam, just add power! Quick camera mount: camera vertical tilt angle is adjusted by slipping the flex cable forward or back under the 2nd rubber band :-)
Last edited by jbeale on Wed May 22, 2013 8:10 pm, edited 5 times in total.

User avatar
jezmck
Posts: 24
Joined: Sat Sep 10, 2011 4:34 pm
Contact: Website

Re: webcam project

Wed May 22, 2013 6:12 pm

Some useful info, thanks.
Esp the exposure issue and the overlay graphic. :)

User avatar
jbeale
Posts: 3492
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: webcam project

Thu May 23, 2013 2:15 pm

Another version, including time and CPU temperature, using pipeline to avoid writing two of three intermediate files:

Code: Select all

cd /home/pi/pics
raspistill -vf -w 960 -h 448 -q 80 -o capture.jpg
/opt/vc/bin/vcgencmd measure_temp | perl -0777 -pe 's/\n$//' | convert -size 200x30 -gravity South \
  -background grey27 -fill MistyRose4 label:@-  temp.png
date | perl -0777 -pe 's/\n$//' | convert -size 345x30 -gravity South \
  -background grey27 -fill MistyRose4 label:@-  miff:- | \
composite -gravity SouthWest   -   capture.jpg  miff:- | \
composite -gravity SouthEast  temp.png  -   now.jpg
/usr/bin/curl -T now.jpg ftp://mywebsite.com/pics/now.jpg --user myusername:mypassword
RPi-now.jpg
RPi-now.jpg (32.99 KiB) Viewed 2318 times

Return to “Camera board”