Open derekhoiem opened 5 years ago
Interesting that there are equirectangulars with different proportions. As of now, we are assuming that equirectangular images cover the full sphere and have width = 2 * height. This implies that the central pixel corresponds to lat = lon = 0 on the sphere and has normalized coordinates x = y = 0.
As you are saying, if an image has different sizes, opensfm will fail to process it properly. What kind of equirectangular images are there that have width different than 2 * height? Are they cropped equirectangulars that only cover a fraction of the sphere or rescaled equirectangulars whose aspect ratio has been changed?
On extracting features on perspective views of the panoramas, that would certainly improve matching near the poles.
Popular cameras often have slightly varying aspect ratios depending on the settings, e.g. video or images. The Garmin Virb has an image aspect ratio of 3840 × 2160 px. It seems the images are not cropped but have different angular resolution in the vertical and horizontal directions. During feature matching, this doesn't cause a problem because the interpolation of the bearings from the row and column is still correct, but during undistortion this can cause problems.
In some equirectangular images, the width is not equal to 2x the height. In these cases, the denormalized_image_coordinates is incorrect, since the normalized coordinates will range from -0.25 to 0.25 (height) and -0.5 to 0.5 (width). This can cause the function to crash or to produce poor multiview stereo results. The fix is simple. For equirectangular images, modify denormalized_image_coordinates to multiply normalized value by width (for x value) and 2*height (for y value). This impacts only the rendering to perspective images.
Separately, the SfM can be improved for 360 images by undistorting, computing features on undistorted images, and projecting feature coordinates back to the 360 images, rather than computing features on the equirectangular images.