Littlefoot Elegance Photo User

Astroforum rund um die Astro-Elektronik


Sunday, 26 August 2007

Sharpness Control for Philips Webcams and Derivatives


One of the advantages of Linux for astro-webcammers is that the fullest range of camera control are accessible to the user, through the PWC camera driver. Crucially this includes control of image sharpness. The benefits are obvious, especially for deepsky imaging. Until now webcammers who use MS Windows have had to put up with image artifacts around bright objects. These are widely referred to as ears, due to their characteristic patterning on either side of the bright object. The only way to get rid of them has been to either process them out using a neat little Windows application, Loreal, or to move to Linux. Qastrocam allows you to set the sharpness control to zero, which removes all traces of the dreaded ears. The images are soft, but that can be sorted out once the images have been calibrated, aligned and stacked. By the way reducing the sharpness also removes the nasty artifacts around hot pixels, which makes dark subtraction far more effective.

Linux does have an excellent image capture program called Qastrocam, but there are not many image processing applications or scope control programs available for amateurs. This is being addressed by the Lin4Astro team, but most folks want to work with their favourite tools in Windows.


Because of my particular interest in deepsky imaging I had converted to Linux for capturing raw images. I still did all image selection, calibration and post processing in WIndows. In November 2003, I was checking the periodic error on my mount. For this I reverted to K3CCDTools and RXPEC as I wanted the added functionality provided by these Windows applications. I wasn't interested in the image quality until I realised that the star I was using to test the tracking looked remarkably earless, just like Qastrocam's stars. Somehow the zero sharpening had been saved to the camera.

The Solution

I knew that the save setting functionality in Qastrocam was not functional, so I tried all sorts of things to try and replicate the zero sharpening, to no avail. While surfing through the PWC driver website for inspiration I found a link to a little program, SETPWC which looked promising. It is basically command line program that lets you interrogate the internal control registers and NVRAM of Philips Vesta and ToUcam webcams.

After downloading the program and compiling it I found it allowed me to set, verify and save the settings for the camera. What is more when I connected the camera to my Windows PC and ran K3CCDTools I got the reassuringly blurry images of a camera with its sharpness set to zero - Result!!!

The next test was to see what would happen if I saved these settings as User Settings from within K3CCDTools. Fortunately, the image remained blurry, even when I changed some of the other settings such as white balance and B/W. This is important as it would not be much good if you needed to set the camera up in Linux each time you wanted to change a setting.

So what happens when you reset the camera to its Factory Settings? Well, not surprisingly the image sharpness is reset to its standard setting. What is interesting is that if you load the user settings, sharpening is switch off again. This is good news as it means that potentially you only need to configure the camera once under Linux to have both normal and zero sharpness. However you need to be careful, because if you revert to Factory Settings and then save them as User Setting you will need to use Linux to get access to zero sharpening again.

SInce this First Light I have developed a more robust mechanical and electrical design, which will be star tested at the earliest opportunity.

Step by Step

Install SETPWC on a Linux machine. PWC should already been installed in recent versions of Linux.

Connect the camera to Linux PC.

Navigate to the executable and type:

setpwc -h

This gives you all the command line options.

With the camera connected you can configure it to your liking.


setpwc -p

This should return the current setting of the camera. If you get no response from the camera, type modprobe pwc at the command line and try again. This should find it up if Linux has lost it.

To switch off sharpening type:

setpwc -m 0

You can set other levels, 0 - 65,000 to suit your needs.

Now check that the setting has changed by retyping:

setpwc -p

You may also want to set the Noise reduction to OFF by typing:

setpwc -q 0

When you are happy with the settings type:

setpwc -b

This will write the settings to the NVRAM in the camera.

Now you can disconnect the camera and reconnect it to Windows. Go to your favourite capture application and verify that the settings have taken effect - deep joy!


Windows Users can capture their images in the applications that they have become familiar with. The mod works with K3CCDTools and Astrosnap so it should work with anything that uses the Windows WDM driver.

Users can run Windows scripting, mapping and scope control applications on the same PC.

The image production process can be carried out in a single operating system.

Personally, I think that the windows driver produces better output at Video frame rates. This might be subjective. I'd like to hear others opinions on this point.

The Noise Reduction control can be set to zero also, which increases the apparent gain of the camera.

No need to get the soldering iron out.

Oh Yeah - No Ears!


I hope you find this modification useful. I hope that this inspires more people to consider webcams as a entry into the amazing hobby of astro-imaging.

I'd like to thank the following people:
Franck Sicard for writing Qastrocam, I would not have discovered this modification without his software and Linux.
Folkert Van Heusden for writing SETPWC, which allows the Philips cameras to be configured
Nemosoft for developing the PWC Linux driver.
Steve Chambers for ideas bouncing.
Gene Chimahusky for testing the mod, and proving that I was not dreaming.

If you find this of use, let me know; and Perhaps you would like to make a donation to Cancer Research UK
That would make me feel good.

The instructions are provides 'as is' with no guarantees of being correct, accurate or even working. You agree to be responsible for any injury, damage or loss that results.

Further Developments

Martin Burri developed a port of SETPWC named SETWC that allows the features of SETPWC to be accessed through Windows. This proved quite successful though some user had difficulties getting the USB interface to recognize the camera correctly.

Jack Reed had also been looking into ways of accessing the 'secret' functions of the Philips-based webcams. He had developed a link with the camera using the I2C interface. that is used to pre-program the webcam during manufacture. Jack's software and interface design can be used to interrogate and modify the contents of the camera's EEPROM, which holds all the SETPWC setting and a lot more besides. Jack's website can be found here

A Yahoo Group called TWIRG, which stands for Tweak Webcam I2C Research Group has been established as a forum for those interested unraveling the secrets of the Philips-based webcams. Already, great strides have been made.

Martin Burri has developed a program for accessing the EEPROM settings via the USB. It is hoped that this software can be developed for general use, once a solution has been found for resurrecting cameras that have been 'scrambled' by over-ambitious probing. At present it is only possible to bring these cameras back to life using Jack's I2C interface - BE WARNED!!!

Members of the TWIRG Group have developed revised EEPROM code that can access the raw pixel data from the output of the analogue to digital converter. This means that the full resolution of black and white sensors can recorded, just like conventional imagers. The so called 'RAW mod' has been adapted to colour sensors, so that alternative bayer interpolations can be used as part of the post processing, with improved luminance resolution.

1 comment:

Anonymous said...

Re: aAstro Photo Insight Magazine
Subheading:Sharpness Control For Philips webcams....

Please note that wxAstroCapture is now a good alternative to K3CCDTools, etc and is available FREE for both MS Windows and Linux.

wxAstroCapture can record AVI files in RGB24 format so that RegiStax (running under wine) can be used to stack, etc --- all working under Linux.

Ken Hough