Author Topic: FFTRegistration problem with full disk sun images  (Read 5771 times)

Offline gerlos

  • Newcomer
  • Posts: 14
FFTRegistration problem with full disk sun images
« on: 2016 May 20 02:54:18 »
Hello,
During last transit of Mercury I shot ~350 frames of the Sun using a Canon 550D DSLR and a 130mm f/5 scope. My mount alignment was poor, and during capture I needed to move it several times to keep the Sun in frame.

I want to make a time lapse of the event, and hoped to be able to align my shots using FFTRegistration script in PI, but it doesn't seem to work for me.

I loaded the images in FFTRegistration script, picked a reference image, and ticked "write registered images", but in processed pics the Sun is still in different positions. I tried also to tick "enable large translation" option, but didn't help. I can't get it work even picking on a small group of images.

Is it a bug?

Here's a subset of the images I'm trying to align (just 20 of them, ~140MB):
https://www.dropbox.com/s/562lvvjx1owswjm/FFTRegistrationProblem.zip?dl=0

About the images: I shot in RAW and tuned the images using Adobe Lightroom. After that I exported them as 16 bit TIFF images and fed to FFTRegistration script on PixInsight. The image resolution is 5184x3456 px, and the disk of the Sun fill about 1/3 of the fame height.

I tried to align the images running PixInsight 01.08 both on Mac OS X 10.10 and Ubuntu 15.10, with the same results.   :sad:

What should I do?

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: FFTRegistration problem with full disk sun images
« Reply #1 on: 2016 May 20 09:48:39 »
don't know the answer to your question, but when i shot an eclipse i had kind of the same problem. so what i did was to manually crop each image (was not too hard since several in a row had the sun in roughly the same place on the sensor) and then load the crops into FFTRegistration.

rob

Offline gerlos

  • Newcomer
  • Posts: 14
Re: FFTRegistration problem with full disk sun images
« Reply #2 on: 2016 May 21 08:30:05 »
when i shot an eclipse i had kind of the same problem. so what i did was to manually crop each image (was not too hard since several in a row had the sun in roughly the same place on the sensor) and then load the crops into FFTRegistration.

Thanks for your answer.
Have you a rough idea how much empty space should I leave around the Sun crop to let FFTRegistration work as intended? I'm batch cropping my shots, but lots of them require manual action from me, because there was a lot of drift in the N-S direction.

Anyway, for now I worked around the problem running PIPP under Wine on Ubuntu, but I'd prefer to be able to use PixInsight natively.

regards
gerlos

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: FFTRegistration problem with full disk sun images
« Reply #3 on: 2016 May 21 09:31:57 »
probably the images were about 2 sun diameters tall and 2 sun diameters wide.

since LR has cut/paste of crop settings it all went pretty quickly.

rob

Offline gerlos

  • Newcomer
  • Posts: 14
