https://github.com/alyssaq/reconstruction
3D reconstruction with openCV and SFM
https://github.com/alyssaq/reconstruction
3d-reconstruction docker opencv sfm
Last synced: about 1 year ago
JSON representation
3D reconstruction with openCV and SFM
- Host: GitHub
- URL: https://github.com/alyssaq/reconstruction
- Owner: alyssaq
- Created: 2016-11-16T09:02:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-31T09:44:00.000Z (about 8 years ago)
- Last Synced: 2025-03-27T01:35:51.122Z (about 1 year ago)
- Topics: 3d-reconstruction, docker, opencv, sfm
- Language: C++
- Size: 9.77 KB
- Stars: 82
- Watchers: 1
- Forks: 25
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 3D reconstruction from multiple 2D images
The current [structure from motion (SFM)](https://github.com/opencv/opencv_contrib/tree/master/modules/sfm) module from [openCV's extra modules](https://github.com/opencv/opencv_contrib) only runs on Linux.
As such, I used [docker](https://www.docker.com) on my Mac to reconstruct the 3D points.
Current docker environment uses Ceres Solver 1.14.0 and OpenCV 3.4.1
## Docker Dev Environment
```sh
# Build the docker image
docker build -t opencv-sfm .
# Run the docker container mounting `reconstruction` folder to `/app`
docker run -it -v :/app opencv-sfm /bin/bash
```
## Run
1) Download 2D temple images from
2) Save list of images to `images.txt`:
```sh
# images.txt will contain lines of filepath
# /app/temple/temple0302.png
ls temple/*.png > images.txt
sed -i -e 's/^/\/app\//' images.txt
```
3) In the docker container, compile the cpp file
```
g++ example_sfm.cpp -L/usr/local/lib/ -lopencv_core -lopencv_sfm
```
4) Run the example with the list of images
```sh
./a.out # Prints the help text
./a.out images.txt 350 240 360
```
## Test
```sh
# Test eigen (http://eigen.tuxfamily.org/dox/GettingStarted.html)
g++ -I /usr/local/Cellar/eigen/3.3.4/include/eigen3 eigen_test.cpp -o eigen
./eigen
# Test with full includes
g++ example_sfm.cpp -I /usr/include/eigen3/ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L /usr/local/share/OpenCV/3rdparty/lib/ -L/usr/local/lib/ -L /usr/include/eigen3/ -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_optflow -lopencv_sfm -lopencv_viz
```
## License
[MIT](http://alyssaq.github.io/mit-license/)