Git Product home page Git Product logo

spherical-sfm's Introduction

Spherical Structure-from-Motion

Elfin Forest

Code for our papers:

Baker, L., S. Mills, S. Zollmann, and J. Ventura, "CasualStereo: Casual Capture of Stereo Panoramas with Spherical Structure-from-Motion", IEEE Conference on Virtual Reality and 3D User Interfaces (VR), 2020.

Ventura, J., "Structure from Motion on a Sphere", European Conference on Computer Vision (ECCV), 2016.

Dependencies

  • OpenCV 3+
  • Ceres solver
  • Eigen 3+
  • Polynomial
  • CUDA (for stereo panorama stitcher)

Building

mkdir build ;
cd build ;
cmake .. ;
make -j8 ;

The panorama stitcher app is disabled by default, since it requires CUDA which may not be available on all machines. To enable it:

mkdir build ;
cd build ;
cmake .. -DBUILD_STITCHER=TRUE ;
make -j8 ;

Usage

If your images have radial distortion, first undistort them using:

undistort_images -intrinsics <path to intrinsics with distortion> -intrinsicsout <path for output intrinsics file> -video <path to video> -output <path ot folder for undistorted images> -rotate <rotation>

The "rotate" parameter is the number of clockwise 90 degree rotations to apply (useful for iPhone videos, for example).

To run the spherical structure-from-motion pipeline:

run_spherical_sfm -intrinsics <path to intrinsics> -video <path to video> -output <path to output>

The video path can be an image filename specifier such as %06d.png. The intrinsics file should contain the focal length, center x, and center y separated by spaces.

To make the stereo panoramas:

make_stereo_panorama -intrinsics <path to intrinsics> -video <path to video> -output <path to output>

Capture tips

  • Hold the camera in an outstretched hand and turn in a roughly level and complete circle (close the loop). Don't go too far over the loop closure point (no more than 30 degrees beyond the starting point).

Examples

You can view these example panoramas in a WebVR-compatible browser or headset.

spherical-sfm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spherical-sfm's Issues

Building Code with latest CUDA

I can't find any GPUs that still support CUDA 7. I am currently using a Lambda Labs machine with an A6000 (Ampere).

When I tried to run the container as is in the CUDA environment, it would give me this error on the final pano generator.

terminate called after throwing an instance of 'cv::Exception'   what():  OpenCV(4.1.0) /opencv_contrib/modules/cudev/include/opencv2/cudev/grid/detail/transform.hpp:312: error: (-217:Gpu API call) no kernel image is available for execution on the device in function 'call'  Aborted (core dumped)

Error is similar to this ticket.

To try a more recent container runtime, I tried the latest container tag + openCV versions for the base image. I tried various versions, including versions below with the same error.

FROM nvidia/cuda:11.2.1-devel-ubuntu18.04

ARG OPENCV_VERSION=4.5.2

         for ( int i = 0; i < keyframes.size(); i++ ) std::cout << i << "\t" << keyframes[i].t.transpose() << "\t" << so3ln(keyframes[i].R).transpose() << "\n";
                          ~~^~~~~~~~~~~~~~~~~~
/spherical-sfm/examples/stereo_panorama_tools.cpp:417:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for ( int i = 0; i < keyframes.size(); i++ ) std::cout << i << "\t" << keyframes[i].theta*180/M_PI << "\n";
                          ~~^~~~~~~~~~~~~~~~~~
/spherical-sfm/examples/stereo_panorama_tools.cpp:448:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for ( int i = 0; i < keyframes.size(); i++ ) std::cout << i << "\t" << keyframes[i].theta*180/M_PI << "\n";
                          ~~^~~~~~~~~~~~~~~~~~
/spherical-sfm/examples/stereo_panorama_tools.cpp:453:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for ( int i = 0; i < keyframes.size(); i++ )
                          ~~^~~~~~~~~~~~~~~~~~
/spherical-sfm/examples/stereo_panorama_tools.cpp:506:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for ( int kfnum = 0; kfnum < keyframes.size(); kfnum++ )
                              ~~~~~~^~~~~~~~~~~~~~~~~~
/spherical-sfm/examples/stereo_panorama_tools.cpp:509:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
           if ( !is_loop && kfnum == keyframes.size()-1 ) break;
                            ~~~~~~^~~~~~~~~~~~~~~~~~~~~
/spherical-sfm/examples/stereo_panorama_tools.cpp:554:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for ( int phinum = 0; phinum < phirange.size(); phinum++ )
                                   ~~~~~~~^~~~~~~~~~~~~~~~~
/spherical-sfm/examples/stereo_panorama_tools.cpp:533:16: warning: variable 'found_one_theta' set but not used [-Wunused-but-set-variable]
           bool found_one_theta = false;
                ^~~~~~~~~~~~~~~
/spherical-sfm/examples/stereo_panorama_tools.cpp:603:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for ( int i = 0; i < panoramas.size(); i++ )
                          ~~^~~~~~~~~~~~~~~~~~
/spherical-sfm/examples/stereo_panorama_tools.cpp:466:19: warning: unused variable 'width' [-Wunused-variable]
         const int width = keyframes[0].image.cols;
                   ^~~~~
/spherical-sfm/examples/stereo_panorama_tools.cpp:489:13: warning: unused variable 'last_leftnum' [-Wunused-variable]
         int last_leftnum = -1;
             ^~~~~~~~~~~~
examples/CMakeFiles/run_spherical_sfm.dir/build.make:62: recipe for target 'examples/CMakeFiles/run_spherical_sfm.dir/spherical_sfm_tools.cpp.o' failed
make[2]: *** [examples/CMakeFiles/run_spherical_sfm.dir/spherical_sfm_tools.cpp.o] Error 1
CMakeFiles/Makefile2:200: recipe for target 'examples/CMakeFiles/run_spherical_sfm.dir/all' failed
make[1]: *** [examples/CMakeFiles/run_spherical_sfm.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 94%] Linking CXX executable make_stereo_panorama
[ 94%] Built target make_stereo_panorama
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
The command '/bin/sh -c git clone https://github.com/jonathanventura/spherical-sfm.git &&     cd spherical-sfm &&     mkdir build && cd build &&     cmake .. -DBUILD_STITCHER=TRUE &&     make -j8 ;' returned a non-zero code: 2

make_stereo_panorama.cpp not build

When I build the project, the two files (undistort_images, run_spherical_sfm) were build successfully. However, make_stereo_panorama isn't build in the process. The build process didn't show any errors or messages, regarding why this file isn't build. I am attaching the build folder content for reference.
build_folder_content

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.