align_image_stack: image sizes not consistent

Asked by Oto on 2017-05-08

 Is there a change request for this?

I have workflow where we scan old photos and do the scan 4 times each time rotating the photo by 90 degrees and later would need to align it and merge so to minimize noise and make lighting more uniform. This works if doing multiple scans without rotation as the size is the same but some noise/dust is still present as photo is not moved. Tried to make them the same size but then align_image_stack creates too much distortion as too much transformation is done.

Question information

English Edit question
Hugin Edit question
No assignee Edit question
Last query:
Last reply:
tmodes (tmodes) said : #1

I don't know what you wants or what fails.

Best way would be you provide a link to an example image set and write what you have tried.

tmodes (tmodes) said : #3

align_image_stack -a Emir Emir*.jpg is aligning the images fine. So I don't know what the problem is.

Otherwise you can output a pto file with align_image_stack -p emir.pto Emir*.jpg and fine-tune the output in Hugin.

Oto (otoluk) said : #4

It aligns but only if image sizes are identical. My bad didn't check that attached images are same size but original plate has different sized photos -
It would be more convenient if image sizes could be slightly different if using simple translation and crop is enabled.

tmodes (tmodes) said : #5

This is currently not so easy because of the internal implementation. Align_image_stack is using internal the panotools model for remapping the images. In this model it is not easy to accommodate for different sized images.
As a workaround you can load the images in Hugin, use cpfind as cp detector, optimize there and output the remapped images.

Oto (otoluk) said : #6

Ok I understand. But is it possible to add just translation, rotation option? Now the photos are aligned but too distorted.

tmodes (tmodes) said : #7

Sorry, but we are going in circles.
By default align_image_stack does only correct position (but on the panosphere, not in the 2d space). With default options align_image_stack does not correct lens distortions.
So if you want help you need to provide an example which shows your problem. (2-3 input images, the command line used and maybe one aligned images which shows the distortion you are referring the whole time - maybe marked).

Oto (otoluk) said : #8

Yes I mean that would like to align in 2d space (in planar motion-move,scale,rotate)

See the result after align_image_stack, there are too much distortion at corners which results in color aberration after merging channels.

It should look closer to this -

I used this command line - "C:\Program Files\Hugin\bin\align_image_stack.exe" --use-given-order -z -c 50 -a Emir Emir_red.jpg Emir_green.jpg Emir_blue.jpg

tmodes (tmodes) said : #9

> Yes I mean that would like to align in 2d space (in planar motion-move,scale,rotate)
That would require to rewrite big parts of align_image_stack.

The problem is the -z option. This was implemented for another use case. Use "align_image_stack -C -m -i -a Emir Emir_*.jpg" instead.
-C crops to the rectangle covered by all images. -m -i optimize field of view and image center shift to handle the case that the images are cropped manually from the bigger negative (which could introduce some shift).

Oto (otoluk) said : #10

Thanks now it is better still not as good as LOC version but acceptable. Will try on higher resolution image.

Would it be possible for option that align_image_stack adds canvas if image sizes are not identical but with close dimensions? Now it is troublesome to extract each frame and check that sizes should be consistent.

tmodes (tmodes) said : #11

For the small images maybe -s 0 help (for using the full scale image).
Also --corr=0.7 to lower the correlation threshold can help (because of the different color channels the gray images looks different for each color channel, or even lower values).
You could also try the switch -d.
For testing you could also output a pto file with -p pto_file.pto and inspect the pto file in Hugin. There you could try if optimizing other parameters (e.g. lens distortion aka -d switch) improves the results.

Can you help with this problem?

Provide an answer of your own, or ask Oto for more information if necessary.

To post a message you must log in.