Author Topic: Deconvolution Preview Problems  (Read 6792 times)

Offline darkownt

  • PixInsight Enthusiast
  • **
  • Posts: 92
Deconvolution Preview Problems
« on: 2009 November 11 20:12:25 »
Hi:

I am getting some strange behavior when previewing deconvolution.

If I use a preview of a moderate size, say a few hundred by a few hundres pixels, and tune the global deringing just right for the preview, on a large image say 4000x2400 or so, the final result will be very different even though I apply the exact same settings.  The final result has a great deal more ringing than the small preview. 

If I create a preview which is the same hieght as the full image but thin (wxh of 100x2400) the same extreme ringing occurs.  If I create a preview with a short height but full width (wxh of 4000x100) the rining matches what I got with the small preview.

I think this happens for various settings but I was using Van Cittert (non regularized) with a custom (measured) PSF and standard deringing of .1700 was working for me in the small preview.

I'd like to have the preview represent the actual effect on the full image please!    :)

For now I have to guess (based on the tall skinny preview) what deringing settings work with the full image.


cheers
DO

Offline David Serrano

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 503
Re: Deconvolution Preview Problems
« Reply #1 on: 2009 November 12 00:29:57 »
Is working with a downsampled copy of the image an option?  (this also applies to HDRWT)
--
 David Serrano

Offline darkownt

  • PixInsight Enthusiast
  • **
  • Posts: 92
Re: Deconvolution Preview Problems
« Reply #2 on: 2009 November 12 11:10:52 »
Is working with a downsampled copy of the image an option?  (this also applies to HDRWT)

So far I am happy with the results applied to the entire image, I am only at a loss to predict them reliably because of the inconsistency in the previews.

I am willing to try any workaround in the interim but I doubt I will be working on final images which are any smaller.  If anything I am looking at larger images... I may have to use stitching programs to overcome some memory issues... but that is a different story.  As it turns out my PSF can resolve more detail when the image and PSF are both scaled UP in size (2x or 3x), deconvolution is run, and then rescaled down... settling at 1.5 the original res.  Subpixel information is often spread out by the PSF and can be recovered.  This however is completely off topic.

For now all I want is a preview which shows me what I will get!

cheers
DO

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Deconvolution Preview Problems
« Reply #3 on: 2009 November 12 11:31:04 »
Hi,

if you want people to take a closer look at this you may want to upload your image and psm file with the exact process you're applying.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline darkownt

  • PixInsight Enthusiast
  • **
  • Posts: 92
Re: Deconvolution Preview Problems
« Reply #4 on: 2009 November 12 20:14:57 »
Hi,

if you want people to take a closer look at this you may want to upload your image and psm file with the exact process you're applying.

Yes, it is always useful in these situations to provide enough so that the problem can be recreated.

I have been investigating further, and there is some good news and some bad news.

The good news: the problem can easily be recreated by anyone
The bad news: the problem can easily be recreated by anyone
:)


Steps to recreate the preview problem:
1)  Find an image of ANY size
2)  Create a first preview about 1/10th (or smaller) the width and height of the image
3)  Choose ANY deconvolution or restoration method
4)  Choose ANY PSF custom OR generated Gaussian, and set the iterations and the size to ensure that some detailed ringing is created when deringing is set to 0 (or unselected).
5)  Turn on and slowly increase the deringing to just eliminate the ringing in the preview.  Study the preview carefully.
6)  Create a second preview of the same width and the entire height of the image or some other large size (1/4) of the image etc.
7)  Apply the exact same deconvolution to the second preview. Study this preview carefully.
8)  Apply the exact same decon to the full image and compare result with the two previews

Once again this occurs for an image of any size if the preview is a small enough fraction of it.


For now, my "work-around" is to use larger previews.... but my trust in the preview being an actual preview... has been shaken.


cheers
DO

PS: Should I add this to a bug thread or a features request thread?


Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Deconvolution Preview Problems
« Reply #5 on: 2009 November 12 21:27:27 »
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Deconvolution Preview Problems
« Reply #6 on: 2009 November 13 02:49:17 »
Hi DO (your actual name?)

Welcome to PixInsight Forum.

I understand your complains, and trust me that I can feel your pain, especially if your images are very large. There is no bug here, but actually a limitation of some of the algorithms involved.

