Author Topic: Script to set midtone values across large image sets - for HDRComposition  (Read 9715 times)

astropixel

  • Guest
I'm almost afraid to ask this question. As it hasn't been asked, I'm going to anyway. I'm a Linux user, so Registax, DSS and other stacking programs are out of the question, or don't perform all that well. I don't use Wine.

I have 30 calibrated lunar images, all of approximately the same exposure. I want to combine them, but can't find a way to align and integrate with II.

HDRComposition doesn't work with same/similar exposure images. Applying +/- midtone values to the images (3 at this stage) works quite well, with adjustment of the binarizing value.

It's tedious to adjust the midtone value of 30 images, and it's necessary to know the minimum difference of midtone value that HDRC will accept - and how many images can be processed before reaching upper and lower practical limits.

Perhaps a script that iteratively sets minimum midtone values, acceptable to HDRC, across a set of images may have limited use, but would be quite useful at times.

A better way? Or, how would I go about adapting a batch conversion script to perform this function. I have limited knowlege of C++ - and I mean limited. I can read an understand scripts, and have written one or two.

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
the moon is probably bright enough that "traditional" tools may work well. have you looked at enfuse and align_image_stack?


astropixel

  • Guest
I've used them quite a bit.  The problem with align_image_stack is that it doesn't always work well. Otherwise pfstools, or Qtpfs would be a reliable option. Alternatively, crop all the images so that alignment isn't too challenging for the program. It's a time consuming process either way. Now that I think of it, a batch cropping tool might be just as handy.

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Hi,

Have you tried with the FFTRegistration script? It should be able to align and integrate your images (by averaging them), and you don't need to adjust the midtones. In this script, don't enable the rotation and scaling corrections because they are experimental options that usually don't work correctly.

Forget about HDRComposition: it won't work at all if your images have similar exposures.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

astropixel

  • Guest
Juan. To be perfectly honest, no! I'll try it out.

astropixel

  • Guest
FFTRegistration is not aligning the images.

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
FFTRegistration is not aligning the images.

Could you upload a couple of them somewhere, so I can try?
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

astropixel

  • Guest
Thanks Juan. Done. Sent email with ftp login to info<at>pleiades<dot>com. 3 x jpeg. fits are way too big and result is the same with FFTR.
« Last Edit: 2011 January 26 04:33:48 by Pleiades »

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Hi Rowland,

Indeed, the script doesn't work well with the default configuration. However it registers your three JPEG images nicely with a small modification:

- Open the Process Explorer window.

- Expand the Scripts > Utilities category.

- Right-click on the FFTRegistration script.

- Select Edit Script.

- Now you have FFTRegistration.js open in the Script Editor. On line # 191 and 192 you'll see the following code:

      //var P = Image.crossPowerSpectrumMatrix( this.c0, c1 );
      var P = Image.phaseCorrelationMatrix( this.c0, c1 );

You just have to comment the second line (192) and uncomment the first one (191) so the code looks like this:

      var P = Image.crossPowerSpectrumMatrix( this.c0, c1 );
      //var P = Image.phaseCorrelationMatrix( this.c0, c1 );

That's all. Now save the script or just run it by pressing F9 (when you run a modified script it is saved automatically). It works perfectly with default parameters, at least with the three JPEG images you've uploaded for me. There's no reason it shouldn't work with 30 or 300, 3000 images ...

Let me know how it goes.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

astropixel

  • Guest
Hi Juan. Very close!

The top image - 10 frames aligned perfectly.

Bottom left - the next 10 frames ?

Bottom right - the last 8 frames

The other screen shot shows the whole stack relative to each other.
« Last Edit: 2011 January 27 01:40:35 by astropixel »

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Rowland,

If it isn't asking for too much, could you upload the images? I am very interested in this set to improve the FFTRegistration script. This is important for two reasons: the script should never fail under these conditions, and I am working on a new tool for FFT-based image registration.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

astropixel

  • Guest
Will do. I've since posted different images that I think are more useful - my previous post.

same login details - tar.gz 16.1mb

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
I am trying to use this script but it crashes. The test were done in Vista 32bits and Win7 64.

The text in the console is this:
Quote
run --execute-mode=auto "C:/Program Files/PixInsight/src/scripts/FFTRegistration.js"

Processing script file: C:/Program Files/PixInsight/src/scripts/FFTRegistration.js

*****************************************
FFT Image Registration Script
Copyright © 2005-2009 Pleiades Astrophoto
*****************************************

=== Initializing FFT registration engine ===

Reading image:
F:/Astro/Eclipse/IMG_4006.TIF
Reading TIFF: 16-bit integers, 3 channel(s), 3888x2592 pixels, chunky: 100%
*** Initializing FFT translation:
FFT: 100%

=== Registering image 1 of 1 ===

Reading image:
F:/Astro/Eclipse/IMG_4007.TIF
Reading TIFF: 16-bit integers, 3 channel(s), 3888x2592 pixels, chunky: 100%
*** Evaluating FFT translation:
FFT: 100%
Inverse FFT: 100%
Rescaling pixel values: 100%
*** Translation corrections:
dx :    -0.25 px
dy :    -2.55 px
*** Applying translation:
Translate dx=-0.254, dy=-2.552, Bicubic Spline Interpolation, c=0.30: 100%
*** Error [000]: C:/Program Files/PixInsight/src/scripts/FFTRegistration.js, line 277: At address 772466AB with exception code C0000005 :
Access violation: invalid memory read operation at address 10B3001F

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Hi Rowland,

Thanks for uploading the images. They have been very useful. I've made a modification to the FFTRegistration script (attached to this post), which now aligns your 28 lunar images without problems, as expected.

One of the problems was that your images have a hot pixel artifact centered at x=1368 y=2017. FFT-based image registration is very sensitive to high-frequency features. As this artifact is very small and bright, the script was registering some images on it, thus giving nearly zero translation increments. Fixing this artifact is a good idea if it lies outside the main object of interest, as happens with these images, which can be done very easily with CloneStamp and ImageContainer. However this artifact is no longer a problem with the modified version of the script.

This new version of the script prefilters the images with an edge detection routine. This routine works both as a high-pass filter and a normalization filter, so the FFT algorithm is much more robust for detection of significant structures. This modified script should work much better on lunar and planetary images, but much worse on deep sky images, in general. No big problem since we have much better and accurate tools for registration of deep-sky images.

Let me know how it works.

Disclaimer: The attached script is experimental. Feel free to use and test it but this is not an official release.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Hi Andrés,

Quote
I am trying to use this script but it crashes.

I've seen other people having similar problems before, but I can't reproduce this bug. Could you please upload a couple images that cause this problem, so I can reproduce and understand it?
Juan Conejero
PixInsight Development Team
http://pixinsight.com/