Author Topic: New DrizzleIntegration Tool Released  (Read 95752 times)

Offline jerryyyyy

  • PixInsight Old Hand
  • ****
  • Posts: 425
    • Astrobin Images
Re: New DrizzleIntegration Tool Released
« Reply #15 on: 2014 June 02 05:02:41 »
...Can someone explain to me why the new files are 4x larger?
Images are twice the size in X, and twice the size in Y, and 2*2=4  :)
Georg

Yes I see that, I assume the math projects the computations out into a large workspace.  To me seem a little like interpolation of data between existing pixels. 
Takahashi 180ED
Astrophysics Mach1
SBIG STT-8300M and Nikon D800
PixInsight Maxim DL 6 CCDComander TheSkyX FocusMax

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: New DrizzleIntegration Tool Released
« Reply #16 on: 2014 June 02 05:27:30 »
Not really interpolation.  You may want to browse the reference in the announcing article: even without understanding all the details it gives a good feeling of what happens.  It really takes advantage of the exact location of the image to find where the pixel should land - which should be statistically correct (assuming your image is indeed undersampled).
-- bitli

Offline IanL

  • PixInsight Addict
  • ***
  • Posts: 116
    • The Imaging Toolbox
Re: New DrizzleIntegration Tool Released
« Reply #17 on: 2014 June 02 06:03:54 »
Yes I see that, I assume the math projects the computations out into a large workspace.  To me seem a little like interpolation of data between existing pixels.

