Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ros2 opencv4 from Ana's branch #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,51 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir /src && mkdir /src/astrobee


# installing opencv4
RUN apt-get purge -y libopencv*

RUN cd /home
RUN mkdir opencv && cd opencv

RUN wget https://github.com/opencv/opencv/archive/refs/tags/4.2.0.zip
RUN unzip 4.2.0.zip
RUN rm 4.2.0.zip
RUN wget https://github.com/opencv/opencv_contrib/archive/refs/tags/4.2.0.zip
RUN unzip 4.2.0.zip
RUN rm 4.2.0.zip

RUN sudo apt update
RUN sudo apt install build-essential cmake git pkg-config libgtk-3-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
gfortran openexr libatlas-base-dev python3-dev python3-numpy \
libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev

RUN apt-get install opencl-headers

RUN cd /home/opencv/opencv-4.2.0
RUN mkdir -p build && cd build

RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.2.0/modules \
-D BUILD_EXAMPLES=ON ..

RUN make -j4
RUN sudo make install

RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/opencv/opencv-4.2.0/build/lib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joris997 if you want to set this env variable, you should use the tag ENV, as in
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/home/opencv/opencv-4.2.0/build/lib"


# zsh
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.5/zsh-in-docker.sh)" -- \
-t robbyrussell
RUN echo source /opt/ros/rolling/setup.zsh >> /root/.zshrc
RUN echo source /src/astrobee/install/setup.zsh >> /root/.zshrc
CMD [ "zsh" ]
ENV MAKEFLAGS="-j4"
ENV MAKEFLAGS="-j4"
1 change: 1 addition & 0 deletions description/astrobee_media
Submodule astrobee_media added at 316dd6
39 changes: 39 additions & 0 deletions scripts/install_opencv4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apt-get purge -y libopencv*

cd /home
mkdir opencv && cd opencv

wget https://github.com/opencv/opencv/archive/refs/tags/4.2.0.zip
unzip 4.2.0.zip
rm 4.2.0.zip
wget https://github.com/opencv/opencv_contrib/archive/refs/tags/4.2.0.zip
unzip 4.2.0.zip
rm 4.2.0.zip

sudo apt update
sudo apt install build-essential cmake git pkg-config libgtk-3-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
gfortran openexr libatlas-base-dev python3-dev python3-numpy \
libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev

apt-get install opencl-headers

cd /home/opencv/opencv-4.2.0
mkdir -p build && cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.2.0/modules \
-D BUILD_EXAMPLES=ON ..


make -j4
sudo make install


export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/opencv/opencv-4.2.0/build/lib
1 change: 1 addition & 0 deletions shared/config_reader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ include_directories(
include
${rclcpp_INCLUDE_DIRS}
${LUAJIT_INCLUDE_DIR}
${ff_common_INCLUDE_DIR}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed anymore after fixing ff_common

)

# Declare C++ libraries
Expand Down
1 change: 1 addition & 0 deletions shared/ff_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ include_directories(
include
${rclcpp_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${ff_common_INCLUDE_DIRS}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this inside ff_common?

)

# Declare C++ libraries
Expand Down