Adjust horizon in single image

77 views
Skip to first unread message

Matija Kogoj

unread,
May 31, 2020, 4:03:30 PM5/31/20
to hugin and other free panoramic software
Hello.

I have 7 equirectangular images from a 360 camera to blend into a hdr. One image's horizon is slightly offset.

All I need to do is to rotate the image slightly, i.e. to move a part of it that will push the other side down and do this until the horizon matches. Problem is that I don't know a correct way to do that:

After aligning I separated the problematic image from the stack, move/dragged it and rejoined it into the stack, the end result developed a gap *in the centre of the optical sensor*. This means that the image is physically continuous where the gap appeared, so what is going on? How do I fix this?

P.S. does anyone know what the correct value for focal length in an equirectangular image is? 0? This might be causing the above gap.

Thank you.

Matija Kogoj

unread,
Jun 2, 2020, 5:11:25 AM6/2/20
to hugin and other free panoramic software

Alright, I have figured something out - the edge is caused by the source images - the gap appears at the edge of the equirectangular source image. I suppose that when I displace the single image in question the image does not wrap around completely and leaves a blank space. Why hugin then does not cover that gap with the 6 other images, I don't know. This could be solved by using one of the additional command lines in the enblend engine. No idea which one yet, but I think they were discussed on this website.

Matija Kogoj

unread,
Jun 2, 2020, 5:43:42 AM6/2/20
to hugin and other free panoramic software

An image of the artefact in quick preview window. I didn't pay it mind before but it is at the same place. From the few visible pixels it looks like the entire image was compressed horizontally into that space, but all images seem to be accounted for. I am not sure whether this will mean anything, but I don't think the red band going through the stitch is supposed to be there. It might be that the image is not being stitched onto itself at the edges.

T. Modes

unread,
Jun 2, 2020, 11:48:25 AM6/2/20
to hugin and other free panoramic software
Hi,


Am Sonntag, 31. Mai 2020 22:03:30 UTC+2 schrieb Matija Kogoj:
P.S. does anyone know what the correct value for focal length in an equirectangular image is? 0? This might be causing the above gap.

For an equirectangular image use a hfov of 360 deg. Using the focal length could result in small rounding errors and so deviations from 360 deg. This could explain the gap.
On the photos tabs use the context menu on the image, edit image variables and set field of view to 360 deg.
The full equirectangular images has an aspect ratio of 2:1. This is recognized by Hugin automatically and the hfov is set to 360 deg.
But at least the image in your first link is not exactly 2:1. There are some pixel missing: it is 1438 px × 722 px. Maybe this is the cause for the gap?

Thomas

Matija Kogoj

unread,
Jun 4, 2020, 8:44:38 AM6/4/20
to hugin and other free panoramic software
Thanks for the response, but I don't thnk that was the case; the source images were in proper proportions -  the image I uploaded was cut by hand (mouse) through windows' snapping tool. Image variables were set to 360 degrees on all layers.

The gaps that appeared at the edges of the source files were corrected by setting --coarse-mask variable in enblend options.

The other thing is that even when I aligned the layer by hand (+ Apply), I think the position was reset for the end exr file. At first I thought my manual realignment was inadequate but I'm not sure anymore. Hugin seemed to have a problem with realigning one layer to the rest in equirectangular mode, so I had to go back to the original unstitched* files. I don't think Hugin supports dual-view circular fisheye cropping so I separated them into individual files. This gave me the option to set the view angle per lens/view to manufacture's specifications, i. e. 190 degrees. After setting up control points manually the panorama stitched with proper overlap. Some new gaps formed at sun's location, but I believe this is only due to the same issues I had previous years.

*For clarification - the mentioned original files from the camera come as a single file including two separate views from both lenses. These files were usually converted to blended equirectangular images by manufacturer's software.

T. Modes

unread,
Jun 4, 2020, 11:15:57 AM6/4/20
to hugin and other free panoramic software


Am Donnerstag, 4. Juni 2020 14:44:38 UTC+2 schrieb Matija Kogoj:
The gaps that appeared at the edges of the source files were corrected by setting --coarse-mask variable in enblend options.
Now I'm lost. Enblend is not involved when reproject a equirectancular image. It should only copy the input to the output image without changes. So the mask option should have no effect. So you must do more things than you describe.

I don't think Hugin supports dual-view circular fisheye cropping so I separated them into individual files.
Hugin supports dual-view fisheye images. So no need to manually fiddle with the images. There is already an user-defined assistant for such images, which handles all this. (It may need some fine-tuning for a specific camera. It was written and tested with images from only one camera.)

Thomas

panostar

unread,
Jun 8, 2020, 12:21:29 PM6/8/20
to hugin and other free panoramic software

On Tuesday, June 2, 2020 at 10:11:25 AM UTC+1, Matija Kogoj wrote:

Alright, I have figured something out - the edge is caused by the source images - the gap appears at the edge of the equirectangular source image. I suppose that when I displace the single image in question the image does not wrap around completely and leaves a blank space. Why hugin then does not cover that gap with the 6 other images, I don't know. This could be solved by using one of the additional command lines in the enblend engine. No idea which one yet, but I think they were discussed on this website.

You an check the 360x180 source images in Photoshop using Filter->Other->Offset, with the wrap option checked.  Shift the image sideways with the "horizontal" slider to move the wrap join into clear view.  No gap should be apparent.  Assuming the images have pixel dimensions in the exact ratio 2:1, the images can be loaded into Hugin and rotated/shifted up/down to be aligned without creating any gaps.

John 
Reply all
Reply to author
Forward
0 new messages