Re: FFTRegistration problem with full disk sun images
« Reply #4 on: 2016 May 22 05:14:48 »
I cropped my shots and feeded again to FFTRegistration script, with no luck  :(

Here's what I get when I stack 20 of my 350 shots.
As you can see, shots don't seem aligned (I edited and cropped this image to make easier to see the problem).

So for some reason FFTRegistration script doesn't work for me...

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: FFTRegistration problem with full disk sun images
« Reply #5 on: 2016 May 22 09:35:38 »
it may be that there is just not enough detail / high frequency component for the FFT to really find structures to register on?

rob

Offline gerlos

  • Newcomer
  • Posts: 14
Re: FFTRegistration problem with full disk sun images
« Reply #6 on: 2016 May 23 01:47:02 »
it may be that there is just not enough detail / high frequency component for the FFT to really find structures to register on?

You're right.
There are only few details on the images indeed: one sunspot group and a couple of faculae (and Mercury, but it is moving from shot to shot). There was bad weather and granulation wasn't visible in every shot.

-gerlos

Offline IanL

  • PixInsight Addict
  • ***
  • Posts: 116
    • The Imaging Toolbox
Re: FFTRegistration problem with full disk sun images
« Reply #7 on: 2016 May 23 07:20:24 »
I have similar issues creating solar animations. As I see it the causes are any combination of:

- Moderate to severe drift between frames. Polar alignment is difficult during the day, even with drilled marks on concrete and a previously aligned mount, impossible to get right with a portable setup. Gets worse with longer focal lengths. If I have time I try to tweak the alignment by monitoring the drift but take a lot of time. Guiding on a sunspot using FireCapture can help but not 100% reliable and gets worse with longer focal lengths.

-Field rotation due to misalignment. See above.

-Variable quality and detail depending on seeing and cloud. Rare that I will get no cloud or haze over three hours or more of captures.

- Rotation of the Sun moves features across the disk and changes their apparent shape due to projection. Worst near the limb and at longer focal lengths. Typically one is shooting 1,000 frames at 30 second intervals for 2 or more hours at a minimum so rotation is very apparent even at 1,200mm focal length.

- Surface details change shape, position and brightness over time (rapidly or slowly depending on the feature).

The stacking software (E.g. AS!2) does a fairly good job of producing individual output frames from the input movies but adds own problems:

- Each frame will have a slightly different distortion model which causes features to shimmer or jitter between frames.

- Particularly maddening is that one can either maximise the output to the entire area covered by the input frames, or minimise to the common area covered by al frames. This is for one stack, so if processing a batch of 60 to 100 files, each output frame will have potentially different dimensions by a few or many pixels. This makes subsequent cropping and alignment operations painful. Haven't found a way to enforce frame size across a batch.

- Whole disks can usually be handled by some combination of PIPP and/or Imgpp to get all the frames to the same dimensions and alignment either using feature or COG type alignment and AOI cropping but a few frames always fail even if they look good by eye.

- Close ups without a limb are usually okay with feature alignment.

- It is the close ups with a limb in view that are hard work. I have just about got my Mercury transit with prom aligned after hours of trial and error in the above tools plus a bit of dynamic cropping in PI for really badly drifted frames. In the end I used feature alignment (PIPP) on the planet and allowed the Sun to move across the frame in the background as the only solution that worked.

- I have had no success with FFTRegistration so far, even with a subset of frames containing lots of features and absent any of the issues above.

Once I have aligned frames PI come in to its own. I typically use LinearFit to try to get even brightness across all frames. Deconvolution works well, as does LocalHistogramEqualisation, followed by HistogramTransformation and Curves to make a false colour image.

The main things I am considering for my own workflow are:

- Writing a script to generate masks as the disk and chromosphere/proms need different amounts of histogram stretch. At the moment I am using RangeSelection to create a mask with dilation/erosion and ATWT to tidy it up and soften the hard edge. It can be hard to get the right value for the lower bound of the range as and the disk and chromosphere tend to blur in to each other. It is also problematic on full disks in Ha as the illumination may be subtly different from one limb to the other due to banding or a sweet spot in the Etalon, so creating a lop-sided mask. Basically requires a lot of trial and error to get right and thus not ideal for lots of frames with slightly different brightnesses.

So I was thinking of generating a circular mask using the three points on the circumference method, perhaps with interactive previews of the image and mask, plus close ups of the alignment points. Entirely justifiable to do a bit of "painting" given the Sun is spherical to within 8 milliarcseconds. Not sure how responsive a script-based interactive preview would be but worth a try.

- Similarly an interactive absolute cropping script (with batch support). I was slightly astounded to find that none of the tools in PI (or outside of it that I have installed) can take a batch of aligned images and crop or pad them to the absolute same dimensions (relative to the centre or a corner). Everything seems to work to rescale or crop relative to the size of the input image which is no use for creating an animation. Maybe I missed something but I don't think so.

- A script for interactively aligning images manually by nudging them up/down/left/right (using side by side views or semi-transparent overlays). The concept is relatively trivial but again not sure how quickly a script would operate and I am not going to be able to write a PCL implementation. It does seem to me to be the only way of minimising jitter between frames and nothing else I have can do this job.

I'll see what I can do but it will likely be months before anything appears so don't hold your breath!

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: FFTRegistration problem with full disk sun images
« Reply #8 on: 2016 May 23 11:09:54 »
Hi gerlos,

Try with the modified version of the script I have attached to this post. It registers all of the images you have uploaded without problems.

FFT registration is very sensitive to low-frequency image components, which can cause many problems with noisy images without well defined borders. I have modified the original algorithm to improve border detection and make it less sensitive to large-scale noisy structures. I'll release this new version as an official update after some more testing, but you can use it now to register your images. Let me know if you find further problems.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Alejandro Tombolini

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1267
    • Próxima Sur
Re: FFTRegistration problem with full disk sun images
« Reply #9 on: 2016 May 24 14:57:36 »
Hi Gerlos, the method that I use is with FFTRegister Module and it works like a charm with the Sun. The important thing is to have a perfect reference image. 

To summarize the process:

1)
First open one of your Sun images.
Generate an New Image that will work as reference image. You have several ways to do this, but I prefer to do it with PixelMath as it let me locate the Sun perfectly in the center of the image.
"Set as active image" in New Image module to have the new images with the same size that the images you have acquired. You will get a black image.
Measure the diameter of your Sun and calculate the radius.
See the width and high of your image and calculate the center.
Write in PixelMath in RGB/K the expression: (~max( 0, ( rdist( cx, cy ) / r )))*h
Write in PixelMath in Symbols: cx=(the value you have previously calculated), cy=(the value you have previously calculated), r=(the value you have previously calculated), h=150
cx is the width divided by 2, cy is the high divided by 2 and r is the diameter divided by 2. h is to define how is the border of the circle, a value of 150 is good for the Sun.
Apply PixelMath on the black image and you will get the reference image with the white circle in the center.