The global deringing algorithm in Deconvolution (and in a few other tools that share the same deringing techniques, as ATrousWaveletTransform, HDRWaveletTransform, UnsharpMask and RestorationFilter) works, as its name suggests, by analyzing data from the whole image. But this isn't, by itself, the actual problem. After all, we could analyze data from a preview's parent image "behind the scenes" to provide an accurate representation of the final result. Some tools already do this in PixInsight. The problem is that ringing is a very complex phenomenon which we cannot predict, especially ringing generated during sophisticated procedures such as deconvolution and HDR wavelet transforms. So we are unable to know what the ringing would be if the same process were applied to the preview's parent image, without actually applying the whole process, which obviously isn't an option.

So what we are facing here is, strictly speaking, a non-previewable algorithm. That said, the situation is usually much better than what you are experiencing. In most cases, a small preview can be used to fine tune deringing parameters very accurately. For example, I've just made a test with a nice image of the M81/M82 region by Oriol Lehmkhul and Ivette Rodríguez:

http://forum-images.pixinsight.com/legacy/decon-previews/01.jpg

As you see, Preview01 is our small preview (some 600x600 px), where we can try out deconvolution very quickly. Preview02 is a nearly full-size preview, but note how I haven't included the dark border artifacts that result from partial coverage after registration, especially the black column at the left edge. These dark artifacts can cause a lot of problems with many algorithms that depend on image statistics, and in general must be avoided or cropped.

This is the small preview before deconvolution:

http://forum-images.pixinsight.com/legacy/decon-previews/02.jpg

Note the strong STF being applied, since the image is of course linear (or Deconvolution wouldn't make any sense). This is the small preview after deconvolution, including global deringing:

http://forum-images.pixinsight.com/legacy/decon-previews/03.jpg

In this case deringing could be improved with a (very easy to build) star mask used as a local deringing support, especially to get rid of those residual rings around bright stars within M81. Anyway, let's stay on-topic; this is the large preview after the same deconvolution:

http://forum-images.pixinsight.com/legacy/decon-previews/04.jpg

Can you see any difference between 03 and 04? Virtually none, neither in deringing nor in deconvolution regularization. This happens because both previews share the same image structures, from a multiscale point of view. More simply put, both previews comprise the same range of brightness at the same scales. M81 is the largest and brightest structure in this image, and it is present in both previews. On the other hand, the small preview contains stars that are nearly as bright as the brightest stars in the image (stars are critical for deringing).

Previews are extremely useful tools in PixInsight, but they are not perfect, nor can they work accurately in all situations. This is especially true with algorithms that depend on large-scale properties, such as some multiscale algorithms, and algorithms that depend on global brightness distributions. If your image is giving you more problems than the example I've put above, then now you know the cause: your small previews are not representative of the image at large scales. If we could see the image in question, we could try to further help you, and we could also learn from your particular problem, which is of great help to improve our implementations.
« Last Edit: 2009 November 13 03:04:11 by Juan Conejero »
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline darkownt

  • PixInsight Enthusiast
  • **
  • Posts: 92
Re: Deconvolution Preview Problems
« Reply #7 on: 2009 November 16 11:23:32 »
Thank you very much for the in-depth explanation Juan.

Understanding how decon works along with the limits of its application will prove quite useful. 

I have started to use larger previews which contain various structures (at various scales) that appear in the final image.  These larger previews are very close to what the final result is.  It does take longer (tiny previews had me spoiled to some degree), but the results are worth it.

Just out of curiousity, are there implementations of other deconvolution methods in the works?  Blind deconvolution?

I have dabblied with a few tools I found which do various forms of deconvolution, ImageAnalyzer is interesting and capable for circular blur decon, I have AstaImage (which is ok), but I must say that the free BiAlith software by Mr. Tadrous, although very awkward to use, has some decon algorithms which are amazing.  See the step-by-step moon decon example on the web page www.bialith.com.  (As you know I finally chose PixInsight and laid down my cash for it because it is just so robust and powerful!!  :)  )

Even though decon is useful, I am still trying to refine the PSM I "measured" using rudimentary methods.  I am most earnestly trying to find blind deconvoution algorithms, or more simply, software processes to determine PSFs from edges or boundaries or a test card.  The point sources I set up to generate my PSF come from a backlit card covered with metal foil with pin holes in it... I make many of those holes, take several pictures, align them and take an average, but I am afraid the average is causing the "measured" PSF distribution to spread somewhat and hence is not an actual representation of the true PSF...anyhow, just wondering if there is anything in the works that could help me measure/generate PSFs and if there are any other decon algorithms in the pipe!   :)

