8. Imaging the Sun – using webcams

Here, SPA Solar Section member Mick Jenkins shares with us his technique of imaging the Sun with a webcam attached to a computer and then processing the video and the final image to bring out detail.

There will come a point when you will want to capture images of the Sun’s disk either in white light or hydrogen-alpha for yourself and you might not be sure how to go about it. This short guide should help explain what to do.

The idea is that we take a short digital video using a webcam and save it to the computer. The video is usually in the “AVI” (Audio Video Interleave) format. This format was introduced by Microsoft in the early 1990s and it has provided audio and video playback on all MS Windows computers since. In the method we use for solar imaging, we don’t use the audio but we do use the video generated by a webcam connected to a computer. We then process the video through free software available from the Web to produce a single still image. The benefit here is that a still image created from video in this way will, in most cases, show much finer detail than a single image taken taken with DSLR cameras. This is because the video can capture the fleeting moments of good seeing when the Sun’s image is super-sharp, and the software allow us to easily extract these video frames into a single composite still image.

WHICH TYPE OF CAMERA?  The main things to consider are the cost of the webcam, the sensor size, and whether it is a colour or monochrome. If you are thinking of using a camera just for imaging the Sun, then I would recommend the monochrome camera as they give sharper images particularly when imaging in Hydrogen-alpha. If, however, you plan to use the webcam for other astronomical objects (the planets, for example) and want a good all-rounder, then a colour camera will most likely be the best choice for you.

SENSORS: There are two basic types: those with CMOS sensors and those with CCD sensors, but they both give good results:

  • CMOS: Quite a number of these cameras have sensors that come with a maximum resolution of 1.2 megapixels (1280 × 960 pixels). With this type of camera, the software usually allows you to set the resolution yourself. If you have one of these you can reduce the frame size from 1280 × 960px down to 320 × 240px as this will give you a capture frame rate between 35fps (frames per second) and 215fps, which is useful when seeing conditions are poor (the fast-frame rate helps overcome this to a certain extent).
  • CCD: These cameras tend to be of fixed resolution and you will need to decide the resolution you want when buying the camera. Usually, the higher the resolution, the higher the cost of the camera. The resolution normally ranges from 640 × 480 pixels to 1600 × 1200 pixels.


The telescope with webcam attached. 

MOUNTINGS: A reasonably solid and stable mounting is important. In the image left, you can see that I use a equatorial mounting for the main scope to image in white light and the hydrogen-alpha scope sits on top of that. The movement of the mounting makes it easier to follow the Sun as it moves from east to west in the sky.

If you do not yet have telescope mounting then a standard photographic tripod of good height and stability will be good enough for short exposures. Whole disk images can be taken without using any tracking by taking very short bursts of video and using fast frame rates. This will mean the Sun will not drift too far away from the centre of the frame during exposure.

Ideally, a way of keeping the image centred during the exposure is essential, so some form of tracking is required for close-up images of solar features such as sunspot groups.

PLAN AHEAD: I find it best to first plan the images I want to take before my imaging starts. For example, I might want to capture the whole disk of the Sun or perhaps I want just a close-up image of an interesting sunspot group. I can then decide how to go about achieving the images I  want.

It’s best to first visually check the Sun to judge how good the seeing and transparency conditions are before setting-up your equipment. On some days, no matter how hard you try, the seeing or transparency will be too poor to overcome even with a fast frame video and it is best to stick to visual observing. Sometimes, the seeing and transparency can be good or even excellent even if only for short periods and it is on these days that we can get our best solar images.

Telescope and laptop
The telescope and nearby laptop. 

