Page 1 of 1

Oversampling - Not quite "getting" why it is a problem

Posted: Mon Jul 26, 2021 9:12 pm
by ionia23
Hello,

I've read many threads and tutorials which address the issue of "oversampling". I think I get why it's a problem, but not quite.

In my current rig I'm using an Orion Starshoot OSC G4 which has a resolution of 752 X 582. This is going through a 0.8x field flattener/reducer on a Williams-Thompson 105mm apo refractor. According to the calculations, I'm pretty close to exactly what I should be using for image capturing w/o oversampling under okay/normal urban skies.

Here's what I don't get about oversampling. All the data in the images is pixels. Squares. How do you make a circle out of squares? Three down the middle, three across. That's one clunky looking circle. The more squares you add, the smoother the outline of the curve becomes.

I have a second camera I can use for eyepiece projection photography. This gives me the flexibility of shooting very wide fields, or for chasing down very small objects as I don't have a decent barlow yet. That thing can push resolutions over 4k pixels.

I guess what I'm not understanding, other than significantly longer processing time, is what is negatively impacted by oversampling an image, just a bit?

Re: Oversampling - Not quite "getting" why it is a problem

Posted: Mon Jul 26, 2021 9:47 pm
by Mike in Rancho
Yeah I'll be interested to see what is posted too.

With a DSLR I'm sure I'm nearly always oversampled, but I trade off a certain amount of that for SNR with Bin, so seems handy to me.

Absent being able to do that, and assuming the same telescope, it's possible oversampling could take more acquisition time. Larger, "properly sized" pixels will catch more photons than many smaller pixels spread over the same area, and thus be able to rise out of the noise swamp faster. Maybe?

Re: Oversampling - Not quite "getting" why it is a problem

Posted: Tue Jul 27, 2021 1:38 am
by admin
The Bin module documentation should address most of what oversampling is and how you can use it to trade "useless" resolution for improved signal;
Bin: Trade Resolution for Noise Reduction

With today's multi-megapixel imaging equipment and high density CCDs, oversampling is a common occurrence; there is only so much detail that seeing conditions allow for with a given setup. Beyond that it is impossible to pick up fine detail. Once detail no longer fits in a single pixel, but instead gets "smeared out" over multiple pixels due to atmospheric conditions (resulting in a blur), binning may turn this otherwise useless blur into noise reduction. Binning your data may make an otherwise noisy and unusable data set usable again, at the expense of 'useless' resolution.

The Bin module was created to provide a freely scalable alternative to the fixed 2×2 (4x reduction in resolution) or 4×4 (16x reduction in resolution) software binning modes commonly found in other software packages or modern consumer digital cameras and DSLRs (also known as 'Low Light Mode'). As opposed to these other binning solutions, the StarTools' Bin module allows you to bin your data (and gain noise reduction) by the amount you want – if your data is seeing-limited (blurred due to adverse seeing conditions) you are now free to bin your data until exactly that limit and you are not forced by a fixed 2×2 or 4×4 mode to go beyond that.

Similarly, deconvolution (and subsequent recovery of detail that was lost due to atmospheric conditions) may not be a viable proposition due to the noisiness of an initial image. Binning may make deconvolution an option again. The StarTools Bin module allows you to determine the ratio whith which you use your oversampled data for binning and deconvolution to achieve a result that is finely tuned to your data and imaging circumstances of the night(s).

Data binning is a data pre-processing technique used to reduce the effects of minor observation errors. Many astrophotographers are familiar with the virtues of hardware binning. The latter pools the value of 4 (or more) CCD pixels before the final value is read. Because reading introduces noise by itself, pooling the value of 4 or more pixels reduces this 'read noise' also by a factor of 4 (one read is now sufficient, instead of having to do 4). Ofcourse, by pooling 4 pixels, the final resolution is also reduced by a factor of 4. There are many, many factors that influence hardware binning and Steve Cannistra has done a wonderful write-up on the subject on his starrywonders.com website. It also appears that the merits of hardware binning are heavily dependent on the instrument and the chip used.

Most OSCs (One-Shot-Color) and DSLR do not offer any sort of hardware binning in color, due to the presence of a Bayer matrix; binning adjacent pixels makes no sense, as they alternate in the color that they pick up. The best we can do in that case is create a grayscale blend out of them. So hardware binning is out of the question for these instruments.

So why does StarTools offer software binning? Firstly, because it allows us to trade resolution for noise reduction. By grouping multiple pixels into 1, a more accurate 'super pixel' is created that pools multiple measurements into one. Note that we are actually free to use any statistical reduction method that we want. Take for example this 2 by 2 patch of pixels;

7 7
3 7

A 'super pixel' that uses simple averaging yields (7 + 7 + 3 + 7) / 4 = 6. If we suppose the '3' is anomalous value due to noise and '7' is correct, then we can see here how the other 3 readings 'pull up' the average value to 6; pretty darn close to 7.

We could use a different statistical reduction method (for example taking the median of the 4 values) which would yield 7, etc. The important thing is that grouping values like this tends to filter out outliers and make your super pixel value more precise.

Binning and the loss of resolution