cheers
Colin


Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Deconvolution Preview Problems
« Reply #8 on: 2009 November 16 13:27:46 »
Hi Colin,

Thank you!

Quote
Just out of curiousity, are there implementations of other deconvolution methods in the works?  Blind deconvolution?

Not currently, although we are always ready to focus our interest on new projects related to deconvolution, as this is a crucial topic.

Personally, I don't like too much the idea of blind deconvolution applied to astronomical images, especially to deep-sky images. After all, we have no problems to measure our PSFs very accurately, as we usually have lots of point sources at hand :) Perhaps blind deconvolution can be more applicable to planetary images, and of course it is of great interest for non-astronomical images.

Quote
software processes to determine PSFs from edges or boundaries or a test card.

From this sentence I think that you aren't working with astronomical images, right? Then I understand why you're looking for a blind deconvolution routine, since deriving a PSF from edges or non-point-like features is difficult.

Quote
The point sources I set up to generate my PSF come from a backlit card covered with metal foil with pin holes in it... I make many of those holes, take several pictures, align them and take an average

Could you elaborate more on the specific imaging tasks you're working on? This sounds like the kind of things that can "excite" us to start new development projects.

Quote
the free BiAlith software by Mr. Tadrous, although very awkward to use, has some decon algorithms which are amazing.

I completely agree. It would be extremely nice to have Mr. Tadrous porting his algorithms to the PixInsight platform. I don't know how he has implemented them, but I'd be more than happy to help him in that task. As you probably know, we provide a free development framework (the PixInsight Class Library, PCL) that any developer can use to write new image processing tools as PixInsight modules. From this perspective, the modular design of PixInsight makes it look more like an operating system than as an application.

I can write to Dr. Tadrous to make him a proposal, but if you as a user of his freeware programs can "push" him to port his work to PixInsight/PCL, we perhaps would have more possibilities of success. Do you think this makes any sense?

Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline darkownt

  • PixInsight Enthusiast
  • **
  • Posts: 92
Re: Deconvolution Preview Problems
« Reply #9 on: 2009 November 17 06:18:40 »
Quote
From this sentence I think that you aren't working with astronomical images, right?

I'm working mostly with terrestrial images and a few lunar ones.

Quote
Could you elaborate more on the specific imaging tasks you're working on?

I have been very interested in wrestling truth from images on a hobbyist level.  I have been disappointed with oversharpening and non-truth in processing images using traditional graphics software for some time.  I used MagicFocus for a time, and FocusFixer V2 is pretty good... I have a technical interest and I'm a perfectionist which causes me great trouble... :)

I've been mostly looking at deconvolution, integration, and supersampling.  I use Photoacute which does a pretty good job of supersampling given the lens data of the photographs taken (once again terrestrial) such as what lens, depth of field, and f-stop.  I assume they use measured lens characteristics.  But I think RL decon could improve the images (one can select a generic with no lens characteristics to do the integration or supersampling so that the data is still "true" when RL is applied in pixinsight)

Right now I am struggling with estimating and/or measuring the PSF for the camera at a specific zoom and f-stop (starting with just one combination for now), and I've been hoping that there is some method/algorithm to do so without using only point sources.  Hmm I just had an idea...

Quote
This sounds like the kind of things that can "excite" us to start new development projects.

As sad as it is that I have a technical obsession such that if things were perfect I'd be relieved and satsfied, I am happy if such a thing as excitement could result from it!  :)

Quote
I can write to Dr. Tadrous to make him a proposal, but if you as a user of his freeware programs can "push" him to port his work to PixInsight/PCL, we perhaps would have more possibilities of success. Do you think this makes any sense?
 

I don't know Mr. Tadrous personally, and I dont think the mere fact that I used his free software would help any but I think as a programmer who went to lengths to put the power of finding truth in the hands of people for free, there would be a good chance of his working with you or at least letting you use his code, or integrate/interface with it... but I am just guessing.  For certain I would guess he would want acknowledgement (maybe even some royalties?) , and mainatain the ability to distribute his free software and such.  I hope something can be done to integrate his software, or maybe his work will just inspire your team!! ;) .

cheers
Colin