PixInsight Forum

PixInsight => Bug Reports => Topic started by: Greg Schwimer on 2019 June 13 22:02:22

Title: HDRMT does not change image
Post by: Greg Schwimer on 2019 June 13 22:02:22
Saw this post:

https://pixinsight.com/forum/index.php?topic=13686.0 (https://pixinsight.com/forum/index.php?topic=13686.0)

I'm having the same problem. I can reproduce it on both OSX build 1456 and Linux build 1475. The key to reproducing it seems to be to enable median transform in HDRMT.

Update: The problem seems to occur with mono images. It otherwise operates on RGB and such.

Title: Re: HDRMT does not change image
Post by: Juan Conejero on 2019 June 14 01:29:19
Hi Greg,

I cannot reproduce this problem; HDRMT works normally with grayscale and color images in all of my tests. Can you upload an image where this can be reproduced? Can you share your HDRMT parameters?
Title: Re: HDRMT does not change image
Post by: bcstein12 on 2019 June 14 06:09:13
where do i upload the image
Title: Re: HDRMT does not change image
Post by: Greg Schwimer on 2019 June 14 08:46:57
Hi Juan,

Thanks for taking a look at this. Here is a sample image:


For HDRMT settings, I reset to default, enable "median transform". The rest is at defaults.

I ran a few scenarios and may have found something interesting. These are relative to the example I posted above (see attached for preview sizes):

 - Applying to full image - NO CHANGE
 - Applying to small preview #1 - WORKS
 - Applying to medium preview #1 - WORKS
 - Applying to large preview #3 - NO CHANGE
 - Applying to full-size preview - NO CHANGE

Noting that the problem seems to occur with the larger sized images, I cloned the full size image and resampled it to 50%. In this case HDRMT WORKS.

Everything works with median transform disabled, no matter the image size.

I ran these tests on Linux, build 1475. I saw similar behavior on OSX build 1457 as well, but didn't get to running this particular flow of tests.

- Greg
Title: Re: HDRMT does not change image
Post by: Juan Conejero on 2019 June 14 14:36:54
Hi Greg,

Thank you for uploading the image. This is not a bug, but just a limitation, or better a characteristic, of the HDR multiscale transform algorithm. This is a heavily stretched copy of your image:

(https://pixinsight.com/forum-images/20190614/hdrmt-problem-tn.png) (https://pixinsight.com/forum-images/20190614/hdrmt-problem-screenshot.png)
Click on the image for a full-size version (https://pixinsight.com/forum-images/20190614/hdrmt-problem-screenshot.png).

There are large-scale brightness variations on the background of this image, in particular at the bottom edge and at the top-left corner, that are changing dramatically the way HDRMT performs in this case, especially the median-HDRMT algorithm.

Because of the implemented multiscale analysis techniques, the HDRMT process is not strictly previewable. This means that, in general, there is no guarantee that the results achieved when applying the process to a given region of interest will be equivalent to the results achieved on the same region when the process is applied to the entire image. If you apply this process to small previews, you may get very different results with respect to the whole image. To get reasonably accurate and consistent results, the previews must be representative of the existing brightness distribution at the scale of the entire image.

The median-HDRMT algorithm is much more sensitive than the wavelet-HDRMT algorithm to large-scale variations, and this is why you are getting so different results on several previews. This is a limitation of the implemented processes. In this case you should probably use the wavelet-HDRMT algorithm, by disabling the median transform parameter, or you can try cropping the image as necessary for median-HDRMT to work as expected.

Sorry for these limitations, but they are a very small price to pay, IMHO, for the outstanding performance and versatility of these algorithms. The original HDRMT algorithm was created by PTeam member Vicent Peris, who made a fundamental contribution to PixInsight, as well as to the world of astronomical image processing in general. I devised median-HDRMT as a ringing-free variant of the same algorithm. In a future version of this tool we'll try to alleviate its sensitivity to large-scale variations, although this is not the easiest task.
Title: Re: HDRMT does not change image
Post by: Greg Schwimer on 2019 June 14 19:19:00
Ah, I see. Makes sense. Thanks much for having a look!