360° Panorama: How to calculate FullPanoHeightPixels and CroppedAreaTopPixel?

Started by Strontium, December 05, 2018, 03:42:58 AM

Previous topic - Next topic

Strontium

I have some equirectangular images in my panorama archive which don't have XMP metadata.

For 2:1 images which are 360° x 180° i am using

exiftool -ProjectionType=equirectangular -UsePanoramaViewer=True '-CroppedAreaImageWidthPixels<$ImageWidth' '-CroppedAreaImageHeightPixels<$ImageHeight' '-FullPanoWidthPixels<$ImageWidth' '-FullPanoHeightPixels<$ImageHeight' -CroppedAreaLeftPixels=0 -CroppedAreaTopPixels=0 full_spherical_panorama.jpg

to add the missing XMP metadata. That works fine as long as the images are 360° x 180°.

But on some images zenith and nadir are missing and they were no more 360° x 180° so i need to adjust FullPanoHeightPixels and CroppedAreaTopPixel

I have tried

'-FullPanoHeightPixels<$ImageWidth/2' '-CroppedAreaTopPixels<($ImageWidth/2-$ImageHeight)/2'

but it does not work.

How to achive it?

Thank you!



Phil Harvey

Quote from: Strontium on December 05, 2018, 03:42:58 AM
I have tried

'-FullPanoHeightPixels<$ImageWidth/2' '-CroppedAreaTopPixels<($ImageWidth/2-$ImageHeight)/2'

The right side of the argument when copying tags is a string, not a Perl expression, so it can't be used for mathematical manipulations.  But this can be done with either a user-defined tag or with an advanced formatting expression.  Typically user-defined tags are preferred if you want to have access to the value of more than one tag (which you need for CroppedAreaPixels), but with a little trick it can also be done in an advanced formatting expression:

'-FullPanoHeightPixels<${ImageWidth;$_/=2}' '-CroppedAreaTopPixels<${Imagewidth;$_=$_/2-$self->GetValue("ImageHeight")}'

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Strontium

Quote'-CroppedAreaTopPixels<${Imagewidth;$_=$_/2-$self->GetValue("ImageHeight")}'

Hi Phil, that value should be divided by 2

I have tried

'-CroppedAreaTopPixels<${(Imagewidth;$_=$_/2-$self->GetValue("ImageHeight"))/2}'

but it does not work. The output of exiftool is:

Warning: [minor] Tag '_' not defined - full_spherical_panorama.jpg

What am i doing wrong?
Thank you!

Phil Harvey

Sorry, this is it:

'-CroppedAreaTopPixels<${Imagewidth;$_=($_/2-$self->GetValue("ImageHeight"))/2}'
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).