Presentation on theme: "Planetary Imaging with Webcam and Computer"— Presentation transcript:
1Planetary Imaging with Webcam and Computer Clif Ashcraft, March 12, 2014
2Webcams? For Astronomy?Webcams are small digital video cameras that attach to your computer at the USB or Firewire portMany webcams are true CCD devices (like the Philips ToUcam)They are lightweight & Cheap, $100 or so…They produce monochrome or color digital videos in the .avi format, in a variety of resolutionsThey are pretty much state of the art tech for high resolution planetary imaging
3What’s Inside a typical webcam? Lens with NIR filterCCD chip behind windowMicrophoneVideo Circuit BoardUSB connector and cord
4How do you use it for Astronomy How do you use it for Astronomy? (you are probably going to void your warranty)2)Add NIR blocking filter and 1.25” adapter1)Remove lens and discardReplace the telescope eyepiece with the webcamPlug webcam into your laptopPoint telescope at Mars…3)4)5)
5If you’re persistent and lucky, you will get some If you’re persistent and lucky, you will get some .avi video files which show planets jiggling around on the computer screen with fleeting glimpses of details on the edge of visibility, maybe better than what you might see squinting through an eyepiece, but still, nothing spectacular.You can also extract single frame snapshots from the video, but they tend to be blurry and don’t show the detail you could glimpse in the original “live” video.Wouldn’t it be great if we could somehow extract all the detail we know is in the video, and put it all into one picture?
6Well, thanks to a Belgian amateur astronomer/computer programmer named Cor Berrevoets, we have a FREE downloadable program named REGISTAX which does just exactly that:Here’s what Registax does:Examines every frame of your video fileDoes a critical evaluation of its quality.Arranges frames in order of qualityLets you pick a reference frame and how many of the best ones to keep.Aligns each frame with the reference frameAdds the frames digitally (stacking)This gives an enormous improvement in signal to noise ratio (by √n).Uses wavelet analysis to sharpen low contrast details in the image.Believe it or not. This image came from the video with the blurry single frame we saw in the previous slide!BUT, there are some details we need to deal with before we start getting pictures to rival the Hubble….
7Critically Important Factor: Critical Details:To get good results we need to match the resolution of the telescope to the digital sampling ability of the webcamWe do this by amplfying the focal ratio of the telescope until the smallest resolved image details are big enough to be realistically sampled by the pixels of the webcam CCDWe determine how much magnification we need using the digital sampling theorem - also the basis for high fidelity digital music recording and the operation of cell phones.
8The Digital Sampling Theorem In 1927 Harry Nyquist, an engineer at the Bell Telephone Laboratory determined the following principle of digital sampling:When sampling a signal (e.g., converting from an analog signal to digital ), the sampling frequency must be at least twice the highest frequency present in the input signal if you want to reconstruct the original perfectly from the sampled version.His work was later expanded by Claude Shannon and led to modern information theory.For this reason the theorem is now known as the Nyquist-Shannon Sampling Theorem
9What does this all have to do with webcam astronomy? The image made by the telescope optics is a two dimensional analog signal made up of spatial waveformsA webcam is a digital sampling deviceLet’s re-state the sampling theorem in terms that relate to telescopic imaging using a webcam:The sampling frequency implied by the pixel spacing on the webcam CCD must be at least twice the highest spatial frequency present in the image to faithfully record the information in the image.If you violate this rule it’s called UNDERSAMPLINGUndersampling is BAD…
10How can we avoid undersampling in our imaging? We can illustrate this with a digital scanner and a radiating line pattern:Effects of Undersampling:Alias signals - illusions, not really there13 dpi60 dpi302 dpi23 dpiOversampling is ok…Undersampling is not!How can we avoid undersampling in our imaging?
11Moon image made with small refractor at f/6. Note sampling artifacts They are the result of using a focal ratio too small for proper sampling.
12Let’s have a look at theTo avoid undersampling we need to understand the sampling ability of our CCD
13Monochrome vs Color Sensors If your camera has a monochrome sensor, you simply have a rectangulararray of light sensitive regions called pixels grouped closely together sothat there is very little space between them for light to be lost:The spacing between the pixels, s, is often just called the pixel size, usually expressed in microns, and is given in the technical specifications for the webcam.The sampling ability of the sensor is determined by the diagonal spacing of the pixels and is just spacing multiplied by the square root of two.Sampling frequency:vs = 1000/(s√2) samples/mmNyquist frequency:vN = vs/2 line pairs/mm (lp/m)For a sensor with 5.6µ pixels this worksout to: vN = 64 lp/mmTo produce a color image from this kind ofsensor requires the use of colored filters andtaking three separate videos in rapid successionto give red, green and blue images.
14A color webcam’s CCD, such as the one in the ToUcam is covered with an array of tiny filters called the Bayer matrix:Since there are samples taken in every frame for red, green and blue,only a single video is required to generate a full color image.There is a penalty however: lower resolution.
15Color images are produced by separating into separate layers: Note that in this scheme,the samples are twice as farapart as they were in themonochrome sensor.Sampling frequency:vs = 1000/(2s√2)vs = 1000/(2s)Nyquist frequency:vN = vs/2For the ToUcam, s = 5.6 µvN = vs/2 = 32 lp/mmvN = vs/2 = 45 lp/mmThese are the maximum spatial frequencies the webcam can accurately sample in any telescope image.
16But these color layers are full of holes! How do we avoid a grainy pixellated looking image with all these black holes?The most common way is simply to interpolate between the data we have.There is a fancy word for this: Debayerization.There are many algorithms for doing this. They differ only in how well they avoid making stupid mistakes. The simple, fast executing algorithms, like “Nearest Neighbor” make lots of mistakes, particularly oncolor boundaries, which result in color artifacts in the final image. Fancier ones, like HQLinear (available in Firecapture, and used on the Curiosity rover on Mars), don’t make the stupid mistakes but take longer to execute.They ALL are just interpolation and do not add any new information to the image.If you use debayerization of any kind, your resolution will be approximatelyhalf that of the equivalent pixel size monocrome camera.The other way is called dithering/drizzling and was invented by the Hubble Space Telescope imaging team to recover lostresolution in undersampled images. The HST was deliberately pointed fractional pixels away from the aiming point andmultiple images were acquired, effectively getting data in the cracks and corners between the pixels.This is called ditheringWhen scaled up by some factor, but not enlarging the pixels, these images could be digitally combined to give a higherresolution image, as though the pixels in the sampling device were smaller or the focal ratio were longer, by the scale factor. This is called drizzlingThe program AutoStakkert2 (AS!2) provides this functionality. It recovers color information from raw 8-bit color video tofill the gaps in the Bayer matrix by dithering: seeing and periodic errors in the telescope drive naturally point thetelescope around the aiming point, allowing real data to be acquired which fills in the holes in the Bayer matrix.This allows color video to be obtained essentially at the same resolution obtained by the equivalent monochrome camera.Additionally, if 1.5x or 3x drizzling is selected, it can recover resolution lost by undersampling in color or monochrome video.
17Now let’s talk about the resolution of the telescope Now let’s talk about the resolution of the telescope. First, some optical definitions: Focal length = F Aperture = D = diameter of lens or mirror Focal ratio = F/D (usually written f/# as in f/8 or f/2.5 or referred to as f-number or f-stop)imageDF
18Spatial Frequencies in the Telescope Image Diffraction causes the image of a point source to be spread out into a circular spot called the Airy disk:ddThe diameter of the disk, d, is dependant only upon the focal ratio (f#) of the optical system and the wavelength, l, of the light used:d = 2.44lf# = 1.34f# (for green light l=0.55m)
19Raleigh Limit for Resolution d/2 = 1.22lf#d/2Two points of light separated by the radius of their Airy disks can just be perceived as two points.How can we convert this information into a spatial frequency?
20Minimum Spatial Wavelength Based on Raleigh Limit Imagine the images of many points of light lined up in a row, each separated from the next by the radius of their Airy disks:The sinusoidal wave resulting from adding all the images can be used to define the minimum spatial wavelengths present in the image lmin = d/2The highest resolved spatial frequency, nmax = 1/ lmin = 2/d = 1/1.22lf#.
21Setting nmax = nN and plugging it into the above formula, we have, for So, in the image from the telescope, we find that the maximum spatial frequency, nmax, is given by a simple formula:Maximum spatial frequency = nmax = 1/1.22lf#For green light, l = mmAt f/6, nmax = 248 cycles/mmAt f/15, nmax = 100 cycles/mmNow that we know how to calculate this, we can “match” the maximum spatial frequency with the Nyquist frequency, nN , of our webcam.Setting nmax = nN and plugging it into the above formula, we have, for5.6 micron pixels:nN = 1/1.22lf# , which rearranges to:f# = 1/1.22lnN = minimum focal ratio to avoid undersamplingf# = 1/(1.22* *32) = 46You would use half this, or f/23 if you used a monochrome camera, or were usingAS!2 to dither/drizzle in the color information instead of debayering.In all cases, you must take four samples across the Airy disk
22Setting nmax = nN and plugging it into the above formula, we have: An alternate expression for the maximum spatial frequency is given by the cutoff frequency where the MTF goes to zero contrast:Maximum spatial frequency = nmax = 1/lf#For green light, l = mmAt f/6, nmax = 303 cycles/mmAt f/15, nmax = 121 cycles/mmSetting nmax = nN and plugging it into the above formula, we have:nN = 1/lf# , which rearranges to:f# = 1/lnN = minimum focal ratio to avoid undersamplingf# = 1/( *32) = 57However, one could argue that critical sampling at the cutoff frequency is silly, since contrast goes to zero there. Somewhere between the focal ratio calculated from the Raleigh limit and the value based on the MTF intercept is probably best…Again, you would use half this, or f/29 if you used a monochrome camera, or were using AS!2 with raw color video to dither/drizzle in the color information instead of debayering.
23Properly sampled Airy Disk Note four samples fit diagonally across the disk
24OversamplingAstronomers doing high resolution solar imaging routinely oversample by 50%This seems to result in higher contrast, particularly at high spatial frequencies
25Result of 50% Oversampling Note 6 samples across the disk
26} The atmosphere also affects the image: The effect of atmospheric turbulence is to blur and bounce around the perfect Airy disk image until it doesn’t look so pretty any more:Assuming5.6µ color camerawith debayeringAssuming5.6µ color camerawith ditheringor 5.6µ mono.f/ f/ f/ f/ f/14f/ f/ f/ f/ f/7excellent good average poor badV IV III II I}Various qualitative seeing scalesWhen the seeing is bad because the image is jiggling around, but slower than your frame rate, use the recommended focal ratio to achieve Nyquist sampling, Registax will eliminate the image motion and recover the detail.If the image motion is faster than the frame exposure can capture, or the image is defocused to a blur, you may reduce the focal ratio. The high spatial frequencies are no longer present in the image. Stopping down is often useful.
27Much of the poor seeing in NJ this winter has been caused by the Jet Stream: Global warming has caused them to move south. They may be a permanent fixture.
28Maximum Length of Video Planetary rotation imposes a limit on how many frames you can take with your webcam. Emmanuele Sordini has figured this out for us at: bloomingstars.comHere are his recommendations for Mars, Jupiter and Saturn based on keeping image blur smaller than the resolution of the telescope and sampling ability of a webcam:
29How do we get the magnifications we need? Barlow Lens or PowermateMicroscope Objective Transfer LensEyepiece Projection
30A Barlow Lens is a good way to achieve magnifications in the range of 2x to 3x and most amateurs already have one in their eyepiece box.It’s not a good idea to try to use a Barlow lens at a significantly higher power than its design magnification. Spherical aber-ation is introduced this way and can harm the image quality. Stacking of two Barlows to get 4x works better.Nagler sells Powermate image amplifiers that work well in this application although they are expensive. They are available in powers of 2x, 2.5x, 4x and 5x. They are used exactly like a Barlow lens.
31Microscope objectives are a convenient way to gain high magnification with excellent optical quality.Typically, 5x, 10x, 20x and 40x are available. The 5x and 10x would be useful for this purpose. They are designed with a 160 mm back focal length, and the front working distance to the object being magnified is a little less than 160/M mm where M is the magnification.They are designed to work at the stated magnification (etched on the barrel of the lens) but can be used at slightly higher magnifications because we are not using their full numerical apertures with an f/6 beam.
32The third easy way to couple a webcam to the telescope is using Eyepiece Projection. You need to make a short extension tube that fits and locks over the eye end of the eyepiece and which accepts the webcam adapter on the other end.A wide range of magnifications can be obtained by this method which has a long history of use for conventional astrophotography in the amateur community.Magnification achieved and the quality of the image obtained are dependant upon the power and quality of the eyepiece. Plössl eyepieces and orthoscopics should work well.
33Many varieties of Webcams Philips ToUcam has been a very popular and inexpensive webcam for astronomy and is the camera I started with.An excellent entry level webcam costing under $100.Difficult to find these days in the US. See AmazonUK and Ebay...Celestron NexImageGood low cost webcam, true CCD, 1280x720 pixels $99.95Higher performance (and more expensive) industrial and surveillance cameras used by advanced amateurs for astronomical purposesThe Imaging SourceDFK21: $350 for the color camera with 1-1/4 adapter.DMK21: $390 for the B&W camera, $199 for filter wheel, $285 for filter set.Point Grey Research CCD fire-wire cameras ~$700 or soZW Optical High performance CMOS cameras.ASI120MC color camera, 1280x960 pixels, $298ASI120MM mono camera , 1280x960 pixels, $328ASI120MM plus filters and filter wheel, $498
34Good places to start: Celestron NexImage The Imaging Source DBK21 ZW Optical ASI120MC/MM
35Bayer Matrix vs Color Wheel? Monochrome cameras have about twice the resolution of the color cameras and can use lower focal ratios to achieve Nyquist sampling.But, to get color images from a monochrome camera, you have to buy a color wheel and RGB filter set and then take three videos within the allotted time span to avoid rotational blur, compared to only one video with the color camera.It may be difficult to get an equally good quality videos in R, G and B if the seeing is not dependable where you image.The best imagers (guys like Damian Peach and Chris Go) use monochrome cameras, but they also tend to have good seeing where they do their imaging.If you have dependable good seeing, you may get better results with a monochrome camera and a color wheel, but you will work a lot harder and not get nearly as many images.If your seeing is less dependable, a one-shot color camera with a Bayer filter matrix built right on the CCD will work better for you.It is a lot cheaper to just get a color camera and forget about the color wheel.If you use AutoStakkert2 instead of debayering, you get the same resolution anyway, thanks to dither/drizzling…
36Camera Settings Guidlines Uncheck all “Auto” boxesFrame rate to 15 for older cameras like ToUcam, 30 to 60 fps with newer Firewire and USB2 cameras like TISGain - set at 2/3 to 3/4 of full gain, increase to full if neededExposure - as short as possible to minimize blur due to image motion caused by seeing. Should be 1/25th sec or shorter. If not possible, increase gain and try again.White balance - critical for realistic images. Two slider adjustments for blue and red balance. Adjust so the moon has no significant color. May be adjusted by pointing telescope at gray test card in daytime as well.Experiment…
37Computer stuff The Computer If you are setting up outside each time, the computer probably has to be a laptop. If you have a permanent observatory, a desktop is better.You need a reasonably fast windows PC (no Macs, sorry, no software)Buy as much RAM and hard drive space as you can possibly afford, a gigabyte hard drive space is not too much!Get an external 2 TB hard drive for your video library.You need a free USB or Firewire port to plug the webcam into.Webcam software: The driver on the CCD that came with it.Download Firecapture: It’s free! and is the best astronomically oriented video capture program available. Powerful, user friendly, and saves data files with all your camera settings as well as timings and object info.Download Registax: It’s free!Registax tutorials:
38Work Process:Set up telescope with Barlow lens providing proper focal ratioCenter planet and focus with parfocal eyepieceAttach camera and connect to computerCapture raw 8-bit color video Native camera software or FirecaptureDebayer or Dither frames to recover color Firecapture, Registax or AS!2Evaluate quality of framesLimit number of frames to useAlign framesStack framesSharpen frames with wavelets RegistaxDerotate and stack individual images WinJUPOS}Registax, PIPP or AS!2
41My observatories in the snow… New Night Assistant, Boomer
4210” f/17.6 Newtonian.Barlow lens mounted on-axis in front of small diagonal.Scope mounted on Losmandy G11 Germain Equatorial.Later installed in observatory.Used for Mars Opposition in 2003 and high resolution Jupiter pictures.
52Lunar Mosaic 11/9/08Taken with DMK31 coupled to 7.25” Schupmann with 2x Barlow lens through red #25 + NIR blocking filters.Effective focal ratio was f/39. Exposure 1/34th 30fps.Mosaic assembled in PhotoShop from ten individual videos of 30 seconds duration.Videos processed in Registax4.Each image is a stack of the best frames in each video.
53Lunar Mosaic 11/9/08Taken with DMK31 coupled to 7.25” Schupmann with 2x Barlow lens through red + NIR blocking filters.Effective focal ratio was f/39. Exposure 1/34th 30fps.Mosaic assembled in PhotoShop from ten individual videos of 30 seconds duration.Videos processed in Registax4.Each image is a stack of the best frames in each video.Note craterlets inside of the crater Plato.
57Images I took during the 2003 Opposition with Mars using my 10” Newtonian and Philips ToUcam
58An Egregious Comparison: HST image is ten times better (it should be)Costs one million times as muchWould you believe my observatory is100,000 times as cost effective as the HST?Mars from the 98 inch aperture HSTPrice: $4,000,000,000Mars from my 10 inch in Perrineville, NJPrice: $4,000
65Mars, 2010 Opposition 0.6673 AU 62,030,000 miles Mars, 2003 Opposition 10”
66Past and Future Oppositions with Mars The opposition of 2003 was the best in recent memory.The oppositions 0f 2010 and 2012 were about as unfavorable as possible.The 2014 event is more favorable, and subsequent oppositions will become better and better until 2018 which is another very close one.SunEarth OrbitMars Orbit
79The Outer Solar SystemUranus November 17, :20 UTFar far away…
80Helpful HintsUse a 2x Barlow for your early experiments. It gets the focus outside the drawtube and into the webcam focal plane. You might not be able to focus without it and you really need some amplification no matter how lousy the seeing is. No problem if you have an SCT.Parfocalize an eyepiece with your webcam. Life is much easier if you can prefocus before getting into the computer stuff. A motorized finder is very helpful. It is amazing how much image motion you get when you barely touch a manual focuser while you’re working at f/45.You must have a good finder. I doubt that even modern computerized GO-TO scopes are accurate enough for webcam purposes when you are using f/40 or higher. The 7-10x finder that came with your scope is probably not powerful enough. A second finder working at 25x or higher is a really good idea. I just attached a 3” f/10 Newtonian on the side of my scope with a 12.5mm illuminated eyepiece giving 60x. This works fine.Start with the moon. It is bright and easy to find and rewards you with easy good results so you don’t get discouraged.If the seeing is poor to average, don’t waste your time with long focal ratios, f/30 or even f/20 will probably recover all the detail visible.