Sign up now! · Forgot password?
RSS/Atom feed identi.ca Twitter

image alignment/registration

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

26 of 26 messages available
Toggle history

Please log in to manage your subscriptions.

image alignment/registration Casey Connor 05 Feb 02:57
  image alignment/registration Pat David 05 Feb 23:21
   image alignment/registration oneaty 19 Mar 12:25
    image alignment/registration Casey Connor 20 Mar 22:35
     image alignment/registration oneaty 24 Mar 19:58
      image alignment/registration Casey Connor 24 Mar 22:00
       image alignment/registration oneaty 24 Mar 22:36
        image alignment/registration oneaty 24 Mar 22:42
        image alignment/registration Casey Connor 24 Mar 23:02
         image alignment/registration oneaty 25 Mar 00:17
          image alignment/registration Casey Connor 25 Mar 00:41
           image alignment/registration oneaty 25 Mar 10:18
            image alignment/registration Casey Connor 25 Mar 16:52
             image alignment/registration oneaty 25 Mar 23:23
              image alignment/registration oneaty 26 Mar 11:49
               image alignment/registration Casey Connor 26 Mar 22:45
                image alignment/registration oneaty 26 Mar 23:22
                 image alignment/registration Casey Connor 27 Mar 17:29
                 image alignment/registration Casey Connor 27 Mar 17:30
                  image alignment/registration oneaty 27 Mar 17:50
                   image alignment/registration Pat David 27 Mar 19:11
                    image alignment/registration oneaty 28 Mar 01:51
                     image alignment/registration Pat David 29 Mar 13:43
                      image alignment/registration Casey Connor 29 Mar 17:48
                      image alignment/registration oneaty 29 Mar 19:18
                       image alignment/registration Casey Connor 29 Mar 20:13
Casey Connor
2017-02-05 02:57:03 UTC (7 months ago)

image alignment/registration

Hi - I was curious what the best overall image alignment plugin/method in GIMP (or out of GIMP) was these days?

"Best" for me means "most powerful/flexible/option-rich".

I've come across the hugin align_image_stack, the G'MIC plugin's "Align layers" option, and the image registration plugin . (I've also used the "Exact
Aligner" script, but it's two layers only.)

The goal is to align and then use mean/median for noise reduction stacking. I'll probably be working in 16bit.

Do all three methods do sub-pixel alignment? I read someone on pixls.us suggesting that the user upscale the source images by up to 1.33x before aligning for the sake of effectively achieving sub-pixel alignment, but if the current alignment methods do that anyway, seems like I should skip it... ?

Thanks!

-c

Pat David
2017-02-05 23:21:11 UTC (7 months ago)

image alignment/registration

Align_image_stack is usually the best option other than possibly attempting it manually directly in Hugin.
On Sat, Feb 4, 2017 at 8:57 PM Casey Connor wrote:

Hi - I was curious what the best overall image alignment plugin/method in GIMP (or out of GIMP) was these days?

"Best" for me means "most powerful/flexible/option-rich".

I've come across the hugin align_image_stack, the G'MIC plugin's "Align layers" option, and the image registration plugin . (I've also used the "Exact
Aligner" script, but it's two layers only.)

The goal is to align and then use mean/median for noise reduction stacking. I'll probably be working in 16bit.

Do all three methods do sub-pixel alignment? I read someone on pixls.us suggesting that the user upscale the source images by up to 1.33x before aligning for the sake of effectively achieving sub-pixel alignment, but if the current alignment methods do that anyway, seems like I should skip it... ?

Thanks!

-c

_______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list

Pat David
GPG: 66D1 7CA6 8088 4874 946D  18BD 67C7 6219 89E9 57AC
2017-03-19 12:25:37 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

Align_image_stack is usually the best option other than possibly attempting
it manually directly in Hugin.
On Sat, Feb 4, 2017 at 8:57 PM Casey Connor

wrote:

