Hi group!

While fitting my panorama viewer with automatic metadata detection (using 
libexiv2) I noticed a problem: Hugin provides the UserComment Exif tag.This 
tag gives two field of view angles: the horizontal and the vertical. These 
are taken from the values which can be set in the openGL preview. The image 
which is written to disk in the final output is not this whole view, but 
the cropped section. The cropped section is often smaller than the whole 
screen shown by the openGL preview. In such cases, the values in the 
UserComment field are misleading. What's missing is the information about 
the cropping rectangle.

I noticed this when - naively - using the fov values in the UserComment 
field when displaying cropped stripe panoramas. This came out - at times 
grossly - wrong, and I finally figured out that the fov values in the 
UserComment are perfectly irrelevant for a panorama viewer if cropping is 
present but it's extent is unknown.

For spherical images, I can fall back on the GPano information, which 
supplies all the necessary information, but for other projections, where 
there is no GPano information, there is no way to figure out the image 
metrics to display such images correctly in a panorama viewer. To mend the 
situation, I'd recommend to extend the output to the UserComment Exif tag. 
Whats needed on top of the two field of view values are three 2D values, 
given in pixel coordinates:


   - size of the uncropped view (to which the field of view data pertain)
   - upper left and lower right corner of the cropped area


This is the same information that is displayed in the stitcher tab 
(panorama size and cropping information); it' also in the PTO file, like 
here:

p f2 w6000 h1682 v306  E10.8957 R0 S2520,3699,456,1249 n"TIFF_m c:LZW 
r:CROP"

where

w: width
h: height
v: hfov
S: crop

For sphericals, the values given by the GPano metadata are just that:

Cropped Area Image Height Pixels: 793
Cropped Area Image Width Pixels : 1179
Cropped Area Left Pixels        : 3049
Cropped Area Top Pixels         : 1379
Full Pano Height Pixels         : 3529
Full Pano Width Pixels          : 7058

The equivalence isn't immediately obvious; for the the cropped area it's

1249 - 456 = 793
3699 - 2520 = 1179

The 'full size' in the GPano data refers to a full spherical, whereas in 
PTO, it refers to the chosen fov (306 degrees in this example), so we have

3000 * 360 / 306 = 3529
6000 * 360 / 306 = 7059

And the GPano crop area left and top values are relative to the full 
spherical as well (calculations omitted)

The GPano format isn't usable for some projections: a 'full' cylindrical 
(360X180), for example, has infinite vertical extent, so it would be 
impossible to give a 'Full Pano Height' value. The hugin way of using the 
uncropped view's hfov and vfov as a reference, and the crop on top, makes 
PTO format suitable to describe sections of cylindricals etc. correctly, so 
I think the PTO convention should be followed when extending the user 
comment. By appending the full extent and crop information after the Ev 
information, software looking merely at the fov data would not fail, but 
software relying on cropping information could pick up the data and reject 
input missing the crop information or request further user input. So for 
the example used above, I'd propose this UserComment:

charset="Ascii" 
Projection: Equirectangular (2)
FOV: 306 x 86
Ev: 10,90
Extent: 6000,1682
Crop: 2520,3699,456,1249

This has all the information that's needed and works for all projections 
(like PTO). It's merely copying the relevant values from the PTO, so the 
data are at hand already, it's just a matter of conveying them into the 
UserComment exif tag, and the extension of the exif tag would not break 
older software inspecting the tag's content. What do you say?

Kay

-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/b315aa37-6f2c-4cfc-83af-71f2c2ec4897%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to