No, interpolation is a process of estimating new data points using existing ones. So the Resample process (http://pixinsight.com/doc/tools/Resample/Resample.html) can be used to make an image larger.  It has a number of different interpolation algorithms (http://pixinsight.com/doc/docs/InterpolationAlgorithms/InterpolationAlgorithms.html) to estimate the missing data for the new pixels by reference to data in the existing ones.

Any such up-scaled image will contain artefacts that are more or less noticeable depending on the scaling factor and the algorithm used.  This is unsurprising since the additional pixels have been estimated and aren't real data.

The drizzle algorithm doesn't estimate new data points at all.  It extracts real data from your set of samples (multiple subframes) to populate the additional pixels that you wish to create.  It can do this provided:

- The image is undersampled, i.e. the number of arcseconds per pixel achieved by the optical system and camera has to be lower than the resolving power of the optical system.  Put more simply, the camera pixels have to be larger than the optimum for the scope or lens, which is often the case with short focal length refractors and camera lenses, but conversely long focal length scopes may be oversampled by the camera, in which case you already have all the information you're ever going to get out of the image.  You can't beat the laws of physics here!

- You need to dither the subframes, so the pixels in each sub do not cover the exactly same part of the sky.  It is important that the dithering is not an exact number of pixels, because if the 'footprint' of each pixel on the sky exactly overlaps the footprints of pixels in the other subs you cannot obtain the extra information that you want.  So your dithering process needs to re-point the imaging scope by a random amount of pixels plus a random fraction of a pixel each time.  Dithering in most guiding/imaging applications will try to do this by default, but even yours it doesn't, in practice I defy you to successfully dither by a precise number of whole pixels between each sub!  Mount gearing flaws and field rotation due to imperfect polar alignment will usually do a good enough job of creating the random fractions of a pixel between frames that you need for this to work.

- You need lots of subframes.  Dithering isn't 'free data'.  Put simply you are taking the total signal you have captured in your set of subs, and spreading it across four times as many pixels, so you can expect the final image to be noisier. Think about the reverse; if you have a relatively noisy image and downscale it to half its original dimensions, it will look a lot less noisy at the cost of a lower resolution, since you've averaged four pixels in to every one so you have four times as many samples per pixel.

If you have met the under-sampling and sub-pixel dithering requirements, the pixels in each sub will contain signal from slightly different parts of the target each time.  The pixels therefore contain information which has been resolved by the optical system but not by the camera (it has been 'averaged' together by the sensor element for a pixel) and so of course there is no means to access that data in a single sub.  The drizzling algorithm works out the slight differences in pointing between subs and (effectively) aligns the subs at the higher (e.g. 2x) resolution.  It then "de-averages" the missing data from the oversampled big pixels in to the new smaller ones using the drizzle algorithm.

There is no magic at work here, you have taken multiple samples of the target and the unresolved details end up in different pixels each time.  By slicing the big pixels in to smaller ones and then playing a bit of "3D Sudoku" with the resulting stacks of smaller pixels, you can figure out what the missing numbers should be. (I know neither "de-averaging" nor "3D Sudoku" is a literally accurate analogy of the process, but just trying to illustrate that you can deduce apparently missing information under the right conditions).

The increase in file size should be no surprise of course.  You've created an image which is double the resolution of the original images, so you have four times as many pixels (per the explanation above) and thus an uncompressed file will be four times the size on disk.  It also means that you have to perform subsequent processing on images that are four times bigger in memory/on disk, which is worth bearing in mind!
« Last Edit: 2014 June 02 06:54:29 by IanL »

Offline themongoose85

  • Newcomer
  • Posts: 23
Re: New DrizzleIntegration Tool Released
« Reply #18 on: 2014 June 02 08:55:31 »
PI has hung for me during ImageIntegration on "Updating drizzle data files" and has become unresponsive I am letting it go to see if it completes.

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: New DrizzleIntegration Tool Released
« Reply #19 on: 2014 June 02 09:31:51 »
PI has hung for me during ImageIntegration on "Updating drizzle data files" and has become unresponsive I am letting it go to see if it completes.
Check if you are short of RAM (for instance via task manager). Drizzle needs a lot.
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline themongoose85

  • Newcomer
  • Posts: 23
Re: New DrizzleIntegration Tool Released
« Reply #20 on: 2014 June 02 09:45:07 »
PI has hung for me during ImageIntegration on "Updating drizzle data files" and has become unresponsive I am letting it go to see if it completes.
Check if you are short of RAM (for instance via task manager). Drizzle needs a lot.

Yeah I checked and I was only using about 55% of my total physical memory so I am not sure it was that. I killed PI and restarted it. I am just doing a stack without drizzle now to make sure it works and then I'll try adding in drizzle again and see what happens.

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: New DrizzleIntegration Tool Released
« Reply #21 on: 2014 June 02 09:47:15 »
Which OS do you use? How much RAM has your system?
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline whwang

  • Member
  • *
  • Posts: 62
Re: New DrizzleIntegration Tool Released
« Reply #22 on: 2014 June 02 09:50:47 »
Hi,

It's great to see this function implemented in PI. To really see how it works, we should use some clearly under-sampled images in a crowded field, and compare results of:
a. normally integrated image
b. drizzle (2x for example) integrated image
c. 2x oversampled (no drizzle) and then integrated image
I will see if I can find time to do this.

I also like the suggestion made by Astrocava.  This is quite essential to get high-quality results from DSLRs.  At this moment, it is implemented by DSS (called Bayer drizzle), but DSS is an old tool.  It will be great if PI can have this function.

Cheers,
Wei-Hao

Offline themongoose85

  • Newcomer
  • Posts: 23
Re: New DrizzleIntegration Tool Released
« Reply #23 on: 2014 June 02 10:28:15 »
Georg I am using Win 7 Pro with a core i5 2500K and 12GB of ram. It stacked fine without selecting Generate Drizzle in ImageIntegration. I am trying again with it selected to see if it completes.

EDIT: PI is still hanging updating the drizzle files but when I refresh the folder I see the drizzle files growing in size so I am going to leave it for a while to see if it completes.

EDIT2: Moving the files off my media server and onto my local hard drive solved the problem. The drizzle data files updated a lot faster.
« Last Edit: 2014 June 02 11:25:17 by themongoose85 »

Offline ftherrmann

  • PixInsight Enthusiast
  • **
  • Posts: 83
Re: New DrizzleIntegration Tool Released
« Reply #24 on: 2014 June 02 23:21:25 »
I upgraded to the latest version this afternoon.  (.1071)  and I don't see any drizzle options in the Star Alignment or Image integration processes. 

Is there a switch that I need to turn on?   What am I missing?

Thank you,

Fred

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: New DrizzleIntegration Tool Released
« Reply #25 on: 2014 June 03 02:17:46 »
Last version is 1092 (from memory), are you sure you are not on one of the RC or something like that.  Maybe you should download a fresh one from the site.
-- bitli

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: New DrizzleIntegration Tool Released
« Reply #26 on: 2014 June 03 02:37:39 »
Yes I see that, I assume the math projects the computations out into a large workspace.  To me seem a little like interpolation of data between existing pixels.

No, interpolation is a process of estimating new data points using existing ones. ...

Hi Ian,

Fantastic post and a very nice description of drizzle!
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: New DrizzleIntegration Tool Released
« Reply #27 on: 2014 June 03 02:42:07 »
I'm thinking how to use this new tool with OSC (DSLR) images. DSRL images are spatially under sampled in origin because each channel has only half of the pixels.

Hi Sergio,

I am working on this right now. The current tool set can be used without changes to implement Dave Coffin's Bayer drizzle technique very easily. It can be integrated in the BPP script.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Ignacio

  • PixInsight Old Hand
  • ****
  • Posts: 375
    • PampaSkies
Re: New DrizzleIntegration Tool Released
« Reply #28 on: 2014 June 03 04:24:07 »
I'm thinking how to use this new tool with OSC (DSLR) images. DSRL images are spatially under sampled in origin because each channel has only half of the pixels.

Hi Sergio,

I am working on this right now. The current tool set can be used without changes to implement Dave Coffin's Bayer drizzle technique very easily. It can be integrated in the BPP script.

Excellent news, Juan! Are you working on a PI implementation of Bayer Drizzle, or an improved variation of it? Is Sergio´s proposed approach using SplitCFA the best one?

Ignacio

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: New DrizzleIntegration Tool Released
« Reply #29 on: 2014 June 03 04:59:22 »
Bayer drizzle is pretty straightforward. One complication is the fact that CFA calibrated images have to be debayered prior to registration and pre-integration, but DrizzleIntegration has to have access to the CFA images. This can be solved by means of a little trick: replace the file names to which .drz files point to (which are debayered images) by the original CFA images. The other complication is that CFA images have to be split into separate RGB components in order to drizzle them, but we already have this: just load the CFA data as raw Bayer images. So the implementation looks like this:

1. Load a calibrated CFA image as a monochrome raw Bayer image.

2. Optionally, apply CosmeticCorrection.

3. Make a duplicate of the calibrated (and possibly cosmetized) CFA image and transform it to an RGB raw Bayer image (that is, split the RGB components as three channels). Save this RGB image in FITS format.

4. Apply Debayer to get an interpolated RGB image and save it in FITS format.

5. Apply StarAlignment to register the RGB image and save it. The generate drizzle data option of SA is enabled in this step.

6. Open the .drz file generated in step 5 and replace the file path (which points to the debayered image that StarAlignment has worked with) with the path to the RGB image that was saved in step 3. Save the modified .drz replacing the original data file.

7. Repeat steps 1-6 for all images in the batch task.

Now you can use ImageIntegration (with the registered images and the .drz files) and DrizzleIntegration (with the .drz files) in the usual way. The drizzle process will work with the original CFA data, not with interpolated data. This is the Bayer drizzle algorithm.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/