I tried align_image_stack many times, using different options combinations, but coudn't get aligned images in the end. I'm trying to abandon PS and fully use gnu software, but, so far, couldn't find a decent replacent for PS's autoalign feature. The point is that I didn't use tripod, so there are alignment differences in the original frames. PS's autoalign can handle that situation in a very satisfactory manner. Am I missing something?
I don't want to piggyback Casey's post, but since I have the same question, I choose to put this post here. If admins feel I should open another thread, just let me know.

Casey Connor
2017-03-20 22:35:24 UTC (5 months ago)

image alignment/registration

I tried align_image_stack many times, using different options combinations, but coudn't get aligned images in the end.

Per recommendations here, I've used it and it worked really well; I've read, and experienced, that it seems to need images to be pretty close already. Meaning, by default it won't assume the images should be aligned a great distance, so if you moved much while shooting it might not work out. You might investigate the -g option -- I'm not totally clear on how it works, but it sounds from the description like it might change the scale which align_image_stack uses to find control points. Maybe also the -t option?

You could also check out hugin, which AFAIK uses align_image_stack under the hood to do its alignment. It allows all kinds of manual intervention/editing of control points. I understand that a "one-click" solution is ideal, but mention it just in case. You can at least visually see what's happening with the control points and understand better where things are going wrong.

-c

2017-03-24 19:58:02 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

Per recommendations here, I've used it and it worked really well; I've read, and experienced, that it seems to need images to be pretty close

Thanks for the feedback.
I believe if I shoot with a tripod it would work fine. The point is that a tripod isn't an option to me most of the time. My only camera is an old point & shoot Canon A3100, boosted by CHDK. CHDK has many wonderful features, but the one I mostly use is its raw capability, not available on Canon original firmware. Besides, I usually do a lot of stacking, pushing the final image quality to its limits. And here is my problem.
With PS, I can auto align hand held shots with excellent results. The differences in perspective between shots do exist but are not big, because I try to hold the camera the most steadier I can when shooting. I just came from aligning the same set of pictures in PS I tried in Hugin, and it worked almost perfectly. Before that, I had also tried using JImage (and its full package FiJi), but it is really, really complex and I gave up. So, unfortunately (being an open source fan), I will still have to keep with PS, until I find an open source alternative to its auto alignment feature.

Casey Connor
2017-03-24 22:00:46 UTC (5 months ago)

image alignment/registration

Did you try the -g option with align_image_stack? Or -t?

I align hand-held images with align_image_stack and it works fine, even without those options... e.g. this one: https://www.flickr.com/photos/lacinato/32628735771/in/dateposted-public/

-c

On 03/24/2017 12:58 PM, oneaty wrote:

Per recommendations here, I've used it and it worked really well; I've read, and experienced, that it seems to need images to be pretty close

Thanks for the feedback.
I believe if I shoot with a tripod it would work fine. The point is that a tripod isn't an option to me most of the time. My only camera is an old point & shoot Canon A3100, boosted by CHDK. CHDK has many wonderful features, but the one I mostly use is its raw capability, not available on Canon original firmware. Besides, I usually do a lot of stacking, pushing the final image quality to its limits.
And here is my problem.
With PS, I can auto align hand held shots with excellent results. The differences in perspective between shots do exist but are not big, because I try to hold the camera the most steadier I can when shooting. I just came from aligning the same set of pictures in PS I tried in Hugin, and it worked almost perfectly.
Before that, I had also tried using JImage (and its full package FiJi), but it is really, really complex and I gave up. So, unfortunately (being an open source fan), I will still have to keep with PS, until I find an open source alternative to its auto alignment feature.

2017-03-24 22:36:29 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

Did you try the -g option with align_image_stack? Or -t?

I align hand-held images with align_image_stack and it works fine, even
without those options... e.g. this one: https://www.flickr.com/photos/lacinato/32628735771/in/dateposted-public/

-c

Tried

align_image_stack -a *.tif

and

align_image_stack -a -g *.tif

and no success...

2017-03-24 22:42:41 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

Tried

align_image_stack -a *.tif

