Showing posts with label webcam. Show all posts
Showing posts with label webcam. Show all posts

Monday, December 17, 2012

Webcam Auto-Exposure Problems Under Linux - Solved

Too much light on bright days
I have struggled to find a webcam program which could grab decent still images from a webcam running under Linux. I have tried the common suggestions found online, used gvucview, cheese, webcam and webcamd.

All of these programs worked for snapping still images but the auto-exposure never worked properly and the images were poor. Most of the day the picture was either dark or obliterated with glare.

It seems the problem is that most webcam software is designed for streaming video. They all do a decent job of this, but even those programs that build in a delay never worked consistently for single jpg images. Searching the web, it is obvious I am not the only one with this problem and I could find no real solution.

Too dark in low light
After fighting this problem for days, it occurred to
me that perhaps I was using the wrong tool for the
job. I needed to look for a program which was designed specifically to snap still images from a webcam, not capture streaming video.

After some searching, I found a program called uvccapture which does just that. It is a simple, light program  that accepts arguments for resolution, timing, save location, even brightness, saturation, contrast and other basic settings. It is available in the Ubuntu repositories or you can grab it from here: https://github.com/csete/uvccapture

Happily, the auto-exposure is now working and my webcam is finally producing clear and properly exposed images. Here's how I managed it:

Auto-Exposure working properly
After installing uvccapture, I created a folder called 'webcam' in my home directory to store image.jpg and scripts. I set up the program to load on the boot using the Startup Applications tool by entering this into the command field:
uvccapture -m -t600 -q75 -x640 -y480 -o/home/user/webcam/image.jpg
This string of commands loads the program and instructs it to refresh the image every 10 minutes (600 seconds), to use compression on the JPG file at 75% quality. It states the webcam resolution, which must be supported by your device. The last argument includes the location to save the image file.

More info and commands for uvccapture are located here: http://manpages.ubuntu.com/manpages/natty/man1/uvccapture.1.html

The next problem was finding a new program to send the files via ftp to a remote server. Most of the programs I had used included the ftp service with the image grabber. I wanted something light and stable which could run in the background.

I looked at several programs and scripts and finally decided on this simple script which runs every 10 minutes via cron. Copy and paste the following into a text editor. Edit lines 4, 5 & 6 in the top section and line 5 in the bottom section:
# vi ftp-run.sh
#! /bin/sh
#run this file with ./ftp-run.sh
REMOTE='your-remote-server.com'
USER='username'
PASSWORD='password'
FTPLOG='/tmp/ftplog'
date >> $FTPLOG

ftp -n $REMOTE <<_FTP>>$FTPLOG
quote USER $USER
quote PASS $PASSWORD
bin
/home/user/webcam
mput image.jpg
quit
_FTP
Save the file as ftp-run.sh in the webcam folder. Right click on the icon and under Permissions, click to 'Run this file as a program'. I set up a cron job to run this script every 10 minutes with this command:
crontab -e
    arrow down to bottom

Paste:
*/10 * * * * cd webcam && ./ftp-run.sh

Ctrl + x to exit
Y to save
Enter
I rebooted to load the program and settings. I finally have a working webcam and my images are clear, bright and upload reliably to my server. I hope this how-to will help someone else who is struggling with this problem.

Shameless Plug:
More fun with your webcam: PortalView Live Desktop Wallpaper for Linux

Saturday, September 29, 2012

Rented Computers Caught Spying on Customers

The Federal Trade Commission has reached a settlement with DesignerWare Corporation and numerous computer rental companies for installing software on rented computers which secretly snapped explicit webcam pictures, captured emails and a variety of other personal information, including Social Security Numbers, medical and bank account information from thousands of users.

The companies installed a surveillance program called 'PC Rental Agent' which according to the FTC, "can also cause a computer’s webcam to surreptitiously photograph not only the computer user, but also anyone else within view of the camera. In numerous instances, ... webcam activations have taken pictures of children, individuals not fully clothed, and couples engaged in sexual activities."

The software, which is undetectable and uninstallable by the user, has been installed on nearly half a million computers and has been distributed by 1,617 computer rental companies in the US, Canada and Australia.