CAPTURING THE VIDEO: If observing conditions are at least reasonable then set-up your camera with your chosen filters (for example, you might want to use a UV/IR (Ultra-Violet/Infra Red) filter for both white light and H-alpha. Solar continuum filters can also be used for white light and can help a great deal in increasing the contrast in the final image. I always use a UV/IR filter attached to the nosepiece of the webcam as most modern cameras are sensitive to the unfocused UV/IR light. This leads to a slightly blurred image. The UV/IR filter blocks these and therefore helps to deliver much sharper images.

Focus as carefully as you can on the image on your computer screen. I find this is best done in bright sunshine with a blackout cloth over your head and the screen. This might look odd but it is easier to get a clear view of the screen as sunshine makes the screen hard to see. Focus is critical.

Watch the image carefully, it will move and shimmer, but keep tweaking the focus untill you are happy it’s as sharp as possible. If you need help trying using view zoom in the software to get the best focus you can achieve.

Set the webcam gain to low, this will reduce the noise in the image. Set the exposure so that the image will be slightly under-exposed. The software will normally set the frame rate automatically depending on the camera’s resolution.

Computer inside observatory
Capturing the image.

We need to take a series of short videos so next decide on the number of frames per second. I use 800 fps for the whole solar disk or 1,000 fps for close-ups of sunspots and other features. Use the higher frame rate if the seeing conditions are poor, be aware that on some settings you can end up with a video file of more than 1Gb!

Wait and watch the solar image on the screen and when the image is stable and sharp, press the capture start button. Take 3 or 4 short videos, adjusting the focus between each video if necessary.

Finally, remember to name the videos with the date and time it was taken (most capture software does this for you automatically).

When we process the videos the software will convert them in single composite images. You will then be able to decide which of these is the best image to keep. Once I have got my final composite image, I usually delete the videos as they take up too much space on my hard disc.

PROCESSING THE VIDEO: After we have captured the videos the next stage is to process them. You can do this later after you have put away the telescope and other equipment if you prefer or you can do it straight after capture. I use the stacking software: “RegiStax”, version 5 or 6, which is a free download from the Web. There are other processing software packages available, such as “AutoStakkert!”, which one you use is up to you as it’s a personal choice.

With Registax you can leave most of the options at their default settings, but it is worth experimenting to find the best settings for your images. This is the process I use as a guide to get you started:

Sun using Registax
Image processing using Registax. 

Open the software and load the first AVI video file. Once this has happened, the software will allow you to move through each individual frame in the video. At this stage you will have to choose the sharpest frame so that this can become the “master frame”. The software will sort all the other frames by comparing them to the master frame and then ranking them all in order for you. If there are several thousand frames you need to be patient to pick one that looks sharp. Don’t rush this step as it will decide how good the final composite image will be.

ALIGN & STACK: Next we need to set the alignment points. We can do this manually or we can let the software decide where to put them for us. Click on the “Set Alignpoints” button to let Registax do them for you. To set them yourself, click on the image and small green circles will appear on the image wherever the cursor is pointing when you click. If you are happy with the position and number of alignment points, click the “Align” tab and the software will sort, arrange and align all the frames from the best (first) to the worst (last).

Tick the “Show Registration graph” box and this will produce a small graph (2) of the quality and “movement” of the individual frames. Movement is the amount of “correction” the software needed to apply to each frame to align them up exactly with each other. In the unprocessed video the image will wobble slightly due to the seeing conditions during capture. Slowly move the frame cursor (3) to limit the number of frames you want the software to use and click the “Limit” button (1).

Wavelet processing
Wavelet processing with Registax. 

Try to keep the limit above 400 frames. If you keep too many it will take the software longer to process the video, keep too few and the final image generated by the software will be too noisy. Click the middle “Stack” tab and the frames will be stacked into the final composite image. If you set a limit of 400 frames it will stack the best 400 frames in your video.

WAVELETS: Once the video has been aligned and stacked, the software will automatically take us to the “Wavelet” tab (1). At this stage your image may look poor, but the next step will sharpen the image and bring out the hidden detail. I use the “Gaussian” wavelet filter and this can be selected by a radio-button (2). On the left-hand side of the screen there are six sliders (3 and 4). Pick one of these and slowly move each slider to the right. Don’t go too far, just use small increments. You may have to experiment to bring out the detail.If you push the sliders too far to the right you will start to see artefacts appear in the image and these will spoil it. If that happens just reverse the sliders or click on “Reset Wavelets” button.

When you are happy with the image, press the “Do All’ button. Assess the result, then move the sliders a little more (if required).  When you have finished, save the file as a “TIFF” file, as this will retain more detail for the next stage. The recommended file name should include Year Month Day and time format e.g. 2014 Nov 31 0930UT. Repeat for any other videos you took. The idea is to create a single composite still image from each video.

PUTTING THE FINISHING TOUCHES TO THE FINAL IMAGE: You should now have a single image from your video. Hopefully, it will look sharp and detailed. To finish processing this image you can use one of the many photo processing software around such as Photoshop, PaintShop Pro or GIMP 2.

Sun using Photoshop
Adjusting levels in Photoshop. 

I use PhotoShop as the image here shows. Open the image file, first check the orientation of the image and adjust so that north is up and west is right. This can be done in the Image menu (4) under “Image Rotation”. Next select the levels from the Image menu (4) adjust the image contrast using the sliders (5) this will bring out subtle detail in the shadows, don’t overdo it. You may want to add colour to the image, but this is a personal choice. I like to add a mixture of yellow and red using the “Colour balance” feature found under (4) “Image”. Finally, remember to label the image with the Year Month Day and time in UT (Universal Time). If the orientation of the image can’t be adjusted then show the north and west positions on the image. It’s also useful to record the telescope aperture and any filters that were used together with your name.

Processed image of sunspot by Mick Jenkins

The image here was taken from an AVI video and processed into a single image using Registax. The single image was then processed further using Photoshop.

With practice and patience you too can get images like this.

Good luck!




Next: Solar eclipses