and

align_image_stack -a -g *.tif

and no success...

The whole process:

1 - Shoot in DNG 2 - RawTherappe - Open dng's with preset Neutral and save them as tif 3 - align_image_stack.

Btw, beautiful image.

Casey Connor
2017-03-24 23:02:51 UTC (5 months ago)

image alignment/registration

So, backing up a step: when you say align_image_stack doesn't work, what do you mean exactly? I assumed you meant that it did a poor job aligning the images, but I don't think the command lines you list there would even work to start the program, so I'm wondering now if you meant that it doesn't even run?

"-a" requires a prefix following it, and "-g" requires a number.

E.g.:

align_image_stack -a someprefix -g 8 *.tif

Documentation is here: http://wiki.panotools.org/Align_image_stack

2017-03-25 00:17:13 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

So, backing up a step: when you say align_image_stack doesn't work, what
do you mean exactly? I assumed you meant that it did a poor job aligning
the images,

Correct assumption,

but I don't think the command lines you list there would

even work to start the program, so I'm wondering now if you meant that it doesn't even run?

"-a" requires a prefix following it, and "-g" requires a number.

E.g.:

align_image_stack -a someprefix -g 8 *.tif

Documentation is here: http://wiki.panotools.org/Align_image_stack

Well, it works.

-a without explicit prefix defaults to the name of the first image file given.

-g without explicit number defaults to 5 (that is written in the --help option)

Btw, what os are you using?

I'm running this on Linux (Ubuntu 16.04)

Casey Connor
2017-03-25 00:41:54 UTC (5 months ago)

image alignment/registration

Ah, ok. So what exactly goes wrong: one or two of the images is off-kilter?

If you specify -g, try using something besides the default, as I'm not sure that using the default will change the behavior. (Meaning, not specifying -g probably results in the same thing as just "-g" -- the documentation is a little unclear, but I assume it's active when not specified.) Perhaps try -g 3 or 4 instead? I'm not 100% sure how to interpret it. If that doesn't work, try 6 or 7?

Btw, what os are you using?

Kubuntu 16.10.

-c

2017-03-25 10:18:26 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

Ah, ok. So what exactly goes wrong: one or two of the images is off-kilter?

Yes, that's it. I'm just checking the first two images, since PS successfully aligned all of them.

If you specify -g, try using something besides the default, as I'm not sure that using the default will change the behavior. (Meaning, not specifying -g probably results in the same thing as just "-g" -- the documentation is a little unclear, but I assume it's active when not specified.) Perhaps try -g 3 or 4 instead? I'm not 100% sure how to interpret it. If that doesn't work, try 6 or 7? Kubuntu 16.10.

-c

I tried

align_image_stack -a align -g 10 -t 5 *.tif

and

align_image_stack -a -dixyz *.tif

and

align_image_stack -a align -SAP *.tif

and the images (the first two) are still unaligned

The resulting stack by using Photoshop can be seen here https://flic.kr/p/SDKdBf

Casey Connor
2017-03-25 16:52:15 UTC (5 months ago)

image alignment/registration

I tried

align_image_stack -a align -g 10 -t 5 *.tif

Did you try with a lower-than-default -g? E.g. "-g 3"?

If you want to upload the base .tif files somewhere, I can try to align them, so we can see if there is some strange difference between align_image_stack on our machines.

-c

2017-03-25 23:23:50 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

Did you try with a lower-than-default -g? E.g. "-g 3"?

If you want to upload the base .tif files somewhere, I can try to align
them, so we can see if there is some strange difference between align_image_stack on our machines.

-c

Hey, thanks for that!

Follows Flickr album https://flic.kr/s/aHskT2xjh1

2017-03-26 11:49:06 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

Hey, thanks for that!

Follows Flickr album https://flic.kr/s/aHskT2xjh1

