Development

[3D_Vision_Tutorial] Ubuntu 20.04 + OpenCV + Ceres Solver install - [1]

capaca 2023. 3. 22. 19:15

- https://github.com/mint-lab/3dv_tutorial : 3dvision tutorial code

- Dependency : OpenCV / Ceres Solver

 

๐Ÿฑ OpenCV Install

$ pkg-config --modversion opencv # OpenCV ๊ฐ€ ์ด๋ฏธ ๊น”๋ ค์žˆ๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ
$ pkg-config --modversion opencv4 # version 4 ๋ถ€ํ„ฐ๋Š” ์ด๋ ‡๊ฒŒ ํ™•์ธํ•ด์•ผํ•œ๋‹ค.

- Install ์ฐธ๊ณ  https://webnautes.tistory.com/1186

 

๐Ÿ’ซ Ceres-Solver install

# CMake
sudo apt-get install cmake
# google-glog + gflags
sudo apt-get install libgoogle-glog-dev libgflags-dev
# Use ATLAS for BLAS & LAPACK
sudo apt-get install libatlas-base-dev
# Eigen3
sudo apt-get install libeigen3-dev
# SuiteSparse (optional)
sudo apt-get install libsuitesparse-dev


wget http://ceres-solver.org/ceres-solver-2.1.0.tar.gz
tar zxf ceres-solver-2.1.0.tar.gz
mkdir ceres-bin
cd ceres-bin
cmake ../ceres-solver-2.1.0
make -j4
make test
# Optionally install Ceres, it can also be exported using CMake which
# allows Ceres to be used without requiring installation, see the documentation
# for the EXPORT_BUILD_DIR option for more information.
sudo make install

install_ceres.sh
0.00MB

 

 

๐Ÿช„ Ceres-solver test

- ํ•œ ํด๋”์— ์•„๋ž˜ ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜๊ณ  

- CMake ์ž‘์„ฑ๋ฒ• ์‚ฌ์šฉ๋ฒ• ์ฐธ๊ณ  (https://edward0im.github.io/technology/2020/09/16/cmake/)

https://ceres-solver.googlesource.com/ceres-solver/+/master/examples/helloworld.cc 

 

CMakeLists.txt
0.00MB
helloworld.cc
0.00MB

mkdir build
cd build
cmake ..
make

 

โš  Ceres-solver install error 1

Total Test time (real) =  78.95 sec

The following tests FAILED:
	  2 - cuda_memcheck_dense_cholesky_test (Failed)
	 25 - cuda_dense_cholesky_test (SEGFAULT)
	 27 - cuda_kernels_test (Child aborted)
	 28 - cuda_sparse_matrix_test (Child aborted)
	 29 - cuda_vector_test (Child aborted)
	 31 - dense_cholesky_test (Child aborted)
	104 - ba_denseschur_cuda_auto_test (Child aborted)
	121 - ba_denseschur_cuda_auto_threads_test (Child aborted)
	138 - ba_denseschur_cuda_user_test (Child aborted)
	155 - ba_denseschur_cuda_user_threads_test (Child aborted)
Errors while running CTest
make: *** [Makefile:130: test] Error 8

์ ‘๊ทผ 1 ) USE_CUDA ํ™œ์„ฑ

https://github.com/ceres-solver/ceres-solver/blob/master/CMakeLists.txt -> USE_CUDA ์„ค์ •์ด ํ•„์š”ํ•˜๋‹ค

https://www.cv-learn.com/20230321-ccmake/#more

์ ‘๊ทผ 2 ) wget์œผ๋กœ ๋‹ค์šด๋ฐ›์•„์„œ ์„ค์น˜ (clone์œผ๋กœ ํ•œ ํŒŒ์ผ ๋ง๊ณ  wget์œผ๋กœ ๋‹ค์šด๋ฐ›์•„์„œ ์„ค์น˜ํ•˜๋‹ˆ ๋œ๋‹ค,,ใ…Ž,,)

โš  Ceres-solver install error 2

-- Install configuration: "Release"
CMake Error at cmake_install.cmake:41 (file):
  file cannot create directory: /usr/local/lib/cmake/Ceres.  Maybe need
  administrative privileges.

-> make install ์€ sudo๋ฅผ ๋ถ™์ด์ž ๋”ฐ๋กœ cmake ๋•Œ INSTALL_PREFIX ๊ฒฝ๋กœ๋ฅผ ์ง€์ •ํ•œ ๊ฒƒ์ด ์•„๋‹ˆ๋ผ๋ฉด

 

๐Ÿ’ซ Clion setting

- ํ•™์ƒ ๊ณ„์ •์„ค์ • : https://www.jetbrains.com/community/education/#students

 

Free Educational Licenses - Community Support

Learn or teach how to code with best-of-industry tools from JetBrains. Free Educational Licenses for JetBrains' tools.

www.jetbrains.com

- ํ•™์ƒ ๊ณ„์ •์„ค์ • ๊ด€๋ จ ์ฐธ๊ณ  ๊ธ€

- Clion ๊ด€๋ จ ์ฐธ๊ณ  ๊ธ€

 

๐Ÿ“Œ Reference

[1] OpenCV install

- https://docs.opencv.org/4.x/df/d65/tutorial_table_of_content_introduction.html

- ์œ„ ํŽ˜์ด์ง€ ์ค‘

[2] with Ubuntu https://docs.opencv.org/4.x/d7/d9f/tutorial_linux_install.html

[3] Ceres Solver install http://ceres-solver.org/installation.html#linux

[4] Ceres Solver helloceres :https://github.com/LimHyungTae/helloceres