this is a simple ros pacakge for interfacing camera using opencv. it publishes on topics:
<camera_optical_frame_id>/image_raw
<camera_optical_frame_id>/image_raw/compressed
-
install the following on the Pi or Pc
sudo apt install libopencv-dev python3-opencv pip3 install opencv-python
-
create your <ros_ws> in the home dir. (replace <ros_ws> with your workspace name)
mkdir -p ~/<ros_ws>/src cd ~/<ros_ws> colcon build source ~/<ros_ws>/install/setup.bash
-
cd into the src folder of your <ros_ws> and download the mobo_bot packages
cd ~/<ros_ws>/src git clone https://github.com/robocre8/opencv_ros_camera.git
-
cd into the root directory of your <ros_ws> and run rosdep to install all necessary ros package dependencies
cd ~/<ros_ws>/ rosdep install --from-paths src --ignore-src -r -y
-
build your <ros_ws>
cd ~/<ros_ws>/ colcon build --symlink-install
-
don't forget to source your <ros_ws> in any new terminal
source ~/<ros_ws>/install/setup.bash
-
set the video port of your camera from the
camera_publisher.launch.py
filesource ~/<ros_ws>/install/setup.bash
-
run the ros opencv camera publisher node
ros2 launch opencv_ros_camera camera_publisher.launch.py
-
install rqt_image_view
sudo apt-get install ros-humble-rqt-image-view
-
run to view published images (compressed or raw)
ros2 run rqt_image_view rqt_image_view