EDIT: I noticed that Flickr automatically changed the tiffs I uploaded into jpgs, so I wanted to make sure it wouldn't be a waste of time to you. I did what I suppose you'll do:
1 - Downloaded Flickr album
2 - Aligned the images with align_image_stack 3 - Opened the output from previous step as layers in Gimp. 4 - Changed layers opacity according to the mean rule (100%, 50%, 33%...) 4 - Did the same on PS

Conclusion: The format change didn't interfere in the original alignment issue: PS correctly auto-aligned the layers, but align_image_stack didn't.

The following images are screen shots from both ps and gimp showing the final stacks: http://imgur.com/a/drKdB

Casey Connor
2017-03-26 22:45:29 UTC (5 months ago)

image alignment/registration

Ok -- I believe PS is beating align_image_stack because the picture seems to have been taken with a very wide lens (i.e. short focal length) from close up... as a result, there is a lot of barrel distortion, and in addition there is a lot of camera movement between frames, so the result is that the image distorts differently from frame to frame and align_image_stack is not able to do it automatically. Meaning, when you turn the camera that much, it "bends" the contents of the image in various different ways that make the images much harder to align. PS might be able to automatically correct for that distortion, but align_image_stack seems to struggle with it -- I get the same bad alignment results you did, but read on for more ideas:

If you can use a longer focal length and stand farther away, and also hold the camera more still, I think it will work better (and have less barrel distortion as well.) Your PS screenshot also looks like there was some kind of contrast or something applied (by PS, I assume? -- maybe related to the layer overlay mode when you stack the frames? -- or maybe PS is just doing a better job!)

But note this: you don't have to, and probably shouldn't, use the manual layer stacking method. That creates a simple averaging of the pixels, and it's probably pretty tedious to set up. There is another utility you can use to create the median, instead of the average (aka mean), of the image, which usually looks better. After I do align_image_stack, I use gmic to take the median of the files. The command line looks like this (where test0001.tif etc are the images after alignment):

gmic -median_files test\*.tif -o output.tif

(you have to use "\*" with wildcards in gmic for whatever reason.)

Then I take the resulting output.tif file, open it in gimp, change the precision to 8 or 16bit, and remove the alpha channel (right-click the layer). This is the result of that process: http://caseyconnor.org/pub/image/aligned_and_medianed.tif

I think it looks pretty good -- maybe not as nice as photoshop, but that may just be the "contrast" that PS seems to have added. Note how the median, as opposed to the mean, eliminates the most mis-aligned frames automatically: those bad frames are left in if you average/mean the frames. As mentioned, I think you can make it look a lot better by taking better original pictures.

Even if you use PS to align the images, you should look into using gmic to take the median, rather than stacking the layers. Just remember that gmic outputs 32bit-float RGBA images, and you'll usually want/need to convert those to something more common.

(Note: current stable releases of gimp don't support high-precision images -- not sure if they will open the 32bit out of gmic or not. I'm using 2.9.5.)

-c

2017-03-26 23:22:48 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

Ok -- I believe PS is beating align_image_stack because the picture seems to have been taken with a very wide lens (i.e. short focal length)
from close up... as a result, there is a lot of barrel distortion, and in addition there is a lot of camera movement between frames, so the result is that the image distorts differently from frame to frame and align_image_stack is not able to do it automatically. Meaning, when you
turn the camera that much, it "bends" the contents of the image in various different ways that make the images much harder to align. PS might be able to automatically correct for that distortion, but align_image_stack seems to struggle with it -- I get the same bad alignment results you did, but read on for more ideas:

Yeah, I suspect it had to do with the lens distortion, but, in this specific photo, I couldn't have place myself more distant because that was a corridor.

If you can use a longer focal length and stand farther away, and also hold the camera more still, I think it will work better (and have less barrel distortion as well.) Your PS screenshot also looks like there was
some kind of contrast or something applied (by PS, I assume? -- maybe related to the layer overlay mode when you stack the frames? -- or maybe
PS is just doing a better job!)