According to the complaint, "PC Rental Agent, when installed on a rented computer, offers rent-to-own store licensees the ability to direct DesignerWare’s servers to disable a computer remotely when a consumer is late making payments, has stopped communicating with the rent-to-own store, or has otherwise violated the rental contract."

The software also contains an option for the rental company to turn on "Detective Mode" which, again quoting from the complaint, "Once installed and activated, Detective Mode can log the keystrokes of the computer user, take screen shots of the computer user’s activities on the computer, and photograph anyone within view of the computer’s webcam." DesignerWare collects this information and transmits it, unencrypted, to the computer rental company.

PC Rental Agent also secretly tracked users by logging public wifi networks the computer used to access the internet, which "employees of the rent-to-own stores ...can monitor their physical locations and the patterns of their movements."

The FTC settlement requires rent-to-own companies to stop using monitoring software or tracking users' locations without knowledge or consent. The companies cannot used illicitly gained information to collect customer debts and the FTC will monitor them for 20 years.

The following companies are named in the complaint:
DesignerWare, LLC; its principals, Timothy Kelly and Ronald P. Koller, individually and as officers of DesignerWare, LLC.; Aspen Way Enterprises, Inc.; Watershed Development Corp.; Showplace, Inc., d/b/a Showplace Rent-to-Own; J.A.G. Rents, LLC, d/b/a ColorTyme; Red Zone, Inc., d/b/a ColorTyme; B. Stamper Enterprises, Inc., d/b/a Premier Rental Purchase; and C.A.L.M. Ventures, Inc., d/b/a Premier Rental Purchase.

First published on Technorati as "Rented Computers Caught Spying on Customers"

Sunday, August 14, 2011

Setting Up a Free Weather Webcam


"Everyone talks about the weather, but no one does anything about it." - Mark Twain

Weather webcam image
The weather effects our lives everyday and weather websites are among the most heavily trafficked on the web. They tell us whether we will need an umbrella today or what to pack for a trip across the country.

Weather webcams are always popular and it is easy and free to set one up yourself. Whether you run Windows, Mac or Linux there are tools and hosting available which only requires you own a webcam to be up and running on the web.

Basically you need three things: a webcam, software which can upload via ftp and a website which will host and publish your images.

Webcams are ridiculously cheap these days and if you don't have an old one in a drawer somewhere, they are available online or at your local department store for 10.00 and up. Generally, you want the best resolution you can afford with back light and white control, if possible.

Webcam software is usually included with your webcam or is widely available online. You will need a program which can upload your images to the web via ftp or sftp.

Free software for Windows is available here:
http://www.lundie.ca/fwink/

For Mac:
http://www.klieme.com/EyeSight.html

And Linux:
I use uvccapture, designed for still webcam images, it handles auto-exposure better than software designed for streaming video. It is available in the Ubuntu repositories or you can grab it here:
https://github.com/csete/uvccapture
See "My Linux Setup" below for instructions. 

Camorama Software
Regardless of the software, the process will be the same: Capture an image, save it to your computer, use ftp (or sftp) to upload it to a remote server, view it online.

For free weathercam hosting and making the images available online, I use weatherunderground. They will broadcast your images, create a video of the last 24 hours and even provide a weather calendar of the last month which offers videos for each day.

Ok. Lets get started.

Plug your webcam into a usb port on your computer. Point the camera out the window. This sounds simple enough, however there are considerations which may complicate your choice of view.

Direction: Pointing your camera either due west or east will result in direct sunlight on your camera and window glass during part of each day. This usually results in overwhelming glare which can obliterate the image. If possible, it is best to point your camera either north or south so it will not be pointed directly into the sun.

Distance: USB looses signal strength with a cable over 15' long. This can cause corruption of your images and an unreliable source. Choose a window which you webcam can reach without using an extension or keep the total distance under 15 feet.

Sky Cam
Subject: Choose a view which gives the info you are looking for. Are you watching for snow so you know if you need to leave work early? If yes, then make sure you can see the ground. Are you watching the sky for approaching threats of bad weather? Point it toward an open area of sky, preferably in the direction which weather usually approaches (avoiding due west/east if possible).

Once you have decided on a view, next you will need to create an account with your host. In the case of this article, that will be weatherunderground.
Go here to setup an account:
http://www.wunderground.com/members/signup.asp

