Hugin Panorama Creator with the Fairphone 2
Par Yves le dimanche 25 août 2019, 15:46 - Lien permanent
The computer has more options for stitching photos together than digital cameras have. Hugin Panorama Creator is free software and gives excellent results. However, to work correctly, Hugin needs the correct information for the lens used to take the photos! It is uncanny how inadequate lens data can impede Hugin’s algorithms to the point of rendering them absolutely useless.
The Fairphone 2 is not actually a digital camera for a start, and it is a niche phone at that. No wonder, that Hugin knows nothing about its lenses.
Thankfully, I found a nice tutorial by Alexandre Prokoudine about the correct usage of Hugin’s Calibrate Lens GUI.
To teach Hugin about the Fairphone 2, the first step is to take some photographs containing straight vertical and horizontal lines. It is not a problem if there are other details on the picture, such as furniture or trees.
I took 3 such pictures, taking care to have my phone parallel to the vertical and horizontal lines (house walls, furniture limits…), and not to zoom; I do not really know if I did well, but it led to the wanted result in the end.
Next, Hugin needs a combination of a focal distance and a “focal length multiplier”, which is, to the best of my knowledge, the “crop factor”. This is the difficult part, especially for phones, and the above article considers you already know these numbers…
I felt lucky when I found a technical page about the Fairphone 2, but the lens data is about the first model of the lens (OV8865), and I swapped the photo-module for the newer one (OV12870). At least, I got the order of magnitude, for reference.
The focal length is easy to find, because it is stored in each photograph taken with the Fairphone 2; it is
3.851 (often rounded up to 3.9 when displayed for information).
The crop factor is trickier to get. The technical sheet from the Fairphone shop tells about a pixel size of 1.25×1.25 µm. Then a page about another phone with the same lens tells about a 4032×3024 pixels resolution, which gives a sensor size of 5.04×3.78 mm. From there, providing the focal length and the sensor size, “Option 1” of an online calculator computes a crop factor of
In Hugin’s Calibrate Lens GUI, after I imported the photos and entered the 2 technical values found above, here is how I proceeded (but I am not an expert…):
- I clicked the
- In the “Preview” pane, I switched to the “Edge detection” view, and I un-selected all edges, that were not aligned with real “perfect” horizontal or vertical lines (for example, I removed tree branches, electrical wires…).
- I clicked the
- I saved the lens, with the lens name “FP2-2ndGen”.
To be honest, at first, I had not seen the information about the 1.25×1.25 µm size of pixels, so I used the 1.55×1.55 µm size found on the slightly better OV12890 chipset page, and I tried to somehow compensate for the fact, that the OV12870 chipset would be a bit different; anyway, the crop factor I used in the Calibrate Lens GUI was actually
6.76, and my stitchings went well, so I guess the software does give some leeway regarding the exactness of the technical values provided.