Crop and FOV issue with circular fisheye

Asked by Dustin Kerstein

I'm trying to get Hugin to convert a single circular fisheye (Yasuhara Madoka on M43) image to Equirectangular and I am having some issues with the cropping / FOV. When using calculated lens parameters, Hugin always results in a narrower FOV output image than it should. Here are my steps:

1. Load a set of 10 images from a rotated panorama
2. Cropped to the circle bounds of the image, selected Circular fisheye and 180 degrees as lens type/FOV, selected Equirectangular projection with a 360x180 output FOV.
3. Generated control points and optimized
4. Saved resulting lens parameters to the database/file (the calculated FOV was 162.8 which felt a bit wrong...)
5. Output 360x180 Equirectangular panorama
6. Noted that the resulting vertical FOV is much narrower than it should be.

To try to narrow down things a bit I did the following:

1. Create new Hugin project and loaded a single image from that original set of 10
2. Loaded previous saved lens parameters, cropped to the circle bounds of the image, selected Circular fisheye and 180 degrees as lens type/FOV, selected Equirectangular projection with a 180x180 output FOV.
3. In both the Panorama Preview and actual rendered output you can see a narrower FOV than should be.

Then I tried just playing around with the crop tool in Hugin, but regardless of setting the crop circle larger than it should be (including the black regions) or setting it to the proper size, Hugin always gives me the same incorrectly cropped output image. If I make the crop circle much smaller than it should be, then the output image does correspond to the crop.

I have noticed that if I reset my lens parameters Hugin will output a more correct cropping. However, it still doesn't fill the frame of a 180x180 Equirectangular output when I specify the FOV to be 180. If I enter in something like 210, then things start to look a little more correct, but once I add in my lens parameters things break.

So, I'm confused as to why using the calculated lens parameters is totally throwing off my FOV/cropping.

Please see the images linked on my dropbox below and my lens ini settings:

https://www.dropbox.com/sh/gtqbe4nrsvy0i6p/AADxQOUnlf3_XJOFRgYrB-Lna?dl=0

Any clues as to what I'm doing wrong? Did Hugin just calculate bad lens parameters? But then that doesn't explain the weirdness in the FOV numbers (why setting a FOV to 210 results in more correct images with ABC lens parameters = 0). Maybe the FOV parameter represents the full uncropped region of the image frame rather than the cropped region. Is that correct?

I am able to get this working fairly easily in PTGui, but I'd like to have it working in Hugin as well. Also, I would somewhat expect to be able to use the same FOV/A/B/C values between Hugin and PTGui, but that doesn't seem to be the case. Should that work?

Thanks,
Dustin

Question information

Language:
English Edit question
Status:
Answered
For:
Hugin Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Dustin Kerstein (dustin-kerstein) said :
#1

I found this post - https://groups.google.com/forum/#!topic/hugin-ptx/dkseRDM8X30 - which is about circular fisheye FOV, but it doesn't solve any of my issues.

Revision history for this message
tmodes (tmodes) said :
#2

In Hugin the fov refers to the horizontal field of view of the uncropped image. PTGui is using another convention. So the parameter can not exchanged 1:1 between Hugin and PTGui.
See http://wiki.panotools.org/Panotools_internals#Cropping

The value of 162 is too low. So maybe there are some wrong control points and the optimizer has gone wrong.

PS: The projection of the Yasuhara Madoka 180 is orthographic (http://wiki.panotools.org/Fisheye ). But this projection make problems when using a cropped image in landscape.
I see currently 3 workarounds
1) Rotate the images before feeding into Hugin to portrait. Then the hfov becomes smaller and can be better handled by the optimizer.
2) Crop the image to the crop circle outside Hugin (use a square image)
3) Use circular fisheye as image projection. But then probably higher values for a/b/c are needed.

Revision history for this message
Dustin Kerstein (dustin-kerstein) said :
#3

Thanks for the info.

I tried rotating the photo to portrait beforehand (as a png) and then setting the lens type to Orthographic with a focal length of 7.3mm and crop factor of 2, and left the lens parameters at zero.