Setup your webcam here:
http://www.wunderground.com/webcams/signup.html

You can choose to upload images via FTP or URL. This means either you will send the pics directly to weatherunderground via FTP, or point them toward your own website where your webcam already exists. We will be using the ftp option.

Streamcam Software
To setup your webcam, you will be asked a few questions:
First, select the FTP option and give some general information about your organization (if any) and location. Select your timezone. Your address is requested, but general area info is fine. Enter the City, State and Zip Code. Your latitude and longitude will be calculated.

If you have a Personal Weather Station (PWS) and would like to upload the data, you can enter the address, IP or url here.

Finally, you can choose to share your camera type and this info will appear on your webcam page.

Click 'Save Changes' and you will be taken to a page where your camera will be listed with a name like mywebcamCAM1. It will show the location you entered and allows you to add another webcam if you have one.

Go to your webcam software and use the following settings, per the WunderCam FTP Wiki:
   "FTP SERVER: webcam.wunderground.com
    Username: You will be provided with a Camera ID on the sign up page in the "Your Current Cameras" box.
    Password: You will need to log in with the same password you use to access the Weather Underground site.
    Directory: We actually move the file for you, so if your software requires a directory you should set it as '/', but otherwise leave it blank.
    Filename: We also change the filename of your image, so a default name can be almost anything you'd like but 'image.jpg' is preferred.
    Binary: Please make sure that you are uploading your images through FTP using the binary setting.
    Image Resolution: There is no minimum or maximum resolution. However, the larger the resolution, the larger the file size, so please adjust your resolution and image quality settings to get the best image within the size limitations. "
If you click on the link which is your CameraID, it will take you to your own webcam page, which displays your current image, date and time, current local conditions, camera type and you will start building a calendar which shows still and videos of each day.

 

Bookmark this page or link to it from somewhere else for a reliable free weathercam, accessible from anywhere (including from your smartphone). You will also see your webcam included in their weathercam 'library', which is available by clicking on the 'webcams' tab on the weatherunderground site.

Last, monitor your new webcam for a few days and adjust as necessary to reduce glare (clean the glass, inside and out), fine tune the image and make it as useful to you and interesting to others as possible. Finally, If desired, you can submit your webcam to a site such as 'EarthCam', to be included in their listings of worldwide webcams.  As their tagline boasts, "Where the World Watches the World".

As Mark Twain noted, we may not be able to do anything about the weather, but we can monitor it closely and be prepared for it. Your new weathercam makes that easy and fun.

*********************************

EDIT: In November, 2017, Weather Underground announced that it was discontinuing it's free webcam hosting. Over the next month, webcams started dropping off or rarely updating. Many users found other hosting or risked losing their web presence.

Happily, Weather Underground users were vocal about their "passionate support" for their weather webcam network and on December 7, 2017 announced they would "continue to allow users to add webcams to the Weather Underground Network."

Thank you, Weather Underground for listening to your customers and continuing this valuable public service and a big thank you to WU webcam users who spoke up and saved this network of free weather webcams around the world.


*********************************

My Linux Setup

Install uvccapture, then open Startup Applications and paste the following code into the 'command' section.
uvccapture -m -t600 -q75 -x640 -y480 -o/home/user/webcam/image.jpg
This string of commands loads the program and instructs it to refresh the image every 10 minutes (600 seconds), to use compression on the JPG file at 75% quality. It states the webcam resolution, which must be supported by your device. The last argument includes the location to save the image file.

More info and commands for uvccapture are located here: http://manpages.ubuntu.com/manpages/natty/man1/uvccapture.1.html 

For basic ftp upload of images, try this simple script.
Copy and paste the following into a text editor. Edit lines 4, 5 & 6 in the top section and line 5 in the bottom section:
# vi ftp-run.sh
#! /bin/sh
#run this file with ./ftp-run.sh
REMOTE='your-remote-server.com'
USER='username'
PASSWORD='password'
FTPLOG='/tmp/ftplog'
date >> $FTPLOG

ftp -n $REMOTE <<_FTP>>$FTPLOG
quote USER $USER
quote PASS $PASSWORD
bin
/home/user/webcam-folder
mput image.jpg
quit
_FTP
Save the file as ftp-run.sh in the webcam folder. Right click on the icon and under Permissions, click to 'Run this file as a program'. I set up a cron job to run this script every 10 minutes with this command:
crontab -e
    arrow down to bottom

