1# `python-catkin-tools` is needed for catkin tool
2# `python3-dev` and `python3-catkin-pkg-modules` is needed to build cv_bridge
3# `python3-numpy` and `python3-yaml` is cv_bridge dependencies
4# `ros-melodic-cv-bridge` is needed to install a lot of cv_bridge deps. Probaply you already have it installed.
5sudo apt-get install python-catkin-tools python3-dev python3-catkin-pkg-modules python3-numpy python3-yaml ros-melodic-cv-bridge
6
7# Create catkin workspace
8mkdir catkin_workspace
9cd catkin_workspace
10catkin init
11# Instruct catkin to set cmake variables
12catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.6m.so
13# Instruct catkin to install built packages into install place. It is $CATKIN_WORKSPACE/install folder
14catkin config --install
15# Clone cv_bridge src
16git clone https://github.com/ros-perception/vision_opencv.git src/vision_opencv
17# Find version of cv_bridge in your repository
18apt-cache show ros-kinetic-cv-bridge | grep Version
19 Version: 1.13.0-0xenial-20180416-143935-0800
20# Checkout right version in git repo. In our case it is 1.12.8
21cd src/vision_opencv/
22git checkout 1.13.0
23cd ../../
24# Build
25catkin build cv_bridge
26# Extend environment with new package
27source install/setup.bash --extend
28
29
30
31
32############
33TEST
34############
35$ python3
36Python 3.5.2 (default, Nov 23 2017, 16:37:01)
37[GCC 5.4.0 20160609] on linux
38Type "help", "copyright", "credits" or "license" for more information.
39>>> from cv_bridge.boost.cv_bridge_boost import getCvType
40>>>