But what about the downside of losing resolution? That super high resolution may have actually been going to waste! If for example your CCD can resolve detail at 0.5 arcsecs per pixel, but your seeing is at best 2.0 arcsecs, then you effectively have 4 times more pixels than you need to record one 1 unit of real resolvable celestial detail. Your image will be "oversampled", meaning that you have allocated more resolution than the signal really will ever require. When that happens, you can zoom in into your data and you will notice that all fine detail looks blurry and smeared out over multiple pixels. And with the latest DSLRS having sensors that count 20 million pixels and up, you can bet that most of this resolution will be going to waste at even the most moderate magnification. Sensor resolution may be going up, but the atmosphere's resolution will forever remain the same - buying a higher resolution instrument will do nothing for the detail in your data in that case! This is also the reason why professional CCDs are typically much lower in resolution; the manufacturers rather use the surface area of the chip for coarser but more deeper, more precise CDD wells ('pixels') than squeezing in a lot of very imprecise (noisy) CCD wells (it has to be said the latter is a slight oversimplification of the various factors that determine photon collection, but it tends to hold).

Binning to undo the effects of debayering interpolation

There is one other reason to bin OSC and DSLR data to at least 25% of its original resolution; the presence of a bayer matrix means that (assuming an RGGB matrix) after applying a debayering (aka 'demosaicing') algorithm, 75% of all red pixels, 50% of all green pixels, and another 75% of all blue pixels are completely made up!

Granted, your 16MP camera may have a native resolution of 16 million pixels, however it has to divide these 16 million pixels up between the red, green and blue channels! Here is another very good reason why you might not want to keep your image at native resolution. Binning to 25% of native resolution will ensure that each pixel corresponds to one real recorded pixel in the red channel, one real recorded pixel in the blue channel and two pixels in the green channel (the latter yielding a 50% noise reduction in the green channel).

There are, however, instances where the interpolation can be undone if enough frames are available (through sub-pixel dithering) to have exposed all sub-pixels of the bayer matrix to real data in the scene (drizzling).

Fractional binning

StarTools' binning algorithm is a bit special in that it allows you to apply 'fractional' binning; you're not stuck with pre-determined factors (ex. 2x2, 3x3 or 4x4). You can bin exactly the amount that achieves a single unit of celestial detail in a single pixel. In order to see what that limit is, you simply keep reducing resolution until no blurriness can be detected when zooming into the image. Fine detail (not noise!) should look crisp. However, you may decide to leave a little bit of blurriness to see if you can bring out more detail using deconvolution.
Hope that helps!

Re: Oversampling - Not quite "getting" why it is a problem

Posted: Tue Jul 27, 2021 2:00 am
by ionia23
See, that's what's so strange about it. I read the same documentation before (very well written, too). It just seemed "the more squares you build a circle out of, the more smooth the edges become.

Well, not exactly. I think I might finally have it now. Sure, a star should fit in one pixel. Not through this atmosphere, no way.

I'm going to post some clippings from some grossly oversampled images I have where I show how the zoomed image of the star improves as I bin further down. It's not just light is being "smeared" over too many pixels, but at really high oversampling the stars themselves appear to be artifacting in really unusual ways, which I'm sure makes the StarTools algorithms lose their collective minds :)

I'm learning very quickly it's much easier to work with clean data than to repair bad data.

Oh but I really, really hope I'm not supposed to bin the images from my Orion Starshoot G4 OSC down to 25% of original resolution. Considering it's native resolution is 752 x 582.....oh my....

Re: Oversampling - Not quite "getting" why it is a problem

Posted: Tue Jul 27, 2021 4:26 pm
by hixx
Hi ionia23,
actually there is no "problem" with oversampling as such. The point is, it's a balance between resolution and SNR.
If your image has increased SNR due to Binning, most modules work better could be pushed further without creating artifacts and provide a better picture overall.
So here's the rub: the resulting picture would have a smaller resolution, hence you could not blow it up poster-size, because, as you said, you'd be looking at squares. But a star made up of 3x3 "squares" would still "look round" to the human eye if the viewing angle of the 3x3 "square" is below eye resolution. Now If your smallest detail (star) is let's say 6x6, you would be looking at ugly blobs when blowing the image up poster-size. As your resolution would be useless in that scenario, you could just as well increase the SNR, end up with 3x3 stars and end up with a smaller, but great image

With your camera's 752 X 582 resolution I hardly believe its a good candidate for binning - you will hardly have 6x6 pixel stars if focused and guided well. However with a modern DSLR of lets say 4000x6000 pixel resolution you might well run into oversampling pretty soon if your focal length is more than 1m or so. You can easily blow this up to 10x15 inch (20x30 cm) and still use a slight BIN of 70% or so, increasing SNR and bit depth.

Your setup (similar to mine) will hardly have too much oversampling on stars. I usually bin small stars down to 4x4 pixels only, to leave some headroom for DECON, but I usually get smallest stars below this limit, except for horrible seeing conditions, so often I do not need binning at all.

Bottom line: resolution is just one part, viewing size/angle the other part of the equation.
Hope this helps

clear skies,
jochen

Re: Oversampling - Not quite "getting" why it is a problem

Posted: Fri Jul 30, 2021 6:40 pm
by ionia23
All the tips have been great. It is making a bit more sense now since I can take into account the resolution capabilities of the telescope vs the capabilities of the deep space camera. The astronomy tools site has been a godsend for learning things.