Skip to content

Commit

Permalink
Fix OpenCV and Ceres versions (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
BAILOOL authored Oct 29, 2024
1 parent a999bdc commit 09a7a8c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 30 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
MC_CALIB_PROD_DOCKER_IMG: bailool/mc-calib-prod:opencv420
MC_CALIB_DEV_DOCKER_IMG: bailool/mc-calib-dev:opencv420

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
clang-format-lint:
Expand All @@ -42,7 +46,7 @@ jobs:
- name: Run cppcheck
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
image: ${{env.MC_CALIB_DEV_DOCKER_IMG}}
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
cppcheck MC-Calib/McCalib/include
Expand All @@ -58,7 +62,7 @@ jobs:
- name: Run clang-tidy
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
image: ${{env.MC_CALIB_DEV_DOCKER_IMG}}
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
mkdir MC-Calib/build && cd MC-Calib/build
Expand Down Expand Up @@ -90,7 +94,7 @@ jobs:
- name: Run tests
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
image: ${{env.MC_CALIB_DEV_DOCKER_IMG}}
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
mkdir MC-Calib/build && cd MC-Calib/build
Expand Down Expand Up @@ -122,7 +126,7 @@ jobs:
- name: Run tests
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
image: ${{env.MC_CALIB_DEV_DOCKER_IMG}}
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
mkdir MC-Calib/build && cd MC-Calib/build
Expand Down Expand Up @@ -165,7 +169,7 @@ jobs:
- name: Run tests
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-prod:latest
image: ${{env.MC_CALIB_PROD_DOCKER_IMG}}
options: -v ${{ github.workspace }}:/home/MC-Calib:rw
run: |
mkdir MC-Calib/build && cd MC-Calib/build
Expand Down Expand Up @@ -228,7 +232,7 @@ jobs:
- name: Run tests
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
image: ${{env.MC_CALIB_DEV_DOCKER_IMG}}
options: -v ${{ github.workspace }}:${{ github.workspace }}
run: |
mkdir ${{ github.workspace }}/build && cd ${{ github.workspace }}/build
Expand Down Expand Up @@ -266,7 +270,7 @@ jobs:
- name: Run python linters
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
image: ${{env.MC_CALIB_DEV_DOCKER_IMG}}
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
cd MC-Calib/python_utils
Expand All @@ -292,7 +296,7 @@ jobs:
- name: Run python utils
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-prod:latest
image: ${{env.MC_CALIB_PROD_DOCKER_IMG}}
options: -v ${{ github.workspace }}:/home/MC-Calib:rw
run: |
cd MC-Calib/python_utils
Expand Down
42 changes: 25 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:20.04 as prod
ENV DEBIAN_FRONTEND noninteractive
RUN apt update && apt install -y --no-install-recommends apt-utils && \
apt upgrade -y && apt autoremove -y && \
apt install -y build-essential cmake && \
apt install -y build-essential cmake wget unzip git && \
apt install -y python-is-python3 python3-pip && \
rm -rf /var/lib/apt/lists/*

Expand All @@ -15,7 +15,14 @@ WORKDIR /home
#------------------------------ #
# INSTALL OPENCV 4 #
#------------------------------ #
RUN apt update && apt install -y libopencv-dev && \
RUN wget -O opencv.zip https://github.com/opencv/opencv/archive/4.2.0.zip && \
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.2.0.zip && \
unzip opencv.zip && unzip opencv_contrib.zip && \
mkdir -p build && cd build && \
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.2.0/modules ../opencv-4.2.0 && \
cmake --build . --target install -- -j4 && \
cd /home && rm opencv.zip && rm opencv_contrib.zip && \
rm -rf opencv-4.2.0 && rm -rf opencv_contrib-4.2.0 && rm -rf build && \
rm -rf /var/lib/apt/lists/*

#------------------------------ #
Expand All @@ -27,36 +34,37 @@ RUN apt update && apt install -y libboost-all-dev && \
#------------------------------ #
# Install Ceres #
#------------------------------ #
RUN apt update && \
apt install -y libgoogle-glog-dev libgflags-dev libatlas-base-dev libeigen3-dev libsuitesparse-dev && \
RUN apt update && apt install -y libgoogle-glog-dev libgflags-dev libatlas-base-dev libeigen3-dev libsuitesparse-dev && \
rm -rf /var/lib/apt/lists/*
RUN apt update && apt install -y git && \
/bin/bash -c "git clone https://ceres-solver.googlesource.com/ceres-solver && \
RUN git clone --branch 20240722.0 --single-branch https://github.com/abseil/abseil-cpp.git && \
cd abseil-cpp && mkdir build && cd build && \
cmake .. && cmake --build . --target install -- -j4 && \
cd /home && rm -rf abseil-cpp && \
rm -rf /var/lib/apt/lists/*
RUN git clone --branch 2.2.0 --single-branch https://github.com/ceres-solver/ceres-solver.git && \
cd ceres-solver && mkdir build && cd build && cmake .. && \
make && make install && \
cd /home && rm -rf ceres-solver" && \
make -j4 && make -j4 install && \
cd /home && rm -rf ceres-solver && \
rm -rf /var/lib/apt/lists/*

# Install python requirements for python_utils scripts
RUN --mount=type=bind,source=python_utils/requirements_prod.txt,target=/tmp/requirements.txt \
pip install --requirement /tmp/requirements.txt && \
apt update && apt install -y libgl1 && \
python -m pip install --requirement /tmp/requirements.txt && \
rm -rf /var/lib/apt/lists/*

FROM prod as dev

RUN apt update && apt install -y python3-opencv && \
rm -rf /var/lib/apt/lists/*

#------------------------------ #
# Doxygen #
#------------------------------ #
RUN apt update && apt install -y flex bison && \
/bin/bash -c "git clone https://github.com/doxygen/doxygen.git && \
git clone https://github.com/doxygen/doxygen.git && \
cd doxygen && mkdir build && cd build &&\
cmake -G 'Unix Makefiles' .. && \
make && \
make install && \
cd /home && rm -rf doxygen" && \
make -j4 && \
make -j4 install && \
cd /home && rm -rf doxygen && \
rm -rf /var/lib/apt/lists/*

#------------------------------ #
Expand All @@ -67,5 +75,5 @@ RUN apt update && apt install -y cppcheck clang-tidy valgrind lcov && \

# Install python requirements for python_utils scripts
RUN --mount=type=bind,source=python_utils/requirements_dev.txt,target=/tmp/requirements.txt \
pip install --requirement /tmp/requirements.txt && \
python -m pip install --requirement /tmp/requirements.txt && \
rm -rf /var/lib/apt/lists/*
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Toolbox described in the paper ["MC-Calib: A generic and robust calibration tool

# Installation

Requirements: Ceres, Boost, OpenCV {4.2.x, 4.5.x}, c++17
Requirements: Ceres, Boost, OpenCV 4.2.0, c++17

For Windows users, follow [this installation guide](/docs/Windows.md)

Expand All @@ -20,8 +20,8 @@ There are several ways to get the environment ready. Choose any of them:
- Pull the image:

```bash
docker pull bailool/mc-calib-prod # production environment
docker pull bailool/mc-calib-dev # development environment
docker pull bailool/mc-calib-prod:opencv420 # production environment
docker pull bailool/mc-calib-dev:opencv420 # development environment
```

- Run pulled image (set `PATH_TO_REPO_ROOT` and `PATH_TO_DATA` appropriately):
Expand All @@ -31,14 +31,14 @@ There are several ways to get the environment ready. Choose any of them:
-ti --rm \
--volume="$PATH_TO_REPO_ROOT:/home/MC-Calib" \
--volume="$PATH_TO_DATA:/home/MC-Calib/data" \
bailool/mc-calib-prod
bailool/mc-calib-prod:opencv420
```

2. It is also possible to build the docker environment manually (see [instructions](/docs/Docker.md))

3. Alternatively, every dependency can be installed independently without docker:

- [Install](https://docs.opencv.org/4.5.2/d7/d9f/tutorial_linux_install.html) OpenCV 4.5.x. Either instal system-wide with `sudo make install` or link to your `build` in `CmakeLists.txt`.
- [Install](https://docs.opencv.org/4.2.0/d7/d9f/tutorial_linux_install.html) OpenCV 4.2.0. Either instal system-wide with `sudo make install` or link to your `build` in `CmakeLists.txt`.

- Follow [installation guidelines](http://ceres-solver.org/installation.html#linux) to install Ceres.

Expand Down

0 comments on commit 09a7a8c

Please sign in to comment.