Consecutive Roll Pitch Roll Pitch Roll transform into one set of Y P R?

44 views
Skip to first unread message

dawns...@gmail.com

unread,
Oct 27, 2020, 10:51:26 PM10/27/20
to hugin and other free panoramic software
Hi everyone, I have manually succeeded in "tracking" stars in the sky when the originals were taken with a stationary camera-on-tripod, by using a series of Yaw Pitch Roll transformations using the Hugin interface. Hugin is really important since it handles barrel distortion in wide angle lenses that astronomy stacking software can't. 

I am aware that any series of rotations can be transformed into a single 3-axis rotation using matrices, though I have never actually done this. I have successfully used nona in a script to reproject dual fisheye on a (tilted)  equatorial platform into zenith up VR360 images., (with thanks of course to Thomas!), and now that looks uncomplicated. 

I am running nona in a script because I have 100 images to process.
My question is.... can I use nona to line by line in a script 
 roll by $roll1
 pitch by $pitch1 (which takes it out of the field of view)
roll by $roll2 (rotation in polar space coords)
pitch by -1*$pitch1 (brings it back)
roll by -1*$roll1 to make it near horizontal
     which is programatically simpler because all the angles are determined just before the rotations. But I don't see a method where the image is held in memory waiting for the next nona command, and I can't see saving to an image on disk then reopening it. 

OR do I need to suck it up and figure out the code for matrix multiplication to feed a single nona line with final yaw pitch roll values?

the value roll2 changes with each image (rotation of the earth!) so I can't just do one manually then use that pto to run through the other 100 images. I am not concerned about computational efficiency, I can let the computer run when I am sleeping.

I appreciate your thoughts! Thanks,
Alister.
 

T. Modes

unread,
Oct 28, 2020, 12:19:20 PM10/28/20
to hugin and other free panoramic software
Hi Alister,


Am Mittwoch, 28. Oktober 2020 03:51:26 UTC+1 schrieb dawns...@gmail.com:

I am running nona in a script because I have 100 images to process.
My question is.... can I use nona to line by line in a script 
 roll by $roll1
 pitch by $pitch1 (which takes it out of the field of view)
roll by $roll2 (rotation in polar space coords)
pitch by -1*$pitch1 (brings it back)
roll by -1*$roll1 to make it near horizontal
     which is programatically simpler because all the angles are determined just before the rotations. But I don't see a method where the image is held in memory waiting for the next nona command, and I can't see saving to an image on disk then reopening it. 

OR do I need to suck it up and figure out the code for matrix multiplication to feed a single nona line with final yaw pitch roll values?

Nona reads all positions from the pto file given. It can not modify the content of the pto file (and therefore can not change the angles).
For modifying the angle there are other command tools
pano_modify --rotate=yaw,pitch,roll .. for modifying the position of the output panorama (if you want several rotations you have to call it several times) and
pto_var --set=p=val+pitch1 .. for modifying the positions of the input images (here you can add several changes in one line)

Thomas

dawns...@gmail.com

unread,
Oct 28, 2020, 3:19:07 PM10/28/20
to hugin and other free panoramic software
Ah, thank you Thomas! Just the command-line solution I was hoping for. I will give this a try soonest and report back in a day or two.
What a wonderfully supportive group this is!
Cheers,
Alister.

dawns...@gmail.com

unread,
Oct 29, 2020, 8:00:45 PM10/29/20
to hugin and other free panoramic software
Bingo! Thomas that worked perfectly. All of 4 more lines in a script. Has to be the easiest multiplication of rotation matrices I have ever (not) done. At first I incorrectly thought that all the modify_pano was going to do was overwrite the yaw,pitch,roll values with the supplied ones, but it actually calculates the final result of a sequential set of rotations! 
     For the next person, here is what I did explicitly in perl:
$r=`\\bin\\pano_modify.exe --output=inirollpitch.pto --rotate=0,$pitch1,$roll1 $tripod_pto`;
$r=`\\bin\\pano_modify.exe --output=roll2inirollpitch.pto --rotate=0,0,$roll2 inirollpitch.pto`;
$r=`\\bin\\pano_modify.exe --output=depitchroll2inirollpitch.pto --rotate=0,$depitch,0 r\\roll2inirollpitch.pto`;
$r=`\\bin\\pano_modify.exe --output=derolldepitchroll2inirollpitch.pto --rotate=0,0,$deroll depitchroll2inirollpitch.pto`;
$r=`\\bin\\nona.exe -m TIFF_m -o $imgfin derolldepitchroll2inirollpitch.pto $imgini`;
  and as usual tripod.pto has "dummy.TIF" for the filename. Before running this script I generated the pto for my desired output projection and canvas size, giving enough room for the gradually anti-rotated images. 
Below: a single 13 sec jpg; 10 images with "lighten" ; final de-rotated and stacked  sky, with the ground separately stacked, then combined in GIMP.
Woohoo, I have made the Earth turn backwards! Much appreciated your help Thomas.
20190903_single_jpg_sm.jpg20190903_Trail_sm.jpg20190902_WOS_med.jpg


Reply all
Reply to author
Forward
0 new messages