2)
Open ImageContainer and add your images.
Select an output directory different to where are located your input images
write an output template, for example: &filename;_r.xisf
Generate the ImageContainer instance on your workspace.

3)
Open FFTRegister Module (if you do not have it, see how to get and install Carlos' modules here)
Set identifier: here you have to select the reference image that was created with PixelMath
Layer index: set the value to 1
Output image: set "Replace Target" (This is important and will not replace your images due to you have already selected a new location in ImageContainer)
Apply FFTRegister Module over ImageContainer instance.

Open Blink, load the _r images and enjoy watching it  :)

Hope this helps

Offline gerlos

  • Newcomer
  • Posts: 14
Re: FFTRegistration problem with full disk sun images
« Reply #10 on: 2016 May 25 04:47:18 »
Try with the modified version of the script I have attached to this post. It registers all of the images you have uploaded without problems.

Hello Juan,
Many, many thanks, it works a lot better than before!
I did a quick test looking at the integrated image and after some STF tuning I see that some images are still misaligned, but they must be a smaller number than before, and perhaps results depends on clouds passing by.
Later I'll give them a closer look to check more carefully the results.  :o

Hi Gerlos, the method that I use is with FFTRegister Module and it works like a charm with the Sun. The important thing is to have a perfect reference image. 

To summarize the process:

Thanks, for your help, I'll try to follow your suggestions! But I'm still a newbie, and I've some questions:

Quote
1)
Generate an New Image that will work as reference image. You have several ways to do this, but I prefer to do it with PixelMath as it let me locate the Sun perfectly in the center of the image.

OK. Is somewhere a tool to do size measures on images? To measure the Sun diameter, I created a new preview, adjusted its width and height to fit the sun and read those sizes from the view explorer, but I maybe I missed an easier way to do it.

Quote
2)
Open ImageContainer and add your images.

OK. If I use an extension like .png or .tif PI will export them in the right format, isn't it?
I plan to feed them to ffmpeg to make a time lapse video, and I'd like to skip a conversion step.