Paste:
*/10 * * * * cd webcam && ./ftp-run.sh

Ctrl + x to exit
Y to save
Enter

More fun with your webcam: PortalView Live Desktop Wallpaper for Linux

Tuesday, July 19, 2011

Live Earth Wallpaper for Your Computer

Live wallpapers have been available for your iphone or Android phone for quite a while now. Where are the cool live wallpapers for your home computer? I use a near-live Earth view on my desktop showing weather and night and daylight areas. It updates hourly as you watch the night shadows fall across the Earth and the city lights come on. Similar programs are available for Windows, Mac and Linux so your desktop need never be boring again.

Windows and Mac users can download EarthDesk 5 from Xeric Design at http://www.xericdesign.com/earthdesk.php for a cost of $24.95. There is a trial version available which applies a watermark to the desktop image.

EarthDesk offers many unique features such as a database of over 10,000 cities around the world which you can use for centering your map. You can lock it in
xPlanetFX
place by city location or the position of the sun or moon. Moon phases andreflectivity levels of the earth combine to display an accurate rending of moonlight on the planet. You can select between satellite, enhanced satellite or political maps. Adjust the cloud transparency level and watch the vegetation and snow cover change month to month.

Linux users have several free options. First up is the popular xPlanetFX, available at http://mein-neues-blog.de/xplanetfx/ . This live Earth wallpaper features near photo quality images with realistic cloud and surface feature rendering. Coronal and atmospheric lighting provide even more subtle detailing.

xPlanetFX software comes packaged in .deb, RPM, or PKGBUILD or you can build and install it yourself with the tar.gz version. It is also available at gnome-look.org.

PortalView Live Wallpaper
EDIT 12/29/2012: Another Linux Live Wallpaper option is PortalView Live Wallpaper, created by this author. It was designed to grab and update not only World Sunlight maps, but webcam images and satellite & radar maps. It includes scores of webcam and map locations to start with, then customize with your local favourites.

More choices for Linux users include Real Time Sunlight Wallpaper which has packages in .deb or tar.gz. This program offers four projections: Mercator, Peters, Mollweide and Equirectangular as well as Dawn to Dusk and Moon Phase views.

Impress your friends and family with these beautiful Live Wallpapers for your home desktop. Whether your using Windows, Mac or Linux, there is no excuse for boring desktops any longer.

Saturday, July 2, 2011

Solving a Corrupted or Truncated Web Cam Image

I have a weather web cam which uploads outdoor pictures every 5 minutes. I have been struggling with a problem with the web cam images displaying rows of black or gray pixels starting at the bottom of the image. This corruption waxed and waned throughout the day, sometimes consuming large portions of the picture.

I have spent hours searching the web for an answer. I have read countless articles and forum postings without success. I have noticed that many others have the same problem, with no answer to be found.

I am posting this to share a solution to the problem which I discovered through trial and error. I hope it will help someone else struggling with this frustrating issue.

First, when playing with the web cam settings I noticed that the corruption increased with the sharpness of the image. It seemed the more detailed the picture, the more likely a problem would occur. So for some of you, if this problem is minor, that is, it occurs intermittently or only involves a few rows of pixels, you may be able to correct it by simply lowering the sharpness setting. Yes, this will result in a less detailed picture. You decide which bothers you more.

For others who are experiencing a large amount of corruption of the image, which may obliterate most of the picture, I have found that reducing the image resolution has worked to end the problem. I was reluctant to change from the default settings but the problem has not returned since I tried it. 

Yes, it makes the picture smaller or grainier when enlarged however I was able to increase the sharpness setting without the problem reappearing.

This is not a perfect solution. Other factors which may be involved include a cheap web cam with a fairly low resolution to start with. Spending a few extra bucks on a decent web cam may allow you to lower the resolution without loosing much detail in the image.

Another problem can be the distance from your web cam to the computer processing the image. USB cables will degrade the signal if the distance is longer than 15 feet without a repeater or external power supply, so check the length of your cable. Shorter is better.

Let me know if this worked for you or if you found another solution. Good Luck with your project.