That results in a calculated FOV of 125.51 degrees.

However, after cropping to the image circle I still get an output image with the FOV narrower than it should be.

https://www.dropbox.com/s/ox7mp38ynovt63p/Hugin_PreRotated_Manual7.3mmFocalLenth_Orthogonal_Zero_ABC_values.jpg?dl=0

Are you able to take the following original (rotated) photo and correctly convert it to equirectangular?

https://www.dropbox.com/s/r9yq617bwu0357n/OriginalPhoto_Rotated.JPG?dl=0

Any further insight would be appreciated.

Thanks,
Dustin

Revision history for this message
tmodes (tmodes) said :
#4

> However, after cropping to the image circle I still get an output image with the FOV narrower than it should be.

I don't know what you expect. The image expands 180 degree vertically. And horizontally it expands also 180 degrees (at least on top and bottom of the equirectangular). The missing (white) half circles in the middle are not in the posted original image. (The image circle is slightly larger than the smaller image dimensions. So there are some little parts missing from the full half sphere.)
Hugin can't invent image content which is not in the original images.

Revision history for this message
Dustin Kerstein (dustin-kerstein) said :
#5

Sorry for not being clearer. I'm not talking about the missing circular regions. The photo is indeed a circular fisheye image partially cropped by the sensor. My issue is the missing regions at the extreme edges all around the image (top, bottom, and left/right beyond the missing half circles).

Here is an easy to view comparison between the two converted 180x180 Equirectangulars from PTGui (on the left) and Hugin (on the right) with red circles on some of the regions I'm talking about:

https://www.dropbox.com/s/wt8vza4iko0rpz0/ComparisonPTgui_Hugin.jpg?dl=0

These photos were converted using the following steps for both programs:

1. Rotate the photo to portrait in Photoshop
2. Load the image in PTGui/Hugin
3. Set the lens type to Orthographic (Hugin calculates FOV=125.51) and Circular Fisheye (PTGui calculates FOV=180) with a focal length of 7.3mm and crop factor of 2
4. Use the circle crop tool to crop to the image area
5. Reset lens parameters to default (zero)
6. Set output to Equirectangular 180x180

While neither of these output images are going to be perfect since I didn't use lens parameters, you can easily see that the Hugin output is not including the entire image area.

With this pre-rotated image, I also tried changing the default calculated Orthographic FOV in Hugin from 125.51 -> 180 and also using Circular Fisheye in Hugin with both the default calculated 101.88 FOV and manually set 180 FOV but none of those look like my PTGui image. The only thing that gets me close in Hugin is to use Circular Fisheye with a manually set FOV of around 150 at a crop factor of 2, which is the behavior I noted in my first post (though the numbers are different with the pre-rotated image).

Does that make sense? Would you be able to try converting that pre-rotated image yourself? It's very possible I'm just using Hugin incorrectly.

Thanks,
Dustin

Revision history for this message
tmodes (tmodes) said :
#6

Orthographic and fisheye use different mapping function. So you get different results especially and the image borders. And at the image border the results depends strongly on the fov (the printed focal length of the lens is too vague and the projection which uses the manufacturer to calculate the focal length is unknown, so the focal length is not precise enough for this task).

With your prerotated image and and fov of 118 I'm getting more at the image borders (or also with fisheye circular and a fov of around 150).
But instead of fiddeling with a single photo, shot a full circle with several images (e.g. 4 images) and try to stitch the images. Then you will get the fov (and maybe also the distortion parameters a, b, c) how Hugin expects its. In this scenario you can try both projections and see which one matches better with your lens.

Revision history for this message
Dustin Kerstein (dustin-kerstein) said :
#7

Sounds like you're getting similar results to what I saw.

From my initial test with 10 photos I was seeing this same level of over cropping, but I'll give it another shot with a new set of photos. I'll post back once I get that completed.

-Dustin

Can you help with this problem?

Provide an answer of your own, or ask Dustin Kerstein for more information if necessary.

To post a message you must log in.