Quote
3)
Open FFTRegister Module (if you do not have it, see how to get and install Carlos' modules here)


At the moment I'm running PI on Mac OSX, I guess I can't install Windows or Linux modules on my system...  :sad:
I've another PC running Ubuntu, I can't use it at the moment, but I'll try later today.

Quote
Open Blink, load the _r images and enjoy watching it  :)


Never played with Blink module before, seems really cool!  :cheesy: Is there a way to apply a custom STF to all the shots loaded in this module? I've seen I can run ffmpeg from it, it would be nice to be able to use it without leaving PI.

Thanks, thanks again for your great help!  :)

gerlos

Offline gerlos

  • Newcomer
  • Posts: 14
Re: FFTRegistration problem with full disk sun images
« Reply #11 on: 2016 May 25 08:47:57 »
Hi Gerlos, the method that I use is with FFTRegister Module and it works like a charm with the Sun. The important thing is to have a perfect reference image. 

To summarize the process:

I reached my Ubuntu PC and tried your suggested process from start to end: registration was perfect:surprised:

Many many thanks!
-gerlos

Offline Alejandro Tombolini

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1267
    • Próxima Sur
Re: FFTRegistration problem with full disk sun images
« Reply #12 on: 2016 May 25 13:00:44 »
Hi gerlos, good to know that!

Now if you make the video from Blink you can use as Argument for ffmpeg something like this: -y -framerate 8 -i Blink%05d.png -s:v 1280x960 -c:v libx264 -preset veryslow -profile:v high444 -crf 22 -pix_fmt yuv420p Video.mp4

Saludos, Alejandro.

Offline wboeck

  • Newcomer
  • Posts: 12
Re: FFTRegistration problem with full disk sun images
« Reply #13 on: 2017 October 01 10:12:42 »
Is there an example of doing this? It sounds confusing.

Wayne

Hi Gerlos, the method that I use is with FFTRegister Module and it works like a charm with the Sun. The important thing is to have a perfect reference image. 

To summarize the process:

1)
First open one of your Sun images.
Generate an New Image that will work as reference image. You have several ways to do this, but I prefer to do it with PixelMath as it let me locate the Sun perfectly in the center of the image.
"Set as active image" in New Image module to have the new images with the same size that the images you have acquired. You will get a black image.
Measure the diameter of your Sun and calculate the radius.
See the width and high of your image and calculate the center.
Write in PixelMath in RGB/K the expression: (~max( 0, ( rdist( cx, cy ) / r )))*h
Write in PixelMath in Symbols: cx=(the value you have previously calculated), cy=(the value you have previously calculated), r=(the value you have previously calculated), h=150
cx is the width divided by 2, cy is the high divided by 2 and r is the diameter divided by 2. h is to define how is the border of the circle, a value of 150 is good for the Sun.
Apply PixelMath on the black image and you will get the reference image with the white circle in the center.

2)
Open ImageContainer and add your images.
Select an output directory different to where are located your input images
write an output template, for example: &filename;_r.xisf
Generate the ImageContainer instance on your workspace.

3)
Open FFTRegister Module (if you do not have it, see how to get and install Carlos' modules here)
Set identifier: here you have to select the reference image that was created with PixelMath
Layer index: set the value to 1
Output image: set "Replace Target" (This is important and will not replace your images due to you have already selected a new location in ImageContainer)
Apply FFTRegister Module over ImageContainer instance.

Open Blink, load the _r images and enjoy watching it  :)

Hope this helps

Offline Alejandro Tombolini

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1267
    • Próxima Sur
Re: FFTRegistration problem with full disk sun images
« Reply #14 on: 2017 October 02 18:00:30 »
Hi Wayne,

The text is part of this mask article (section: Circular Mask as reference image). There, it is complete and maybe with the images it is a little more clear.

Please note that FFTRegister Module is not available for version 1.8.5

Saludos, Alejandro.