mapillary / OpenSfM

Open source Structure-from-Motion pipeline
https://www.opensfm.org/
BSD 2-Clause "Simplified" License
3.38k stars 858 forks source link

Computing .ply output for equirectangular images #241

Closed angussmitchell closed 6 years ago

angussmitchell commented 6 years ago

Hi, I can't seem to compute depthmaps for equirectangular images. The pipleline outlined in the docs says I should be running the "undistort" command after successful reconstruction, then run "compute_depthmaps". Upon running "undistort" on the example 360 dataset, I get the following error:

bin/opensfm undistort data/kungsgatanparken/
2017-11-17 12:15:15,028 Undistorting the reconstruction
2017-11-17 12:15:21,832 Undistorting image 05.jpg
2017-11-17 12:15:21,833 Undistorting image 07.jpg
2017-11-17 12:15:21,834 Undistorting image 01.jpg
2017-11-17 12:15:21,836 Undistorting image 10.jpg
OpenCV Error: Assertion failed (dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX) in remap, file /home/a/opencv/opencv-3.2.0/modules/imgproc/src/imgwarp.cpp, line 4956
Traceback (most recent call last):
  File "bin/opensfm", line 34, in <module>
    command.run(args)
  File "/home/a/geoInteractive/sfm/opensfm/commands/undistort.py", line 28, in run
    self.undistort_images(graph, reconstructions[0], data)
  File "/home/a/geoInteractive/sfm/opensfm/commands/undistort.py", line 68, in undistort_images
    p.map(undistort_image, arguments)
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 251, in map
    return self.map_async(func, iterable, chunksize).get()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 567, in get
2017-11-17 12:15:22,575 Undistorting image 03.jpg
    raise self._value
cv2.error: /home/a/opencv/opencv-3.2.0/modules/imgproc/src/imgwarp.cpp:4956: error: (-215) dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX in function remap

OpenCV Error: Assertion failed (dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX) in remap, file /home/a/opencv/opencv-3.2.0/modules/imgproc/src/imgwarp.cpp, line 4956
OpenCV Error: Assertion failed (dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX) in remap, file /home/a/opencv/opencv-3.2.0/modules/imgproc/src/imgwarp.cpp, line 4956
OpenCV Error: Assertion failed (dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX) in remap, file /home/a/opencv/opencv-3.2.0/modules/imgproc/src/imgwarp.cpp, line 4956

I understand that an equirectangular panorama will not need to be undistorted, however the undistorted reconstruction output .yaml, images and tracks are needed to proceed with computing depthmaps.

Basically what I want to know is how we can get a .ply format point cloud from the reconstruction using equirectangular images.

Thanks for your time :)

angussmitchell commented 6 years ago

This issue was solved by updating opensfm to the latest version (what I wanted to do above was not supported previously)