I found a way using the align_image_stack
command of Hugin, unfortunately it does not seem reliable when I double check it by manually rotating the image in Photoshop.
I am placing the answer nonetheless, perhaps someone can improve upon it.
Below command (executed in a folder of numbered jpegs) generates a file output.txt
that contains a Hugin project file.
align_image_stack --use-given-order -p "output.txt" *.jpg
In the first section named # image lines
the rotation of each image is noted down as the parameter r
(example is truncated for readability):
# image lines
#-hugin cropFactor=1.57275
i w2286 h2238 f0 v22.2426293825203 Ra0 Rb0 Rc0 Rd0 Re0 Eev7.63941033766127 Er1 Eb1 r0 p0 y0 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j0 a0 b0 c0 d0 e0 g0 t0 Va1 Vb0 Vc0 Vd0 Vx0 Vy0 Vm5 n"c__0001.jpg"
#-hugin cropFactor=1.57275458193554
i w2286 h2238 f0 v=0 Ra=0 Rb=0 Rc=0 Rd=0 Re=0 Eev7.63941033766127 Er=0 Eb=0 r0.415525153837992 p0.140870673598968 y0.027787825484654 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j=0 a=0 b=0 c=0 d=0 e=0 g=0 t=0 Va=0 Vb=0 Vc=0 Vd=0 Vx=0 Vy=0 Vm5 n"c__0002.jpg"
#-hugin cropFactor=1.57275458193554
i w2286 h2238 f0 v=0 Ra=0 Rb=0 Rc=0 Rd=0 Re=0 Eev7.63941033766127 Er=0 Eb=0 r0.964363183756073 p0.23485788820777 y0.0138123298526572 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j=0 a=0 b=0 c=0 d=0 e=0 g=0 t=0 Va=0 Vb=0 Vc=0 Vd=0 Vx=0 Vy=0 Vm5 n"c__0003.jpg"
#-hugin cropFactor=1.57275458193554
i w2286 h2238 f0 v=0 Ra=0 Rb=0 Rc=0 Rd=0 Re=0 Eev7.63941033766127 Er=0 Eb=0 r1.72562957016005 p0.311043964234605 y0.0127864033612948 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j=0 a=0 b=0 c=0 d=0 e=0 g=0 t=0 Va=0 Vb=0 Vc=0 Vd=0 Vx=0 Vy=0 Vm5 n"c__0004.jpg"
#-hugin cropFactor=1.57275458193554
i w2286 h2238 f0 v=0 Ra=0 Rb=0 Rc=0 Rd=0 Re=0 Eev7.63941033766127 Er=0 Eb=0 r2.7002616608102 p0.357917789595762 y0.00726170450171952 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j=0 a=0 b=0 c=0 d=0 e=0 g=0 t=0 Va=0 Vb=0 Vc=0 Vd=0 Vx=0 Vy=0 Vm5 n"c__0005.jpg"
Using below regex and some manual line removal I get the desired output
- Replace
(p.*?")(.*)(")
with \2
- Replace
(i.*Eb\=0 r)
with nothing