The only thing I did was applying the input script open stack or something like that (can't remember at this point its name) and changing the opacity. You're probably right assuming PS did some ajustments, because it probably calls Camera Raw under the hoods when opening the raw files, and by default, Camera Raw uses to open with some default settings already applied.

But note this: you don't have to, and probably shouldn't, use the manual
layer stacking method. That creates a simple averaging of the pixels, and it's probably pretty tedious to set up. There is another utility you
can use to create the median, instead of the average (aka mean), of the
image, which usually looks better. After I do align_image_stack, I use gmic to take the median of the files. The command line
looks like this (where test0001.tif etc are the images after alignment):

gmic -median_files test\*.tif -o output.tif

(you have to use "\*" with wildcards in gmic for whatever reason.)

I have tried the median method but, somehow, I generally prefer the median. As for the process being tedious, you're right, it is, although there is a much simpler way of doing exactly the same thing in PS, just by changing all the layers into Smart Object. Then you can apply in a single click the various stacking modes (including, of course, mean and median). Anyway, I'll give gmic a try.

Then I take the resulting output.tif file, open it in gimp, change the precision to 8 or 16bit, and remove the alpha channel (right-click the layer). This is the result of that process: http://caseyconnor.org/pub/image/aligned_and_medianed.tif

It certainly looks very good!
However, it's not clear after all, if you used gmic after align_stack or just applied it directly to the original frames.

I think it looks pretty good -- maybe not as nice as photoshop, but that
may just be the "contrast" that PS seems to have added. Note how the median, as opposed to the mean, eliminates the most mis-aligned frames automatically: those bad frames are left in if you average/mean the frames. As mentioned, I think you can make it look a lot better by taking better original pictures.

Even if you use PS to align the images, you should look into using gmic
to take the median, rather than stacking the layers. Just remember that
gmic outputs 32bit-float RGBA images, and you'll usually want/need to convert those to something more common.

(Note: current stable releases of gimp don't support high-precision images -- not sure if they will open the 32bit out of gmic or not. I'm using 2.9.5.)

-c

I'm using the latest developing version, 2.9.something, and it already supports, at least, 16-bit images. Not sure about 32-bit.

I feel like the open source tools are getting close to PS, regarding the stacking process. As for the rest, RawTherapee is really an option, and maybe Gimp sooner.

Casey Connor
2017-03-27 17:29:03 UTC (5 months ago)

image alignment/registration

Then I take the resulting output.tif file, open it in gimp, change the precision to 8 or 16bit, and remove the alpha channel (right-click the layer). This is the result of that process: http://caseyconnor.org/pub/image/aligned_and_medianed.tif

It certainly looks very good!
However, it's not clear after all, if you used gmic after align_stack or just applied it directly to the original frames.

I did align_image_stack, and then applied gmic to the aligned frames.

I'm using the latest developing version, 2.9.something, and it already supports, at least, 16-bit images. Not sure about 32-bit.

Yeah, it should work fine.

It's interesting to see that PS apparently handles lens distortion when aligning images -- those are impressive results. But maybe align_image_stack + gmic + gimp can work for you in some cases, too.

Good luck with it, -c

Casey Connor
2017-03-27 17:30:04 UTC (5 months ago)

image alignment/registration

One last thought: if you are going to remove the barrel distortion in those images, you might try removing it before doing the image alignment... that might allow align_image_stack to work better... -c

2017-03-27 17:50:05 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

One last thought: if you are going to remove the barrel distortion in those images, you might try removing it before doing the image alignment... that might allow align_image_stack to work better... -c

That's a good idea, I'll try that.

Besides, many thanks for your patience and willingness to help.

I hope soon Gimp will present us a new alignment algorithm so we can forget, forever and ever, closed source apps.

Best wishes!

Pat David
2017-03-27 19:11:07 UTC (5 months ago)

image alignment/registration

Could I have another link to the images to test something?

On Mon, Mar 27, 2017 at 12:59 PM oneaty wrote:

One last thought: if you are going to remove the barrel distortion in those images, you might try removing it before doing the image alignment... that might allow align_image_stack to work better... -c

That's a good idea, I'll try that.

Besides, many thanks for your patience and willingness to help.

I hope soon Gimp will present us a new alignment algorithm so we can forget,
forever and ever, closed source apps.

Best wishes!

-- oneaty (via www.gimpusers.com/forums) _______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list

https://patdavid.net
GPG: 66D1 7CA6 8088 4874 946D  18BD 67C7 6219 89E9 57AC
2017-03-28 01:51:12 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

Could I have another link to the images to test something?

Sure.

https://goo.gl/photos/GCoSg4uANxLGunDAA

Pat David
2017-03-29 13:43:17 UTC (5 months ago)

image alignment/registration

align_image_stack.exe -v -m -d -i -x -y -z -a aligned_ *.tif

Gave me pretty rock solid results with your .tif files:

https://transfer.sh/DgimG/oneaty.zip

pat

On Tue, Mar 28, 2017 at 3:03 PM oneaty wrote:

Could I have another link to the images to test something?

Sure.

https://goo.gl/photos/GCoSg4uANxLGunDAA

-- oneaty (via www.gimpusers.com/forums)

Casey Connor
2017-03-29 17:48:54 UTC (5 months ago)

image alignment/registration

D'oh, the -d option! And -x -y -z sound promising as well. Not clear what -i does -- doesn't it always optimize the center shift? Or does "center shift" mean something more complex than simple x/y translation?

Thanks, Pat! Pays to RTFM. The hugin toolkit continues to amaze me.

That generates a result as good as photoshop for me, judging from the demo that oneaty posted. Good to learn how to better use this tool.

-c

On 03/29/2017 06:43 AM, Pat David wrote:

align_image_stack.exe -v -m -d -i -x -y -z -a aligned_ *.tif

Gave me pretty rock solid results with your .tif files:

https://transfer.sh/DgimG/oneaty.zip

pat

On Tue, Mar 28, 2017 at 3:03 PM oneaty wrote:

Could I have another link to the images to test something?

Sure.

https://goo.gl/photos/GCoSg4uANxLGunDAA

-- oneaty (via www.gimpusers.com/forums) _______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list

2017-03-29 19:18:30 UTC (5 months ago)
postings
18
contact
Send private message

image alignment/registration

align_image_stack.exe -v -m -d -i -x -y -z -a aligned_ *.tif

Gave me pretty rock solid results with your .tif files:

https://transfer.sh/DgimG/oneaty.zip

pat Sure.

https://goo.gl/photos/GCoSg4uANxLGunDAA

-- oneaty (via www.gimpusers.com/forums)

Great!

I did a test with three new hand-held shots, and it worked perfectly.

So, by looking at the help text, it seems that you used all the options suited to focus stacking.

Maybe it should simply state that those are options suited for standard stacking. (Am I wrong to generalize it this way?)

Thank you very much Pat and Casey for your kind help.

PS.: I was preparing myself to meet Pat himself in Rio and thank him personally, but then I heard that he wouldn't attend the Conference... :)

Casey Connor
2017-03-29 20:13:04 UTC (5 months ago)

image alignment/registration

So, by looking at the help text, it seems that you used all the options suited to focus stacking.

At least in the help file I'm looking at, I think the only option "for" focus stacking is -m ? For lenses with focus breathing (i.e. almost all lenses) if you are changing the focus for each shot, that will have the effect of changing the FOV a little bit, and that option apparently enables correction for that effect. But it may also be useful if you happened to move forward/back a bit between shots (which isn't really the same as zooming, of course, but is similar). You could try not using -m and see if it makes a difference for your use.

-x -y and -z sound like they attempt to correct for moving around slightly when you take the picture (i.e. translational as opposed to rotational changes?)

-d sounds like it might compensate for distortion due to rotation (i.e. the distortion when you are close with a wide angle lens) but I'm just guessing. :-)

I think the lesson is that align_image_stack defaults to not applying most of the corrections, and if you want them, you have to enable them.

I wonder if --distortion would also be a smart thing to turn on.

-c