├── vision_opencv-noetic ├── cv_bridge │ ├── python │ │ ├── __init__.py.plain.in │ │ ├── cv_bridge │ │ │ └── __init__.py │ │ └── CMakeLists.txt │ ├── src │ │ ├── boost │ │ │ ├── README │ │ │ ├── predef │ │ │ │ ├── library │ │ │ │ │ └── c │ │ │ │ │ │ ├── _prefix.h │ │ │ │ │ │ └── gnu.h │ │ │ │ ├── detail │ │ │ │ │ ├── _cassert.h │ │ │ │ │ ├── test.h │ │ │ │ │ └── endian_compat.h │ │ │ │ ├── os │ │ │ │ │ ├── android.h │ │ │ │ │ ├── bsd │ │ │ │ │ │ ├── bsdi.h │ │ │ │ │ │ ├── dragonfly.h │ │ │ │ │ │ ├── free.h │ │ │ │ │ │ ├── net.h │ │ │ │ │ │ └── open.h │ │ │ │ │ ├── ios.h │ │ │ │ │ ├── macos.h │ │ │ │ │ └── bsd.h │ │ │ │ ├── version_number.h │ │ │ │ ├── make.h │ │ │ │ └── other │ │ │ │ │ └── endian.h │ │ │ ├── endian │ │ │ │ └── detail │ │ │ │ │ └── intrinsic.hpp │ │ │ └── core │ │ │ │ └── scoped_enum.hpp │ │ ├── module.hpp │ │ ├── CMakeLists.txt │ │ ├── pycompat.hpp │ │ └── module.cpp │ ├── rosdoc.yaml │ ├── setup.py │ ├── doc │ │ ├── mainpage.dox │ │ ├── index.rst │ │ └── conf.py │ ├── test │ │ ├── CMakeLists.txt │ │ ├── test_rgb_colors.cpp │ │ ├── test_compression.cpp │ │ ├── test_endian.cpp │ │ ├── python_bindings.py │ │ ├── enumerants.py │ │ ├── conversions.py │ │ ├── utest.cpp │ │ └── utest2.cpp │ ├── cmake │ │ └── cv_bridge-extras.cmake.in │ ├── package.xml │ ├── CMakeLists.txt │ └── include │ │ └── cv_bridge │ │ └── rgb_colors.h ├── image_geometry │ ├── src │ │ ├── image_geometry │ │ │ └── __init__.py │ │ └── stereo_camera_model.cpp │ ├── rosdoc.yaml │ ├── setup.py │ ├── test │ │ ├── CMakeLists.txt │ │ ├── directed.py │ │ └── utest_equi.cpp │ ├── doc │ │ ├── index.rst │ │ ├── mainpage.dox │ │ └── conf.py │ ├── include │ │ └── image_geometry │ │ │ ├── exports.h │ │ │ └── stereo_camera_model.h │ ├── package.xml │ └── CMakeLists.txt ├── opencv_tests │ ├── CMakeLists.txt │ ├── launch │ │ └── pong.launch │ ├── package.xml │ ├── nodes │ │ ├── broadcast.py │ │ ├── source.py │ │ └── rosfacedetect.py │ ├── mainpage.dox │ └── CHANGELOG.rst ├── vision_opencv │ ├── CMakeLists.txt │ ├── package.xml │ └── CHANGELOG.rst ├── README.rst └── LICENSE ├── CMakeLists.txt ├── usb_cam ├── mainpage.dox ├── AUTHORS.md ├── launch │ ├── usb_cam-test.launch │ ├── usb_cam-test2.launch │ ├── usb_cam-test3.launch │ ├── usb_cam-test4.launch │ ├── usb_cam-test5.launch │ └── usb_cam-dual_modal_rectified.launch ├── README.md ├── src │ └── LICENSE ├── package.xml ├── LICENSE ├── CMakeLists.txt ├── include │ └── usb_cam │ │ └── usb_cam.h └── nodes │ └── usb_cam_node.cpp ├── 参数 ├── ros_image │ ├── 1.png │ ├── 3.png │ ├── 180.png │ ├── rgb.py │ └── rgb.txt └── 环视相机标定 │ ├── 640 │ ├── head_camera_hou.yaml │ ├── head_camera_you.yaml │ ├── head_camera_qian.yaml │ └── head_camera_zuo.yaml │ └── 1280 │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── head_camera1.yaml │ ├── back_camera2.yaml │ ├── left_camera4.yaml │ └── right_camera3.yaml └── README.md /vision_opencv-noetic/cv_bridge/python/__init__.py.plain.in: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | /opt/ros/noetic/share/catkin/cmake/toplevel.cmake -------------------------------------------------------------------------------- /usb_cam/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | 4 | \b usb_cam is a ROS driver for V4L USB cameras. 5 | */ 6 | -------------------------------------------------------------------------------- /参数/ros_image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huashu996/camera_lidar_semantic_slam/HEAD/参数/ros_image/1.png -------------------------------------------------------------------------------- /参数/ros_image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huashu996/camera_lidar_semantic_slam/HEAD/参数/ros_image/3.png -------------------------------------------------------------------------------- /参数/ros_image/180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huashu996/camera_lidar_semantic_slam/HEAD/参数/ros_image/180.png -------------------------------------------------------------------------------- /参数/环视相机标定/1280/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huashu996/camera_lidar_semantic_slam/HEAD/参数/环视相机标定/1280/1.png -------------------------------------------------------------------------------- /参数/环视相机标定/1280/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huashu996/camera_lidar_semantic_slam/HEAD/参数/环视相机标定/1280/2.png -------------------------------------------------------------------------------- /参数/环视相机标定/1280/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huashu996/camera_lidar_semantic_slam/HEAD/参数/环视相机标定/1280/3.png -------------------------------------------------------------------------------- /参数/环视相机标定/1280/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huashu996/camera_lidar_semantic_slam/HEAD/参数/环视相机标定/1280/4.png -------------------------------------------------------------------------------- /参数/ros_image/rgb.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | img=cv2.imread('./1.png') 3 | cv2.imshow("rgb",img) 4 | cv2.waitKey(0) 5 | 6 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/src/image_geometry/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .cameramodels import PinholeCameraModel, StereoCameraModel 3 | -------------------------------------------------------------------------------- /vision_opencv-noetic/opencv_tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | project(opencv_tests) 3 | 4 | find_package(catkin REQUIRED) 5 | catkin_package() 6 | -------------------------------------------------------------------------------- /vision_opencv-noetic/vision_opencv/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | project(vision_opencv) 3 | find_package(catkin REQUIRED) 4 | catkin_metapackage() 5 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/README: -------------------------------------------------------------------------------- 1 | this code is taken from Boost at https://github.com/boostorg/endian.git 2 | We should remove this folder once Boost 1.58 or above is the default. 3 | -------------------------------------------------------------------------------- /usb_cam/AUTHORS.md: -------------------------------------------------------------------------------- 1 | Original Authors 2 | ---------------- 3 | 4 | * [Benjamin Pitzer] (benjamin.pitzer@bosch.com) 5 | 6 | Contributors 7 | ------------ 8 | 9 | * [Russell Toris](http://users.wpi.edu/~rctoris/) (rctoris@wpi.edu) 10 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/rosdoc.yaml: -------------------------------------------------------------------------------- 1 | - builder: doxygen 2 | name: C++ API 3 | output_dir: c++ 4 | file_patterns: '*.c *.cpp *.h *.cc *.hh *.dox' 5 | - builder: sphinx 6 | name: Python API 7 | output_dir: python 8 | sphinx_root_dir: doc 9 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/rosdoc.yaml: -------------------------------------------------------------------------------- 1 | - builder: sphinx 2 | name: Python API 3 | output_dir: python 4 | sphinx_root_dir: doc 5 | - builder: doxygen 6 | name: C++ API 7 | output_dir: c++ 8 | file_patterns: '*.c *.cpp *.h *.cc *.hh *.dox' 9 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import setup 3 | from catkin_pkg.python_setup import generate_distutils_setup 4 | 5 | d = generate_distutils_setup() 6 | 7 | d['packages'] = ['cv_bridge'] 8 | d['package_dir'] = {'' : 'python'} 9 | 10 | setup(**d) 11 | -------------------------------------------------------------------------------- /参数/ros_image/rgb.txt: -------------------------------------------------------------------------------- 1 | ground R128 G64 B128 2 | road R244 G35 B232 3 | car R0 G0 B142 4 | people R255 G0 B0 5 | bike R199 G11 B32 6 | build R70 G70 B70 7 | tree R107 G142 B35 8 | small tree R152 G251 B152 9 | sign R220 G220 B0 10 | 190 153 153 11 | 102 102 156 12 | 153 153 153 13 | 220 20 60 14 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import setup 3 | from catkin_pkg.python_setup import generate_distutils_setup 4 | 5 | d = generate_distutils_setup() 6 | 7 | d['packages'] = ['image_geometry'] 8 | d['package_dir'] = {'' : 'src'} 9 | 10 | setup(**d) 11 | -------------------------------------------------------------------------------- /vision_opencv-noetic/opencv_tests/launch/pong.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/python/cv_bridge/__init__.py: -------------------------------------------------------------------------------- 1 | from .core import CvBridge, CvBridgeError 2 | 3 | # python bindings 4 | try: 5 | # This try is just to satisfy doc jobs that are built differently. 6 | from cv_bridge.boost.cv_bridge_boost import cvtColorForDisplay, getCvType 7 | except ImportError: 8 | pass 9 | -------------------------------------------------------------------------------- /vision_opencv-noetic/README.rst: -------------------------------------------------------------------------------- 1 | vision_opencv 2 | ============= 3 | 4 | .. image:: https://travis-ci.org/ros-perception/vision_opencv.svg?branch=indigo 5 | :target: https://travis-ci.org/ros-perception/vision_opencv 6 | 7 | Packages for interfacing ROS with OpenCV, a library of programming functions for real time computer vision. 8 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/doc/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b cv_bridge contains classes for easily converting between ROS 6 | sensor_msgs/Image messages and OpenCV images. 7 | 8 | \section codeapi Code API 9 | 10 | - cv_bridge::CvImage 11 | - toCvCopy() 12 | - toCvShare() 13 | 14 | */ 15 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | catkin_add_nosetests(directed.py) 2 | 3 | catkin_add_gtest(${PROJECT_NAME}-utest utest.cpp) 4 | target_link_libraries(${PROJECT_NAME}-utest ${PROJECT_NAME} ${OpenCV_LIBS}) 5 | 6 | catkin_add_gtest(${PROJECT_NAME}-utest-equi utest_equi.cpp) 7 | target_link_libraries(${PROJECT_NAME}-utest-equi ${PROJECT_NAME} ${OpenCV_LIBS}) 8 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file(__init__.py.plain.in 2 | ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}/boost/__init__.py 3 | @ONLY 4 | ) 5 | 6 | install(FILES ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}/boost/__init__.py 7 | DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}/boost/ 8 | ) 9 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/doc/index.rst: -------------------------------------------------------------------------------- 1 | cv_bridge 2 | ========= 3 | 4 | ``cv_bridge`` contains a single class :class:`CvBridge` that converts ROS Image messages to 5 | OpenCV images. 6 | 7 | .. module:: cv_bridge 8 | 9 | .. autoclass:: cv_bridge.CvBridge 10 | :members: 11 | 12 | .. autoclass:: cv_bridge.CvBridgeError 13 | 14 | Indices and tables 15 | ================== 16 | 17 | * :ref:`genindex` 18 | * :ref:`search` 19 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/library/c/_prefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2008-2013 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_LIBRARY_C__PREFIX_H 9 | #define BOOST_PREDEF_LIBRARY_C__PREFIX_H 10 | 11 | #include 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/detail/_cassert.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2011-2012 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_DETAIL__CASSERT_H 9 | #define BOOST_PREDEF_DETAIL__CASSERT_H 10 | 11 | #if defined(__cplusplus) 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/detail/test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2011-2012 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_DETAIL_TEST_H 9 | #define BOOST_PREDEF_DETAIL_TEST_H 10 | 11 | #if !defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) 12 | 13 | #define BOOST_PREDEF_DECLARE_TEST(x,s) 14 | 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # add the tests 2 | 3 | # add boost directories for now 4 | include_directories("../src") 5 | 6 | catkin_add_gtest(${PROJECT_NAME}-utest test_endian.cpp test_compression.cpp utest.cpp utest2.cpp test_rgb_colors.cpp) 7 | target_link_libraries(${PROJECT_NAME}-utest 8 | ${PROJECT_NAME} 9 | ${OpenCV_LIBRARIES} 10 | ${catkin_LIBRARIES} 11 | ) 12 | 13 | catkin_add_nosetests(enumerants.py) 14 | catkin_add_nosetests(conversions.py) 15 | catkin_add_nosetests(python_bindings.py) 16 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/cmake/cv_bridge-extras.cmake.in: -------------------------------------------------------------------------------- 1 | set(OpenCV_VERSION @OpenCV_VERSION@) 2 | set(OpenCV_VERSION_MAJOR @OpenCV_VERSION_MAJOR@) 3 | set(OpenCV_VERSION_MINOR @OpenCV_VERSION_MINOR@) 4 | set(OpenCV_VERSION_PATCH @OpenCV_VERSION_PATCH@) 5 | set(OpenCV_SHARED @OpenCV_SHARED@) 6 | set(OpenCV_CONFIG_PATH @OpenCV_CONFIG_PATH@) 7 | set(OpenCV_INSTALL_PATH @OpenCV_INSTALL_PATH@) 8 | set(OpenCV_LIB_COMPONENTS @OpenCV_LIB_COMPONENTS@) 9 | set(OpenCV_USE_MANGLED_PATHS @OpenCV_USE_MANGLED_PATHS@) 10 | set(OpenCV_MODULES_SUFFIX @OpenCV_MODULES_SUFFIX@) 11 | 12 | 13 | -------------------------------------------------------------------------------- /vision_opencv-noetic/opencv_tests/package.xml: -------------------------------------------------------------------------------- 1 | 2 | opencv_tests 3 | 1.16.2 4 | 5 | Tests the enumerants of the ROS Image message, and functionally tests the Python and C++ implementations of CvBridge. 6 | 7 | James Bowman 8 | Vincent Rabaud 9 | BSD 10 | http://wiki.ros.org/opencv_tests 11 | 12 | catkin 13 | 14 | cv_bridge 15 | 16 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/test/test_rgb_colors.cpp: -------------------------------------------------------------------------------- 1 | #include "cv_bridge/rgb_colors.h" 2 | #include 3 | #include 4 | 5 | 6 | TEST(RGBColors, testGetRGBColor) 7 | { 8 | cv::Vec3d color; 9 | // red 10 | color = cv_bridge::rgb_colors::getRGBColor(cv_bridge::rgb_colors::RED); 11 | EXPECT_EQ(1, color[0]); 12 | EXPECT_EQ(0, color[1]); 13 | EXPECT_EQ(0, color[2]); 14 | // gray 15 | color = cv_bridge::rgb_colors::getRGBColor(cv_bridge::rgb_colors::GRAY); 16 | EXPECT_EQ(0.502, color[0]); 17 | EXPECT_EQ(0.502, color[1]); 18 | EXPECT_EQ(0.502, color[2]); 19 | } 20 | -------------------------------------------------------------------------------- /usb_cam/launch/usb_cam-test.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /usb_cam/launch/usb_cam-test2.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /usb_cam/launch/usb_cam-test3.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /usb_cam/launch/usb_cam-test4.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /usb_cam/launch/usb_cam-test5.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /usb_cam/README.md: -------------------------------------------------------------------------------- 1 | usb_cam [![Build Status](https://api.travis-ci.org/bosch-ros-pkg/usb_cam.png)](https://travis-ci.org/bosch-ros-pkg/usb_cam) 2 | ======= 3 | 4 | #### A ROS Driver for V4L USB Cameras 5 | This package is based off of V4L devices specifically instead of just UVC. 6 | 7 | For full documentation, see [the ROS wiki](http://ros.org/wiki/usb_cam). 8 | 9 | [Doxygen](http://docs.ros.org/indigo/api/usb_cam/html/) files can be found on the ROS wiki. 10 | 11 | ### License 12 | usb_cam is released with a BSD license. For full terms and conditions, see the [LICENSE](LICENSE) file. 13 | 14 | ### Authors 15 | See the [AUTHORS](AUTHORS.md) file for a full list of contributors. 16 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/doc/index.rst: -------------------------------------------------------------------------------- 1 | image_geometry 2 | ============== 3 | 4 | image_geometry simplifies interpreting images geometrically using the 5 | parameters from sensor_msgs/CameraInfo. 6 | 7 | .. module:: image_geometry 8 | 9 | .. autoclass:: image_geometry.PinholeCameraModel 10 | :members: fromCameraInfo, rectifyImage, rectifyPoint, tfFrame, project3dToPixel, projectPixelTo3dRay, distortionCoeffs, intrinsicMatrix, projectionMatrix, rotationMatrix, cx, cy, fx, fy 11 | 12 | .. autoclass:: image_geometry.StereoCameraModel 13 | :members: 14 | 15 | 16 | Indices and tables 17 | ================== 18 | 19 | * :ref:`genindex` 20 | * :ref:`search` 21 | 22 | -------------------------------------------------------------------------------- /参数/环视相机标定/1280/head_camera1.yaml: -------------------------------------------------------------------------------- 1 | image_width: 1280 2 | image_height: 720 3 | camera_name: head_camera 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [779.4823653921954, 0, 628.6914694726269, 0, 777.5860335839923, 398.4173447627671, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.1449521717343576, -0.1354310165376836, 0.00415280337450428, 0.002716269672321425, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1, 0, 0, 0, 1, 0, 0, 0, 1] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [808.7725830078125, 0, 631.936303004768, 0, 0, 807.7774047851562, 401.0608678868266, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /参数/环视相机标定/640/head_camera_hou.yaml: -------------------------------------------------------------------------------- 1 | image_width: 640 2 | image_height: 480 3 | camera_name: head_camera 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [406.0039791323973, 0, 307.317582902156, 0, 406.8737979919102, 260.792382594044, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.1735358027991951, -0.1385901447384028, 0.001781109239701169, 0.008828986860235491, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1, 0, 0, 0, 1, 0, 0, 0, 1] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [428.7516174316406, 0, 313.5803263172911, 0, 0, 432.7059631347656, 261.7666634605612, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /参数/环视相机标定/640/head_camera_you.yaml: -------------------------------------------------------------------------------- 1 | image_width: 640 2 | image_height: 480 3 | camera_name: head_camera 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [407.2963621142064, 0, 303.1031097115493, 0, 411.13207622267, 257.4468427813192, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.2076054545889219, -0.1553439933844838, 0.02140378753859882, 0.005636765783669448, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1, 0, 0, 0, 1, 0, 0, 0, 1] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [443.7763977050781, 0, 306.8617543974415, 0, 0, 440.9552612304688, 269.0175143262823, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /参数/环视相机标定/1280/back_camera2.yaml: -------------------------------------------------------------------------------- 1 | image_width: 1280 2 | image_height: 720 3 | camera_name: head_camera 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [791.1871961164622, 0, 607.2790605039955, 0, 791.971996567776, 383.3458438299946, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.1464203171663469, -0.1181813318364124, 0.0002051388350711801, 0.004132301144951801, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1, 0, 0, 0, 1, 0, 0, 0, 1] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [826.9217529296875, 0, 612.7087968448395, 0, 0, 830.4287719726562, 382.8626795365562, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /参数/环视相机标定/1280/left_camera4.yaml: -------------------------------------------------------------------------------- 1 | image_width: 1280 2 | image_height: 720 3 | camera_name: head_camera 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [729.2259063806434, 0, 615.9769923710511, 0, 732.3859625368948, 385.7840730294312, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.1399449845356306, -0.1061520459603149, -0.006215297402569644, -0.001843303508656936, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1, 0, 0, 0, 1, 0, 0, 0, 1] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [763.157470703125, 0, 611.6773255927837, 0, 0, 766.8507690429688, 380.5211294627425, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /参数/环视相机标定/1280/right_camera3.yaml: -------------------------------------------------------------------------------- 1 | image_width: 1280 2 | image_height: 720 3 | camera_name: head_camera 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [910.2603176274889, 0, 542.1988949090693, 0, 913.5108570297829, 400.3122035884714, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.1460757037907564, -0.06008696047304156, 0.01261869127591122, 0.01050242736834874, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1, 0, 0, 0, 1, 0, 0, 0, 1] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [977.5169677734375, 0, 559.5927385578179, 0, 0, 988.3997802734375, 409.6132640886171, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /参数/环视相机标定/640/head_camera_qian.yaml: -------------------------------------------------------------------------------- 1 | image_width: 640 2 | image_height: 480 3 | camera_name: head_camera 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [391.1769628660496, 0, 315.4258113689058, 0, 394.7880088913394, 266.6286636536627, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.1612996681564862, -0.1052009128280259, 0.01024918993532901, 0.006553911611330405, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1, 0, 0, 0, 1, 0, 0, 0, 1] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [419.1449890136719, 0, 320.5384088014052, 0, 0, 421.5286560058594, 272.6450786968908, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /参数/环视相机标定/640/head_camera_zuo.yaml: -------------------------------------------------------------------------------- 1 | image_width: 640 2 | image_height: 480 3 | camera_name: head_camera 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [406.541118825809, 0, 297.5936762928922, 0, 410.1701972457626, 245.2447134579461, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.2543627467456942, -0.246285718648723, 0.008358008567169306, -0.005044680708557243, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1, 0, 0, 0, 1, 0, 0, 0, 1] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [432.8377075195312, 0, 292.9966543572191, 0, 0, 438.5266723632812, 249.2542588883407, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/include/image_geometry/exports.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGE_GEOMETRY_EXPORTS_H 2 | #define IMAGE_GEOMETRY_EXPORTS_H 3 | 4 | #include 5 | 6 | // Import/export for windows dll's and visibility for gcc shared libraries. 7 | 8 | #ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries 9 | #ifdef image_geometry_EXPORTS // we are building a shared lib/dll 10 | #define IMAGE_GEOMETRY_DECL ROS_HELPER_EXPORT 11 | #else // we are using shared lib/dll 12 | #define IMAGE_GEOMETRY_DECL ROS_HELPER_IMPORT 13 | #endif 14 | #else // ros is being built around static libraries 15 | #define IMAGE_GEOMETRY_DECL 16 | #endif 17 | 18 | #endif // IMAGE_GEOMETRY_EXPORTS_H 19 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/detail/endian_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2013 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_DETAIL_ENDIAN_COMPAT_H 9 | #define BOOST_PREDEF_DETAIL_ENDIAN_COMPAT_H 10 | 11 | #include 12 | 13 | #if BOOST_ENDIAN_BIG_BYTE 14 | # define BOOST_BIG_ENDIAN 15 | # define BOOST_BYTE_ORDER 4321 16 | #endif 17 | #if BOOST_ENDIAN_LITTLE_BYTE 18 | # define BOOST_LITTLE_ENDIAN 19 | # define BOOST_BYTE_ORDER 1234 20 | #endif 21 | #if BOOST_ENDIAN_LITTLE_WORD 22 | # define BOOST_PDP_ENDIAN 23 | # define BOOST_BYTE_ORDER 2134 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /usb_cam/src/LICENSE: -------------------------------------------------------------------------------- 1 | Video for Linux Two API Specification 2 | Revision 0.24 3 | Michael H Schimek 4 | Bill Dirks 5 | Hans Verkuil 6 | Martin Rubli 7 | 8 | Copyright © 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin Rubli 9 | 10 | This document is copyrighted © 1999-2008 by Bill Dirks, Michael H. Schimek, Hans Verkuil and Martin Rubli. 11 | 12 | Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the appendix entitled "GNU Free Documentation License". 13 | 14 | Programming examples can be used and distributed without restrictions. 15 | -------------------------------------------------------------------------------- /vision_opencv-noetic/vision_opencv/package.xml: -------------------------------------------------------------------------------- 1 | 2 | vision_opencv 3 | 1.16.2 4 | Packages for interfacing ROS with OpenCV, a library of programming functions for real time computer vision. 5 | Patrick Mihelich 6 | James Bowman 7 | Vincent Rabaud 8 | BSD 9 | 10 | http://www.ros.org/wiki/vision_opencv 11 | https://github.com/ros-perception/vision_opencv/issues 12 | https://github.com/ros-perception/vision_opencv 13 | 14 | catkin 15 | 16 | cv_bridge 17 | image_geometry 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/doc/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b image_geometry contains camera model classes that simplify interpreting 6 | images geometrically using the calibration parameters from 7 | sensor_msgs/CameraInfo messages. They may be efficiently updated in your 8 | image callback: 9 | 10 | \code 11 | image_geometry::PinholeCameraModel model_; 12 | 13 | void imageCb(const sensor_msgs::ImageConstPtr& raw_image, 14 | const sensor_msgs::CameraInfoConstPtr& cam_info) 15 | { 16 | // Update the camera model (usually a no-op) 17 | model_.fromCameraInfo(cam_info); 18 | 19 | // Do processing... 20 | } 21 | \endcode 22 | 23 | \section codeapi Code API 24 | 25 | \b image_geometry contains two classes: 26 | - image_geometry::PinholeCameraModel - models a pinhole camera with distortion. 27 | - image_geometry::StereoCameraModel - models a stereo pair of pinhole cameras. 28 | 29 | */ 30 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/package.xml: -------------------------------------------------------------------------------- 1 | 2 | image_geometry 3 | 1.16.2 4 | 5 | `image_geometry` contains C++ and Python libraries for interpreting images 6 | geometrically. It interfaces the calibration parameters in sensor_msgs/CameraInfo 7 | messages with OpenCV functions such as image rectification, much as cv_bridge 8 | interfaces ROS sensor_msgs/Image with OpenCV data types. 9 | 10 | Patrick Mihelich 11 | Vincent Rabaud 12 | BSD 13 | http://www.ros.org/wiki/image_geometry 14 | 15 | 16 | 17 | 18 | 19 | catkin 20 | 21 | libopencv-dev 22 | sensor_msgs 23 | 24 | libopencv-dev 25 | libopencv-dev 26 | sensor_msgs 27 | 28 | dvipng 29 | texlive-latex-extra 30 | 31 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | project(image_geometry) 3 | 4 | find_package(catkin REQUIRED sensor_msgs) 5 | find_package(OpenCV REQUIRED) 6 | 7 | catkin_package(CATKIN_DEPENDS sensor_msgs 8 | DEPENDS OpenCV 9 | INCLUDE_DIRS include 10 | LIBRARIES ${PROJECT_NAME} 11 | ) 12 | 13 | catkin_python_setup() 14 | 15 | include_directories(include) 16 | include_directories(${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS}) 17 | 18 | # add a library 19 | add_library(${PROJECT_NAME} src/pinhole_camera_model.cpp src/stereo_camera_model.cpp) 20 | target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES}) 21 | add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS}) 22 | 23 | install(DIRECTORY include/${PROJECT_NAME}/ 24 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}/ 25 | ) 26 | 27 | # install library 28 | install(TARGETS ${PROJECT_NAME} 29 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 30 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 31 | RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} 32 | ) 33 | 34 | # add tests 35 | if(CATKIN_ENABLE_TESTING) 36 | add_subdirectory(test) 37 | endif() 38 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/os/android.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2015 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_OS_ADROID_H 9 | #define BOOST_PREDEF_OS_ADROID_H 10 | 11 | #include 12 | #include 13 | 14 | /*` 15 | [heading `BOOST_OS_ANDROID`] 16 | 17 | [@http://en.wikipedia.org/wiki/Android_%28operating_system%29 Android] operating system. 18 | 19 | [table 20 | [[__predef_symbol__] [__predef_version__]] 21 | 22 | [[`__ANDROID__`] [__predef_detection__]] 23 | ] 24 | */ 25 | 26 | #define BOOST_OS_ANDROID BOOST_VERSION_NUMBER_NOT_AVAILABLE 27 | 28 | #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ 29 | defined(__ANDROID__) \ 30 | ) 31 | # undef BOOST_OS_ANDROID 32 | # define BOOST_OS_ANDROID BOOST_VERSION_NUMBER_AVAILABLE 33 | #endif 34 | 35 | #if BOOST_OS_ANDROID 36 | # define BOOST_OS_ANDROID_AVAILABLE 37 | # include 38 | #endif 39 | 40 | #define BOOST_OS_ANDROID_NAME "Android" 41 | 42 | #endif 43 | 44 | #include 45 | BOOST_PREDEF_DECLARE_TEST(BOOST_OS_ANDROID,BOOST_OS_ANDROID_NAME) 46 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/module.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open Source Robotics Foundation, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef CV_BRIDGE_MODULE_HPP_ 18 | #define CV_BRIDGE_MODULE_HPP_ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 26 | #include 27 | 28 | #include 29 | 30 | namespace bp = boost::python; 31 | 32 | int convert_to_CvMat2(const PyObject* o, cv::Mat& m); 33 | 34 | PyObject* pyopencv_from(const cv::Mat& m); 35 | 36 | static void * do_numpy_import( ) 37 | { 38 | import_array( ); 39 | return nullptr; 40 | } 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/test/test_compression.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | TEST(CvBridgeTest, compression) 6 | { 7 | cv::RNG rng(0); 8 | std_msgs::Header header; 9 | 10 | // Test 3 channel images. 11 | for (int i = 0; i < 2; ++i) 12 | { 13 | const std::string format = (i == 0) ? "bgr8" : "rgb8"; 14 | cv::Mat_ in(10, 10); 15 | rng.fill(in, cv::RNG::UNIFORM, 0, 256); 16 | 17 | sensor_msgs::CompressedImagePtr msg = cv_bridge::CvImage(header, format, in).toCompressedImageMsg(cv_bridge::PNG); 18 | const cv_bridge::CvImageConstPtr out = cv_bridge::toCvCopy(msg, format); 19 | 20 | EXPECT_EQ(out->image.channels(), 3); 21 | EXPECT_EQ(cv::norm(out->image, in), 0); 22 | } 23 | 24 | // Test 4 channel images. 25 | for (int i = 0; i < 2; ++i) 26 | { 27 | const std::string format = (i == 0) ? "bgra8" : "rgba8"; 28 | cv::Mat_ in(10, 10); 29 | rng.fill(in, cv::RNG::UNIFORM, 0, 256); 30 | 31 | sensor_msgs::CompressedImagePtr msg = cv_bridge::CvImage(header, format, in).toCompressedImageMsg(cv_bridge::PNG); 32 | const cv_bridge::CvImageConstPtr out = cv_bridge::toCvCopy(msg, format); 33 | EXPECT_EQ(out->image.channels(), 4); 34 | EXPECT_EQ(cv::norm(out->image, in), 0); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/test/test_endian.cpp: -------------------------------------------------------------------------------- 1 | #include "boost/endian/conversion.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | TEST(CvBridgeTest, endianness) 7 | { 8 | using namespace boost::endian; 9 | 10 | // Create an image of the type opposite to the platform 11 | sensor_msgs::Image msg; 12 | msg.height = 1; 13 | msg.width = 1; 14 | msg.encoding = "32SC2"; 15 | msg.step = 8; 16 | 17 | msg.data.resize(msg.step); 18 | int32_t* data = reinterpret_cast(&msg.data[0]); 19 | 20 | // Write 1 and 2 in order, but with an endianness opposite to the platform 21 | if (order::native == order::little) 22 | { 23 | msg.is_bigendian = true; 24 | *(data++) = native_to_big(static_cast(1)); 25 | *data = native_to_big(static_cast(2)); 26 | } else { 27 | msg.is_bigendian = false; 28 | *(data++) = native_to_little(static_cast(1)); 29 | *data = native_to_little(static_cast(2)); 30 | } 31 | 32 | // Make sure the values are still the same 33 | cv_bridge::CvImageConstPtr img = cv_bridge::toCvShare(boost::make_shared(msg)); 34 | EXPECT_EQ(img->image.at(0, 0)[0], 1); 35 | EXPECT_EQ(img->image.at(0, 0)[1], 2); 36 | // Make sure we cannot share data 37 | EXPECT_NE(img->image.data, &msg.data[0]); 38 | } 39 | -------------------------------------------------------------------------------- /usb_cam/package.xml: -------------------------------------------------------------------------------- 1 | 2 | usb_cam 3 | 0.3.6 4 | A ROS Driver for V4L USB Cameras 5 | 6 | Russell Toris 7 | ROS Orphaned Package Maintainers 8 | Benjamin Pitzer 9 | 10 | BSD 11 | 12 | http://wiki.ros.org/usb_cam 13 | https://github.com/bosch-ros-pkg/usb_cam/issues 14 | https://github.com/bosch-ros-pkg/usb_cam 15 | 16 | catkin 17 | 18 | image_transport 19 | roscpp 20 | std_msgs 21 | std_srvs 22 | sensor_msgs 23 | ffmpeg 24 | camera_info_manager 25 | 26 | image_transport 27 | roscpp 28 | std_msgs 29 | std_srvs 30 | sensor_msgs 31 | ffmpeg 32 | camera_info_manager 33 | v4l-utils 34 | 35 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/os/bsd/bsdi.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2012-2015 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_OS_BSD_BSDI_H 9 | #define BOOST_PREDEF_OS_BSD_BSDI_H 10 | 11 | #include 12 | 13 | /*` 14 | [heading `BOOST_OS_BSD_BSDI`] 15 | 16 | [@http://en.wikipedia.org/wiki/BSD/OS BSDi BSD/OS] operating system. 17 | 18 | [table 19 | [[__predef_symbol__] [__predef_version__]] 20 | 21 | [[`__bsdi__`] [__predef_detection__]] 22 | ] 23 | */ 24 | 25 | #define BOOST_OS_BSD_BSDI BOOST_VERSION_NUMBER_NOT_AVAILABLE 26 | 27 | #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ 28 | defined(__bsdi__) \ 29 | ) 30 | # ifndef BOOST_OS_BSD_AVAILABLE 31 | # define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE 32 | # define BOOST_OS_BSD_AVAILABLE 33 | # endif 34 | # undef BOOST_OS_BSD_BSDI 35 | # define BOOST_OS_BSD_BSDI BOOST_VERSION_NUMBER_AVAILABLE 36 | #endif 37 | 38 | #if BOOST_OS_BSD_BSDI 39 | # define BOOST_OS_BSD_BSDI_AVAILABLE 40 | # include 41 | #endif 42 | 43 | #define BOOST_OS_BSD_BSDI_NAME "BSDi BSD/OS" 44 | 45 | #endif 46 | 47 | #include 48 | BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_BSDI,BOOST_OS_BSD_BSDI_NAME) 49 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/test/python_bindings.py: -------------------------------------------------------------------------------- 1 | from nose.tools import assert_equal 2 | import numpy as np 3 | 4 | import cv_bridge 5 | 6 | 7 | def test_cvtColorForDisplay(): 8 | # convert label image to display 9 | label = np.zeros((480, 640), dtype=np.int32) 10 | height, width = label.shape[:2] 11 | label_value = 0 12 | grid_num_y, grid_num_x = 3, 4 13 | for grid_row in range(grid_num_y): 14 | grid_size_y = height / grid_num_y 15 | min_y = grid_size_y * grid_row 16 | max_y = min_y + grid_size_y 17 | for grid_col in range(grid_num_x): 18 | grid_size_x = width / grid_num_x 19 | min_x = grid_size_x * grid_col 20 | max_x = min_x + grid_size_x 21 | label[int(min_y):int(max_y), int(min_x):int(max_x)] = label_value 22 | label_value += 1 23 | label_viz = cv_bridge.cvtColorForDisplay(label, '32SC1', 'bgr8') 24 | assert_equal(label_viz.dtype, np.uint8) 25 | assert_equal(label_viz.min(), 0) 26 | assert_equal(label_viz.max(), 255) 27 | 28 | # Check that mono8 conversion returns the right shape. 29 | bridge = cv_bridge.CvBridge() 30 | mono = np.random.random((100, 100)) * 255 31 | mono = mono.astype(np.uint8) 32 | 33 | input_msg = bridge.cv2_to_imgmsg(mono, encoding='mono8') 34 | output = bridge.imgmsg_to_cv2(input_msg, desired_encoding='mono8') 35 | assert_equal(output.shape, (100,100)) 36 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/os/bsd/dragonfly.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2012-2015 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_OS_BSD_DRAGONFLY_H 9 | #define BOOST_PREDEF_OS_BSD_DRAGONFLY_H 10 | 11 | #include 12 | 13 | /*` 14 | [heading `BOOST_OS_BSD_DRAGONFLY`] 15 | 16 | [@http://en.wikipedia.org/wiki/DragonFly_BSD DragonFly BSD] operating system. 17 | 18 | [table 19 | [[__predef_symbol__] [__predef_version__]] 20 | 21 | [[`__DragonFly__`] [__predef_detection__]] 22 | ] 23 | */ 24 | 25 | #define BOOST_OS_BSD_DRAGONFLY BOOST_VERSION_NUMBER_NOT_AVAILABLE 26 | 27 | #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ 28 | defined(__DragonFly__) \ 29 | ) 30 | # ifndef BOOST_OS_BSD_AVAILABLE 31 | # define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE 32 | # define BOOST_OS_BSD_AVAILABLE 33 | # endif 34 | # undef BOOST_OS_BSD_DRAGONFLY 35 | # if defined(__DragonFly__) 36 | # define BOOST_OS_DRAGONFLY_BSD BOOST_VERSION_NUMBER_AVAILABLE 37 | # endif 38 | #endif 39 | 40 | #if BOOST_OS_BSD_DRAGONFLY 41 | # define BOOST_OS_BSD_DRAGONFLY_AVAILABLE 42 | # include 43 | #endif 44 | 45 | #define BOOST_OS_BSD_DRAGONFLY_NAME "DragonFly BSD" 46 | 47 | #endif 48 | 49 | #include 50 | BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_DRAGONFLY,BOOST_OS_BSD_DRAGONFLY_NAME) 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # camera-lidar-slam 2 | We propose a semantic segmentation odometry and mapping method based on LIDAR and camera data vision fusion for real-time motion states estimation and high-level 3 | understanding of the surrounding environment. 4 | # RUN 5 | ## 跑自己数据集 6 | - 1.启动deeplabv3 ROS节点 7 | ``` 8 | cd DeepLabV3Plus-Pytorch 9 | conda activate deeplabv3 10 | python predict_ros.py 11 | ``` 12 | - 2.启动照片投影点云节点 13 | ``` 14 | catkin_make or catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3 15 | source devel/setup.bash 16 | roslaunch all_add_color all_add_color.launch 17 | 18 | ``` 19 | - 3.启动lego_loam 20 | ``` 21 | source devel/setup.bash 22 | roslaunch lego_loam run.launch 23 | 24 | ``` 25 | - 4.启动rosbag 26 | ``` 27 | rosbag play jixie.bag --clock 28 | 29 | ``` 30 | ## 跑kitti数据集 31 | - 1.启动deeplabv3 ROS节点 注意需要改话题 32 | ``` 33 | cd DeepLabV3Plus-Pytorch 34 | conda activate deeplabv3 35 | python predict_ros.py 36 | ``` 37 | - 2.启动照片投影点云节点,只有前视投影 38 | ``` 39 | catkin_make or catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3 40 | source devel/setup.bash 41 | roslaunch kittivelo_cam kittivelo_cam.launch 42 | 43 | ``` 44 | - 3.启动lego_loam 注意改话题 45 | ``` 46 | source devel/setup.bash 47 | roslaunch lego_loam run.launch 48 | 49 | ``` 50 | - 4.启动kitti的bag 51 | ``` 52 | rosbag play kitti.bag --clock 53 | ``` 54 | # 注意事项 55 | ## ubuntu20.04跑lego_loam 56 | Q:编译不报错,能够正常运行,但不显示地图和轨迹,只看到坐标系移动 57 | A:在mapOptmization.cpp文件中将以下代码中的/camera_init更改为camera_init,去除/ 58 | ## 激光雷达的线数修改 59 | 在LeGO-LOAM/includeutility.h文件中 60 | ## 如果用自己的相机,需要修改参数 61 | color_point/src/all_add_color/config/calib_result.yaml 62 | 63 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/package.xml: -------------------------------------------------------------------------------- 1 | 2 | cv_bridge 3 | 1.16.2 4 | 5 | This contains CvBridge, which converts between ROS 6 | Image messages and OpenCV images. 7 | 8 | Patrick Mihelich 9 | James Bowman 10 | Vincent Rabaud 11 | BSD 12 | http://www.ros.org/wiki/cv_bridge 13 | https://github.com/ros-perception/vision_opencv 14 | https://github.com/ros-perception/vision_opencv/issues 15 | 16 | 17 | 18 | 19 | 20 | catkin 21 | 22 | boost 23 | libopencv-dev 24 | python3 25 | python3-opencv 26 | rosconsole 27 | sensor_msgs 28 | 29 | boost 30 | libopencv-dev 31 | python3 32 | python3-opencv 33 | rosconsole 34 | libopencv-dev 35 | sensor_msgs 36 | 37 | rostest 38 | python3-numpy 39 | 40 | dvipng 41 | 42 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | project(cv_bridge) 3 | 4 | find_package(catkin REQUIRED COMPONENTS rosconsole sensor_msgs) 5 | 6 | if(NOT ANDROID) 7 | find_package(PythonLibs) 8 | 9 | if(PYTHONLIBS_VERSION_STRING VERSION_LESS "3.8") 10 | # Debian Buster 11 | find_package(Boost REQUIRED python37) 12 | else() 13 | # Ubuntu Focal 14 | find_package(Boost REQUIRED python) 15 | endif() 16 | else() 17 | find_package(Boost REQUIRED) 18 | endif() 19 | 20 | set(OpenCV_DIR "~/opencv-3.2.0/installed") 21 | find_package(OpenCV 4 REQUIRED) 22 | if(NOT OpenCV_FOUND) 23 | message(STATUS "Did not find OpenCV 4, trying OpenCV 3") 24 | set(_opencv_version 3) 25 | endif() 26 | 27 | find_package(OpenCV ${_opencv_version} REQUIRED 28 | COMPONENTS 29 | opencv_core 30 | opencv_imgproc 31 | opencv_imgcodecs 32 | CONFIG 33 | ) 34 | 35 | catkin_package( 36 | INCLUDE_DIRS include 37 | LIBRARIES ${PROJECT_NAME} 38 | CATKIN_DEPENDS rosconsole sensor_msgs 39 | DEPENDS OpenCV 40 | CFG_EXTRAS cv_bridge-extras.cmake 41 | ) 42 | 43 | catkin_python_setup() 44 | 45 | include_directories(include ${Boost_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS}) 46 | link_directories(${Boost_LIBRARY_DIRS}) 47 | 48 | if(NOT ANDROID) 49 | add_subdirectory(python) 50 | endif() 51 | add_subdirectory(src) 52 | if(CATKIN_ENABLE_TESTING) 53 | add_subdirectory(test) 54 | endif() 55 | 56 | # install the include folder 57 | install( 58 | DIRECTORY include/${PROJECT_NAME}/ 59 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 60 | ) 61 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/os/ios.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Franz Detro 2014 3 | Copyright Rene Rivera 2015 4 | Distributed under the Boost Software License, Version 1.0. 5 | (See accompanying file LICENSE_1_0.txt or copy at 6 | http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #ifndef BOOST_PREDEF_OS_IOS_H 10 | #define BOOST_PREDEF_OS_IOS_H 11 | 12 | #include 13 | #include 14 | 15 | /*` 16 | [heading `BOOST_OS_IOS`] 17 | 18 | [@http://en.wikipedia.org/wiki/iOS iOS] operating system. 19 | 20 | [table 21 | [[__predef_symbol__] [__predef_version__]] 22 | 23 | [[`__APPLE__`] [__predef_detection__]] 24 | [[`__MACH__`] [__predef_detection__]] 25 | [[`__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__`] [__predef_detection__]] 26 | 27 | [[`__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__`] [__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000]] 28 | ] 29 | */ 30 | 31 | #define BOOST_OS_IOS BOOST_VERSION_NUMBER_NOT_AVAILABLE 32 | 33 | #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ 34 | defined(__APPLE__) && defined(__MACH__) && \ 35 | defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) \ 36 | ) 37 | # undef BOOST_OS_IOS 38 | # define BOOST_OS_IOS (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000) 39 | #endif 40 | 41 | #if BOOST_OS_IOS 42 | # define BOOST_OS_IOS_AVAILABLE 43 | # include 44 | #endif 45 | 46 | #define BOOST_OS_IOS_NAME "iOS" 47 | 48 | #endif 49 | 50 | #include 51 | BOOST_PREDEF_DECLARE_TEST(BOOST_OS_IOS,BOOST_OS_IOS_NAME) 52 | -------------------------------------------------------------------------------- /vision_opencv-noetic/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2008, Willow Garage, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /usb_cam/LICENSE: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2014, Robert Bosch LLC. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer in the documentation and/or other materials provided 15 | with the distribution. 16 | * Neither the name of the Robert Bosch LLC. nor the names of its 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/test/enumerants.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import rostest 3 | import unittest 4 | 5 | import numpy as np 6 | import cv2 7 | 8 | import sensor_msgs.msg 9 | 10 | from cv_bridge import CvBridge, CvBridgeError, getCvType 11 | 12 | class TestEnumerants(unittest.TestCase): 13 | 14 | def test_enumerants_cv2(self): 15 | img_msg = sensor_msgs.msg.Image() 16 | img_msg.width = 640 17 | img_msg.height = 480 18 | img_msg.encoding = "rgba8" 19 | img_msg.step = 640*4 20 | img_msg.data = (640 * 480) * "1234" 21 | 22 | bridge_ = CvBridge() 23 | cvim = bridge_.imgmsg_to_cv2(img_msg, "rgb8") 24 | import sys 25 | self.assert_(sys.getrefcount(cvim) == 2) 26 | 27 | # A 3 channel image cannot be sent as an rgba8 28 | self.assertRaises(CvBridgeError, lambda: bridge_.cv2_to_imgmsg(cvim, "rgba8")) 29 | 30 | # but it can be sent as rgb8 and bgr8 31 | bridge_.cv2_to_imgmsg(cvim, "rgb8") 32 | bridge_.cv2_to_imgmsg(cvim, "bgr8") 33 | 34 | self.assert_(getCvType("32FC4") == cv2.CV_32FC4) 35 | self.assert_(getCvType("8UC1") == cv2.CV_8UC1) 36 | self.assert_(getCvType("8U") == cv2.CV_8UC1) 37 | 38 | def test_numpy_types(self): 39 | import cv2 40 | import numpy as np 41 | bridge_ = CvBridge() 42 | self.assertRaises(TypeError, lambda: bridge_.cv2_to_imgmsg(1, "rgba8")) 43 | if hasattr(cv2, 'cv'): 44 | self.assertRaises(TypeError, lambda: bridge_.cv2_to_imgmsg(cv2.cv(), "rgba8")) 45 | 46 | if __name__ == '__main__': 47 | rosunit.unitrun('opencv_tests', 'enumerants', TestEnumerants) 48 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/library/c/gnu.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2008-2015 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_LIBRARY_C_GNU_H 9 | #define BOOST_PREDEF_LIBRARY_C_GNU_H 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #if defined(__STDC__) 17 | #include 18 | #elif defined(__cplusplus) 19 | #include 20 | #endif 21 | 22 | /*` 23 | [heading `BOOST_LIB_C_GNU`] 24 | 25 | [@http://en.wikipedia.org/wiki/Glibc GNU glibc] Standard C library. 26 | Version number available as major, and minor. 27 | 28 | [table 29 | [[__predef_symbol__] [__predef_version__]] 30 | 31 | [[`__GLIBC__`] [__predef_detection__]] 32 | [[`__GNU_LIBRARY__`] [__predef_detection__]] 33 | 34 | [[`__GLIBC__`, `__GLIBC_MINOR__`] [V.R.0]] 35 | [[`__GNU_LIBRARY__`, `__GNU_LIBRARY_MINOR__`] [V.R.0]] 36 | ] 37 | */ 38 | 39 | #define BOOST_LIB_C_GNU BOOST_VERSION_NUMBER_NOT_AVAILABLE 40 | 41 | #if defined(__GLIBC__) || defined(__GNU_LIBRARY__) 42 | # undef BOOST_LIB_C_GNU 43 | # if defined(__GLIBC__) 44 | # define BOOST_LIB_C_GNU \ 45 | BOOST_VERSION_NUMBER(__GLIBC__,__GLIBC_MINOR__,0) 46 | # else 47 | # define BOOST_LIB_C_GNU \ 48 | BOOST_VERSION_NUMBER(__GNU_LIBRARY__,__GNU_LIBRARY_MINOR__,0) 49 | # endif 50 | #endif 51 | 52 | #if BOOST_LIB_C_GNU 53 | # define BOOST_LIB_C_GNU_AVAILABLE 54 | #endif 55 | 56 | #define BOOST_LIB_C_GNU_NAME "GNU" 57 | 58 | #endif 59 | 60 | #include 61 | BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_GNU,BOOST_LIB_C_GNU_NAME) 62 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/os/bsd/free.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2012-2015 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_OS_BSD_FREE_H 9 | #define BOOST_PREDEF_OS_BSD_FREE_H 10 | 11 | #include 12 | 13 | /*` 14 | [heading `BOOST_OS_BSD_FREE`] 15 | 16 | [@http://en.wikipedia.org/wiki/Freebsd FreeBSD] operating system. 17 | 18 | [table 19 | [[__predef_symbol__] [__predef_version__]] 20 | 21 | [[`__FreeBSD__`] [__predef_detection__]] 22 | 23 | [[`__FreeBSD_version`] [V.R.P]] 24 | ] 25 | */ 26 | 27 | #define BOOST_OS_BSD_FREE BOOST_VERSION_NUMBER_NOT_AVAILABLE 28 | 29 | #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ 30 | defined(__FreeBSD__) \ 31 | ) 32 | # ifndef BOOST_OS_BSD_AVAILABLE 33 | # define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE 34 | # define BOOST_OS_BSD_AVAILABLE 35 | # endif 36 | # undef BOOST_OS_BSD_FREE 37 | # if defined(__FreeBSD_version) 38 | # if __FreeBSD_version < 500000 39 | # define BOOST_OS_BSD_FREE \ 40 | BOOST_PREDEF_MAKE_10_VRP000(__FreeBSD_version) 41 | # else 42 | # define BOOST_OS_BSD_FREE \ 43 | BOOST_PREDEF_MAKE_10_VRR000(__FreeBSD_version) 44 | # endif 45 | # else 46 | # define BOOST_OS_BSD_FREE BOOST_VERSION_NUMBER_AVAILABLE 47 | # endif 48 | #endif 49 | 50 | #if BOOST_OS_BSD_FREE 51 | # define BOOST_OS_BSD_FREE_AVAILABLE 52 | # include 53 | #endif 54 | 55 | #define BOOST_OS_BSD_FREE_NAME "Free BSD" 56 | 57 | #endif 58 | 59 | #include 60 | BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_FREE,BOOST_OS_BSD_FREE_NAME) 61 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/version_number.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2005, 2008-2013 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_VERSION_NUMBER_H 9 | #define BOOST_PREDEF_VERSION_NUMBER_H 10 | 11 | /*` 12 | [heading `BOOST_VERSION_NUMBER`] 13 | 14 | `` 15 | BOOST_VERSION_NUMBER(major,minor,patch) 16 | `` 17 | 18 | Defines standard version numbers, with these properties: 19 | 20 | * Decimal base whole numbers in the range \[0,1000000000). 21 | The number range is designed to allow for a (2,2,5) triplet. 22 | Which fits within a 32 bit value. 23 | * The `major` number can be in the \[0,99\] range. 24 | * The `minor` number can be in the \[0,99\] range. 25 | * The `patch` number can be in the \[0,99999\] range. 26 | * Values can be specified in any base. As the defined value 27 | is an constant expression. 28 | * Value can be directly used in both preprocessor and compiler 29 | expressions for comparison to other similarly defined values. 30 | * The implementation enforces the individual ranges for the 31 | major, minor, and patch numbers. And values over the ranges 32 | are truncated (modulo). 33 | 34 | */ 35 | #define BOOST_VERSION_NUMBER(major,minor,patch) \ 36 | ( (((major)%100)*10000000) + (((minor)%100)*100000) + ((patch)%100000) ) 37 | 38 | #define BOOST_VERSION_NUMBER_MAX \ 39 | BOOST_VERSION_NUMBER(99,99,99999) 40 | 41 | #define BOOST_VERSION_NUMBER_ZERO \ 42 | BOOST_VERSION_NUMBER(0,0,0) 43 | 44 | #define BOOST_VERSION_NUMBER_MIN \ 45 | BOOST_VERSION_NUMBER(0,0,1) 46 | 47 | #define BOOST_VERSION_NUMBER_AVAILABLE \ 48 | BOOST_VERSION_NUMBER_MIN 49 | 50 | #define BOOST_VERSION_NUMBER_NOT_AVAILABLE \ 51 | BOOST_VERSION_NUMBER_ZERO 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /usb_cam/launch/usb_cam-dual_modal_rectified.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/os/macos.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2008-2015 3 | Copyright Franz Detro 2014 4 | Distributed under the Boost Software License, Version 1.0. 5 | (See accompanying file LICENSE_1_0.txt or copy at 6 | http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #ifndef BOOST_PREDEF_OS_MACOS_H 10 | #define BOOST_PREDEF_OS_MACOS_H 11 | 12 | /* Special case: iOS will define the same predefs as MacOS, and additionally 13 | '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__'. We can guard against that, 14 | but only if we detect iOS first. Hence we will force include iOS detection 15 | * before doing any MacOS detection. 16 | */ 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | /*` 23 | [heading `BOOST_OS_MACOS`] 24 | 25 | [@http://en.wikipedia.org/wiki/Mac_OS Mac OS] operating system. 26 | 27 | [table 28 | [[__predef_symbol__] [__predef_version__]] 29 | 30 | [[`macintosh`] [__predef_detection__]] 31 | [[`Macintosh`] [__predef_detection__]] 32 | [[`__APPLE__`] [__predef_detection__]] 33 | [[`__MACH__`] [__predef_detection__]] 34 | 35 | [[`__APPLE__`, `__MACH__`] [10.0.0]] 36 | [[ /otherwise/ ] [9.0.0]] 37 | ] 38 | */ 39 | 40 | #define BOOST_OS_MACOS BOOST_VERSION_NUMBER_NOT_AVAILABLE 41 | 42 | #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ 43 | defined(macintosh) || defined(Macintosh) || \ 44 | (defined(__APPLE__) && defined(__MACH__)) \ 45 | ) 46 | # undef BOOST_OS_MACOS 47 | # if !defined(BOOST_OS_MACOS) && defined(__APPLE__) && defined(__MACH__) 48 | # define BOOST_OS_MACOS BOOST_VERSION_NUMBER(10,0,0) 49 | # endif 50 | # if !defined(BOOST_OS_MACOS) 51 | # define BOOST_OS_MACOS BOOST_VERSION_NUMBER(9,0,0) 52 | # endif 53 | #endif 54 | 55 | #if BOOST_OS_MACOS 56 | # define BOOST_OS_MACOS_AVAILABLE 57 | # include 58 | #endif 59 | 60 | #define BOOST_OS_MACOS_NAME "Mac OS" 61 | 62 | #endif 63 | 64 | #include 65 | BOOST_PREDEF_DECLARE_TEST(BOOST_OS_MACOS,BOOST_OS_MACOS_NAME) 66 | -------------------------------------------------------------------------------- /usb_cam/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(usb_cam) 3 | 4 | ## Find catkin macros and libraries 5 | ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) 6 | ## is used, also find other catkin packages 7 | find_package(catkin REQUIRED COMPONENTS image_transport roscpp std_msgs std_srvs sensor_msgs camera_info_manager) 8 | 9 | ## pkg-config libraries 10 | find_package(PkgConfig REQUIRED) 11 | pkg_check_modules(avcodec libavcodec REQUIRED) 12 | pkg_check_modules(swscale libswscale REQUIRED) 13 | 14 | ################################################### 15 | ## Declare things to be passed to other projects ## 16 | ################################################### 17 | 18 | ## LIBRARIES: libraries you create in this project that dependent projects also need 19 | ## CATKIN_DEPENDS: catkin_packages dependent projects also need 20 | ## DEPENDS: system dependencies of this project that dependent projects also need 21 | catkin_package( 22 | INCLUDE_DIRS include 23 | LIBRARIES ${PROJECT_NAME} 24 | ) 25 | 26 | ########### 27 | ## Build ## 28 | ########### 29 | 30 | include_directories(include 31 | ${catkin_INCLUDE_DIRS} 32 | ${avcodec_INCLUDE_DIRS} 33 | ${swscale_INCLUDE_DIRS} 34 | ) 35 | 36 | ## Build the USB camera library 37 | add_library(${PROJECT_NAME} src/usb_cam.cpp) 38 | target_link_libraries(${PROJECT_NAME} 39 | ${avcodec_LIBRARIES} 40 | ${swscale_LIBRARIES} 41 | ${catkin_LIBRARIES} 42 | ) 43 | 44 | ## Declare a cpp executable 45 | add_executable(${PROJECT_NAME}_node nodes/usb_cam_node.cpp) 46 | target_link_libraries(${PROJECT_NAME}_node 47 | ${PROJECT_NAME} 48 | ${avcodec_LIBRARIES} 49 | ${swscale_LIBRARIES} 50 | ${catkin_LIBRARIES} 51 | ) 52 | 53 | ############# 54 | ## Install ## 55 | ############# 56 | 57 | ## Mark executables and/or libraries for installation 58 | install(TARGETS ${PROJECT_NAME}_node ${PROJECT_NAME} 59 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 60 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 61 | ) 62 | 63 | ## Copy launch files 64 | install(DIRECTORY launch/ 65 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch 66 | FILES_MATCHING PATTERN "*.launch" 67 | ) 68 | 69 | install(DIRECTORY include/${PROJECT_NAME}/ 70 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 71 | FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" 72 | ) 73 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/os/bsd/net.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2012-2015 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_OS_BSD_NET_H 9 | #define BOOST_PREDEF_OS_BSD_NET_H 10 | 11 | #include 12 | 13 | /*` 14 | [heading `BOOST_OS_BSD_NET`] 15 | 16 | [@http://en.wikipedia.org/wiki/Netbsd NetBSD] operating system. 17 | 18 | [table 19 | [[__predef_symbol__] [__predef_version__]] 20 | 21 | [[`__NETBSD__`] [__predef_detection__]] 22 | [[`__NetBSD__`] [__predef_detection__]] 23 | 24 | [[`__NETBSD_version`] [V.R.P]] 25 | [[`NetBSD0_8`] [0.8.0]] 26 | [[`NetBSD0_9`] [0.9.0]] 27 | [[`NetBSD1_0`] [1.0.0]] 28 | [[`__NetBSD_Version`] [V.R.P]] 29 | ] 30 | */ 31 | 32 | #define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER_NOT_AVAILABLE 33 | 34 | #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ 35 | defined(__NETBSD__) || defined(__NetBSD__) \ 36 | ) 37 | # ifndef BOOST_OS_BSD_AVAILABLE 38 | # define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE 39 | # define BOOST_OS_BSD_AVAILABLE 40 | # endif 41 | # undef BOOST_OS_BSD_NET 42 | # if defined(__NETBSD__) 43 | # if defined(__NETBSD_version) 44 | # if __NETBSD_version < 500000 45 | # define BOOST_OS_BSD_NET \ 46 | BOOST_PREDEF_MAKE_10_VRP000(__NETBSD_version) 47 | # else 48 | # define BOOST_OS_BSD_NET \ 49 | BOOST_PREDEF_MAKE_10_VRR000(__NETBSD_version) 50 | # endif 51 | # else 52 | # define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER_AVAILABLE 53 | # endif 54 | # elif defined(__NetBSD__) 55 | # if !defined(BOOST_OS_BSD_NET) && defined(NetBSD0_8) 56 | # define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER(0,8,0) 57 | # endif 58 | # if !defined(BOOST_OS_BSD_NET) && defined(NetBSD0_9) 59 | # define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER(0,9,0) 60 | # endif 61 | # if !defined(BOOST_OS_BSD_NET) && defined(NetBSD1_0) 62 | # define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER(1,0,0) 63 | # endif 64 | # if !defined(BOOST_OS_BSD_NET) && defined(__NetBSD_Version) 65 | # define BOOST_OS_BSD_NET \ 66 | BOOST_PREDEF_MAKE_10_VVRR00PP00(__NetBSD_Version) 67 | # endif 68 | # if !defined(BOOST_OS_BSD_NET) 69 | # define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER_AVAILABLE 70 | # endif 71 | # endif 72 | #endif 73 | 74 | #if BOOST_OS_BSD_NET 75 | # define BOOST_OS_BSD_NET_AVAILABLE 76 | # include 77 | #endif 78 | 79 | #define BOOST_OS_BSD_NET_NAME "DragonFly BSD" 80 | 81 | #endif 82 | 83 | #include 84 | BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_NET,BOOST_OS_BSD_NET_NAME) 85 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # add library 2 | include_directories(./) 3 | add_library(${PROJECT_NAME} cv_bridge.cpp rgb_colors.cpp) 4 | add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS}) 5 | target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES} ${catkin_LIBRARIES}) 6 | 7 | install(TARGETS ${PROJECT_NAME} 8 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 9 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 10 | RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} 11 | ) 12 | 13 | if(NOT ANDROID) 14 | # add a Boost Python library 15 | find_package(PythonInterp REQUIRED) 16 | find_package(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") 17 | 18 | #Get the numpy include directory from its python module 19 | if(NOT PYTHON_NUMPY_INCLUDE_DIR) 20 | execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.get_include())" 21 | RESULT_VARIABLE PYTHON_NUMPY_PROCESS 22 | OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR 23 | OUTPUT_STRIP_TRAILING_WHITESPACE) 24 | 25 | if(PYTHON_NUMPY_PROCESS EQUAL 0) 26 | file(TO_CMAKE_PATH "${PYTHON_NUMPY_INCLUDE_DIR}" PYTHON_NUMPY_INCLUDE_CMAKE_PATH) 27 | set(PYTHON_NUMPY_INCLUDE_DIR ${PYTHON_NUMPY_INCLUDE_CMAKE_PATH} CACHE PATH "Numpy include directory") 28 | else(PYTHON_NUMPY_PROCESS EQUAL 0) 29 | message(SEND_ERROR "Could not determine the NumPy include directory, verify that NumPy was installed correctly.") 30 | endif(PYTHON_NUMPY_PROCESS EQUAL 0) 31 | endif(NOT PYTHON_NUMPY_INCLUDE_DIR) 32 | 33 | include_directories(${PYTHON_INCLUDE_PATH} ${Boost_INCLUDE_DIRS} ${PYTHON_NUMPY_INCLUDE_DIR}) 34 | 35 | if (PYTHON_VERSION_MAJOR VERSION_EQUAL 3) 36 | add_definitions(-DPYTHON3) 37 | endif() 38 | 39 | add_library(${PROJECT_NAME}_boost module.cpp module_opencv4.cpp) 40 | target_link_libraries(${PROJECT_NAME}_boost ${Boost_LIBRARIES} 41 | ${catkin_LIBRARIES} 42 | ${PROJECT_NAME} 43 | ) 44 | 45 | if(NOT APPLE) 46 | target_link_libraries(${PROJECT_NAME}_boost ${PYTHON_LIBRARIES}) 47 | endif() 48 | 49 | set_target_properties(${PROJECT_NAME}_boost PROPERTIES 50 | LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_PYTHON_DESTINATION}/${PROJECT_NAME}/boost/ 51 | RUNTIME_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_PYTHON_DESTINATION}/${PROJECT_NAME}/boost/ 52 | PREFIX "" 53 | ) 54 | if(APPLE) 55 | set_target_properties(${PROJECT_NAME}_boost PROPERTIES 56 | SUFFIX ".so") 57 | set_target_properties(${PROJECT_NAME}_boost PROPERTIES 58 | LINK_FLAGS "-undefined dynamic_lookup") 59 | endif() 60 | if(MSVC) 61 | set_target_properties(${PROJECT_NAME}_boost PROPERTIES 62 | SUFFIX ".pyd") 63 | endif() 64 | 65 | install(TARGETS ${PROJECT_NAME}_boost DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}/boost/) 66 | endif() 67 | -------------------------------------------------------------------------------- /vision_opencv-noetic/opencv_tests/nodes/broadcast.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Software License Agreement (BSD License) 3 | # 4 | # Copyright (c) 2008, Willow Garage, Inc. 5 | # Copyright (c) 2016, Tal Regev. 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 12 | # * Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # * Redistributions in binary form must reproduce the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer in the documentation and/or other materials provided 17 | # with the distribution. 18 | # * Neither the name of the Willow Garage nor the names of its 19 | # contributors may be used to endorse or promote products derived 20 | # from this software without specific prior written permission. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | # POSSIBILITY OF SUCH DAMAGE. 34 | 35 | import sys 36 | import time 37 | import math 38 | import rospy 39 | import cv2 40 | 41 | import sensor_msgs.msg 42 | from cv_bridge import CvBridge 43 | 44 | 45 | # Send each image by iterate it from given array of files names to a given topic, 46 | # as a regular and compressed ROS Images msgs. 47 | class Source: 48 | 49 | def __init__(self, topic, filenames): 50 | self.pub = rospy.Publisher(topic, sensor_msgs.msg.Image) 51 | self.pub_compressed = rospy.Publisher(topic + "/compressed", sensor_msgs.msg.CompressedImage) 52 | self.filenames = filenames 53 | 54 | def spin(self): 55 | time.sleep(1.0) 56 | cvb = CvBridge() 57 | while not rospy.core.is_shutdown(): 58 | cvim = cv2.imload(self.filenames[0]) 59 | self.pub.publish(cvb.cv2_to_imgmsg(cvim)) 60 | self.pub_compressed.publish(cvb.cv2_to_compressed_imgmsg(cvim)) 61 | self.filenames = self.filenames[1:] + [self.filenames[0]] 62 | time.sleep(1) 63 | 64 | 65 | def main(args): 66 | s = Source(args[1], args[2:]) 67 | rospy.init_node('Source') 68 | try: 69 | s.spin() 70 | rospy.spin() 71 | outcome = 'test completed' 72 | except KeyboardInterrupt: 73 | print("shutting down") 74 | outcome = 'keyboard interrupt' 75 | rospy.core.signal_shutdown(outcome) 76 | 77 | if __name__ == '__main__': 78 | main(sys.argv) 79 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/endian/detail/intrinsic.hpp: -------------------------------------------------------------------------------- 1 | // endian/detail/intrinsic.hpp -------------------------------------------------------// 2 | 3 | // Copyright (C) 2012 David Stone 4 | // Copyright Beman Dawes 2013 5 | 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // http://www.boost.org/LICENSE_1_0.txt 8 | 9 | #ifndef BOOST_ENDIAN_INTRINSIC_HPP 10 | #define BOOST_ENDIAN_INTRINSIC_HPP 11 | 12 | // Allow user to force BOOST_ENDIAN_NO_INTRINSICS in case they aren't available for a 13 | // particular platform/compiler combination. Please report such platform/compiler 14 | // combinations to the Boost mailing list. 15 | #ifndef BOOST_ENDIAN_NO_INTRINSICS 16 | 17 | #ifndef __has_builtin // Optional of course 18 | #define __has_builtin(x) 0 // Compatibility with non-clang compilers 19 | #endif 20 | 21 | // GCC and Clang recent versions provide intrinsic byte swaps via builtins 22 | #if (defined(__clang__) && __has_builtin(__builtin_bswap32) && __has_builtin(__builtin_bswap64)) \ 23 | || (defined(__GNUC__ ) && \ 24 | (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) 25 | # define BOOST_ENDIAN_INTRINSIC_MSG "__builtin_bswap16, etc." 26 | // prior to 4.8, gcc did not provide __builtin_bswap16 on some platforms so we emulate it 27 | // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 28 | // Clang has a similar problem, but their feature test macros make it easier to detect 29 | # if (defined(__clang__) && __has_builtin(__builtin_bswap16)) \ 30 | || (defined(__GNUC__) &&(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) 31 | # define BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_2(x) __builtin_bswap16(x) 32 | # else 33 | # define BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_2(x) __builtin_bswap32((x) << 16) 34 | # endif 35 | # define BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_4(x) __builtin_bswap32(x) 36 | # define BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(x) __builtin_bswap64(x) 37 | 38 | // Linux systems provide the byteswap.h header, with 39 | #elif defined(__linux__) 40 | // don't check for obsolete forms defined(linux) and defined(__linux) on the theory that 41 | // compilers that predefine only these are so old that byteswap.h probably isn't present. 42 | # define BOOST_ENDIAN_INTRINSIC_MSG "byteswap.h bswap_16, etc." 43 | # include 44 | # define BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_2(x) bswap_16(x) 45 | # define BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_4(x) bswap_32(x) 46 | # define BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(x) bswap_64(x) 47 | 48 | #elif defined(_MSC_VER) 49 | // Microsoft documents these as being compatible since Windows 95 and specificly 50 | // lists runtime library support since Visual Studio 2003 (aka 7.1). 51 | # define BOOST_ENDIAN_INTRINSIC_MSG "cstdlib _byteswap_ushort, etc." 52 | # include 53 | # define BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_2(x) _byteswap_ushort(x) 54 | # define BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_4(x) _byteswap_ulong(x) 55 | # define BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(x) _byteswap_uint64(x) 56 | #else 57 | # define BOOST_ENDIAN_NO_INTRINSICS 58 | # define BOOST_ENDIAN_INTRINSIC_MSG "no byte swap intrinsics" 59 | #endif 60 | 61 | #elif !defined(BOOST_ENDIAN_INTRINSIC_MSG) 62 | # define BOOST_ENDIAN_INTRINSIC_MSG "no byte swap intrinsics" 63 | #endif // BOOST_ENDIAN_NO_INTRINSICS 64 | #endif // BOOST_ENDIAN_INTRINSIC_HPP 65 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/pycompat.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | // Defines for Python 2/3 compatibility. 44 | #ifndef __PYCOMPAT_HPP__ 45 | #define __PYCOMPAT_HPP__ 46 | 47 | #if PY_MAJOR_VERSION >= 3 48 | // Python3 treats all ints as longs, PyInt_X functions have been removed. 49 | #define PyInt_Check PyLong_Check 50 | #define PyInt_CheckExact PyLong_CheckExact 51 | #define PyInt_AsLong PyLong_AsLong 52 | #define PyInt_AS_LONG PyLong_AS_LONG 53 | #define PyInt_FromLong PyLong_FromLong 54 | #define PyNumber_Int PyNumber_Long 55 | 56 | // Python3 strings are unicode, these defines mimic the Python2 functionality. 57 | #define PyString_Check PyUnicode_Check 58 | #define PyString_FromString PyUnicode_FromString 59 | #define PyString_FromStringAndSize PyUnicode_FromStringAndSize 60 | #define PyString_Size PyUnicode_GET_SIZE 61 | 62 | // PyUnicode_AsUTF8 isn't available until Python 3.3 63 | #if (PY_VERSION_HEX < 0x03030000) 64 | #define PyString_AsString _PyUnicode_AsString 65 | #else 66 | #define PyString_AsString PyUnicode_AsUTF8 67 | #endif 68 | #endif 69 | 70 | #endif // END HEADER GUARD 71 | -------------------------------------------------------------------------------- /vision_opencv-noetic/opencv_tests/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b opencv_tests is ... 6 | 7 | 14 | 15 | 16 | \section codeapi Code API 17 | 18 | 28 | 29 | \section rosapi ROS API 30 | 31 | 42 | 43 | 89 | 90 | 91 | 118 | 119 | */ -------------------------------------------------------------------------------- /vision_opencv-noetic/opencv_tests/nodes/source.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Software License Agreement (BSD License) 3 | # 4 | # Copyright (c) 2008, Willow Garage, Inc. 5 | # Copyright (c) 2016, Tal Regev. 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 12 | # * Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # * Redistributions in binary form must reproduce the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer in the documentation and/or other materials provided 17 | # with the distribution. 18 | # * Neither the name of the Willow Garage nor the names of its 19 | # contributors may be used to endorse or promote products derived 20 | # from this software without specific prior written permission. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | # POSSIBILITY OF SUCH DAMAGE. 34 | 35 | import sys 36 | import time 37 | import math 38 | import rospy 39 | import numpy 40 | import cv2 41 | 42 | import sensor_msgs.msg 43 | from cv_bridge import CvBridge 44 | 45 | 46 | # Send black pic with a circle as regular and compressed ros msgs. 47 | class Source: 48 | 49 | def __init__(self): 50 | self.pub = rospy.Publisher("/opencv_tests/images", sensor_msgs.msg.Image) 51 | self.pub_compressed = rospy.Publisher("/opencv_tests/images/compressed", sensor_msgs.msg.CompressedImage) 52 | 53 | def spin(self): 54 | time.sleep(1.0) 55 | started = time.time() 56 | counter = 0 57 | cvim = numpy.zeros((480, 640, 1), numpy.uint8) 58 | ball_xv = 10 59 | ball_yv = 10 60 | ball_x = 100 61 | ball_y = 100 62 | 63 | cvb = CvBridge() 64 | 65 | while not rospy.core.is_shutdown(): 66 | 67 | cvim.fill(0) 68 | cv2.circle(cvim, (ball_x, ball_y), 10, 255, -1) 69 | 70 | ball_x += ball_xv 71 | ball_y += ball_yv 72 | if ball_x in [10, 630]: 73 | ball_xv = -ball_xv 74 | if ball_y in [10, 470]: 75 | ball_yv = -ball_yv 76 | 77 | self.pub.publish(cvb.cv2_to_imgmsg(cvim)) 78 | self.pub_compressed.publish(cvb.cv2_to_compressed_imgmsg(cvim)) 79 | time.sleep(0.03) 80 | 81 | 82 | def main(args): 83 | s = Source() 84 | rospy.init_node('Source') 85 | try: 86 | s.spin() 87 | rospy.spin() 88 | outcome = 'test completed' 89 | except KeyboardInterrupt: 90 | print("shutting down") 91 | outcome = 'keyboard interrupt' 92 | rospy.core.signal_shutdown(outcome) 93 | 94 | if __name__ == '__main__': 95 | main(sys.argv) 96 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/os/bsd.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2008-2015 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_OS_BSD_H 9 | #define BOOST_PREDEF_OS_BSD_H 10 | 11 | /* Special case: OSX will define BSD predefs if the sys/param.h 12 | * header is included. We can guard against that, but only if we 13 | * detect OSX first. Hence we will force include OSX detection 14 | * before doing any BSD detection. 15 | */ 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | /*` 22 | [heading `BOOST_OS_BSD`] 23 | 24 | [@http://en.wikipedia.org/wiki/Berkeley_Software_Distribution BSD] operating system. 25 | 26 | BSD has various branch operating systems possible and each detected 27 | individually. This detects the following variations and sets a specific 28 | version number macro to match: 29 | 30 | * `BOOST_OS_BSD_DRAGONFLY` [@http://en.wikipedia.org/wiki/DragonFly_BSD DragonFly BSD] 31 | * `BOOST_OS_BSD_FREE` [@http://en.wikipedia.org/wiki/Freebsd FreeBSD] 32 | * `BOOST_OS_BSD_BSDI` [@http://en.wikipedia.org/wiki/BSD/OS BSDi BSD/OS] 33 | * `BOOST_OS_BSD_NET` [@http://en.wikipedia.org/wiki/Netbsd NetBSD] 34 | * `BOOST_OS_BSD_OPEN` [@http://en.wikipedia.org/wiki/Openbsd OpenBSD] 35 | 36 | [note The general `BOOST_OS_BSD` is set in all cases to indicate some form 37 | of BSD. If the above variants is detected the corresponding macro is also set.] 38 | 39 | [table 40 | [[__predef_symbol__] [__predef_version__]] 41 | 42 | [[`BSD`] [__predef_detection__]] 43 | [[`_SYSTYPE_BSD`] [__predef_detection__]] 44 | 45 | [[`BSD4_2`] [4.2.0]] 46 | [[`BSD4_3`] [4.3.0]] 47 | [[`BSD4_4`] [4.4.0]] 48 | [[`BSD`] [V.R.0]] 49 | ] 50 | */ 51 | 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | 58 | #ifndef BOOST_OS_BSD 59 | #define BOOST_OS_BSD BOOST_VERSION_NUMBER_NOT_AVAILABLE 60 | #endif 61 | 62 | #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ 63 | defined(BSD) || \ 64 | defined(_SYSTYPE_BSD) \ 65 | ) 66 | # undef BOOST_OS_BSD 67 | # include 68 | # if !defined(BOOST_OS_BSD) && defined(BSD4_4) 69 | # define BOOST_OS_BSD BOOST_VERSION_NUMBER(4,4,0) 70 | # endif 71 | # if !defined(BOOST_OS_BSD) && defined(BSD4_3) 72 | # define BOOST_OS_BSD BOOST_VERSION_NUMBER(4,3,0) 73 | # endif 74 | # if !defined(BOOST_OS_BSD) && defined(BSD4_2) 75 | # define BOOST_OS_BSD BOOST_VERSION_NUMBER(4,2,0) 76 | # endif 77 | # if !defined(BOOST_OS_BSD) && defined(BSD) 78 | # define BOOST_OS_BSD BOOST_PREDEF_MAKE_10_VVRR(BSD) 79 | # endif 80 | # if !defined(BOOST_OS_BSD) 81 | # define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE 82 | # endif 83 | #endif 84 | 85 | #if BOOST_OS_BSD 86 | # define BOOST_OS_BSD_AVAILABLE 87 | # include 88 | #endif 89 | 90 | #define BOOST_OS_BSD_NAME "BSD" 91 | 92 | #else 93 | 94 | #include 95 | #include 96 | #include 97 | #include 98 | #include 99 | 100 | #endif 101 | 102 | #include 103 | BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD,BOOST_OS_BSD_NAME) 104 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/test/directed.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | import rostest 4 | import rospy 5 | import unittest 6 | import sensor_msgs.msg 7 | 8 | from image_geometry import PinholeCameraModel, StereoCameraModel 9 | 10 | class TestDirected(unittest.TestCase): 11 | 12 | def setUp(self): 13 | pass 14 | 15 | def test_monocular(self): 16 | ci = sensor_msgs.msg.CameraInfo() 17 | ci.width = 640 18 | ci.height = 480 19 | print(ci) 20 | cam = PinholeCameraModel() 21 | cam.fromCameraInfo(ci) 22 | print(cam.rectifyPoint((0, 0))) 23 | 24 | print(cam.project3dToPixel((0,0,0))) 25 | 26 | def test_stereo(self): 27 | lmsg = sensor_msgs.msg.CameraInfo() 28 | rmsg = sensor_msgs.msg.CameraInfo() 29 | for m in (lmsg, rmsg): 30 | m.width = 640 31 | m.height = 480 32 | 33 | # These parameters taken from a real camera calibration 34 | lmsg.D = [-0.363528858080088, 0.16117037733986861, -8.1109585007538829e-05, -0.00044776712298447841, 0.0] 35 | lmsg.K = [430.15433020105519, 0.0, 311.71339830549732, 0.0, 430.60920415473657, 221.06824942698509, 0.0, 0.0, 1.0] 36 | lmsg.R = [0.99806560714807102, 0.0068562422224214027, 0.061790256276695904, -0.0067522959054715113, 0.99997541519165112, -0.0018909025066874664, -0.061801701660692349, 0.0014700186639396652, 0.99808736527268516] 37 | lmsg.P = [295.53402059708782, 0.0, 285.55760765075684, 0.0, 0.0, 295.53402059708782, 223.29617881774902, 0.0, 0.0, 0.0, 1.0, 0.0] 38 | 39 | rmsg.D = [-0.3560641041112021, 0.15647260261553159, -0.00016442960757099968, -0.00093175810713916221] 40 | rmsg.K = [428.38163131344191, 0.0, 327.95553847249192, 0.0, 428.85728580588329, 217.54828640915309, 0.0, 0.0, 1.0] 41 | rmsg.R = [0.9982082576219119, 0.0067433328293516528, 0.059454199832973849, -0.0068433268864187356, 0.99997549128605434, 0.0014784127772287513, -0.059442773257581252, -0.0018826283666309878, 0.99822993965212292] 42 | rmsg.P = [295.53402059708782, 0.0, 285.55760765075684, -26.507895206214123, 0.0, 295.53402059708782, 223.29617881774902, 0.0, 0.0, 0.0, 1.0, 0.0] 43 | 44 | cam = StereoCameraModel() 45 | cam.fromCameraInfo(lmsg, rmsg) 46 | 47 | for x in (16, 320, m.width - 16): 48 | for y in (16, 240, m.height - 16): 49 | for d in range(1, 10): 50 | pt3d = cam.projectPixelTo3d((x, y), d) 51 | ((lx, ly), (rx, ry)) = cam.project3dToPixel(pt3d) 52 | self.assertAlmostEqual(y, ly, 3) 53 | self.assertAlmostEqual(y, ry, 3) 54 | self.assertAlmostEqual(x, lx, 3) 55 | self.assertAlmostEqual(x, rx + d, 3) 56 | 57 | u = 100.0 58 | v = 200.0 59 | du = 17.0 60 | dv = 23.0 61 | Z = 2.0 62 | xyz0 = cam.left.projectPixelTo3dRay((u, v)) 63 | xyz0 = (xyz0[0] * (Z / xyz0[2]), xyz0[1] * (Z / xyz0[2]), Z) 64 | xyz1 = cam.left.projectPixelTo3dRay((u + du, v + dv)) 65 | xyz1 = (xyz1[0] * (Z / xyz1[2]), xyz1[1] * (Z / xyz1[2]), Z) 66 | self.assertAlmostEqual(cam.left.getDeltaU(xyz1[0] - xyz0[0], Z), du, 3) 67 | self.assertAlmostEqual(cam.left.getDeltaV(xyz1[1] - xyz0[1], Z), dv, 3) 68 | self.assertAlmostEqual(cam.left.getDeltaX(du, Z), xyz1[0] - xyz0[0], 3) 69 | self.assertAlmostEqual(cam.left.getDeltaY(dv, Z), xyz1[1] - xyz0[1], 3) 70 | 71 | if __name__ == '__main__': 72 | if 1: 73 | rostest.unitrun('image_geometry', 'directed', TestDirected) 74 | else: 75 | suite = unittest.TestSuite() 76 | suite.addTest(TestDirected('test_stereo')) 77 | unittest.TextTestRunner(verbosity=2).run(suite) 78 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/test/conversions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import rostest 3 | import unittest 4 | 5 | import numpy as np 6 | 7 | import sensor_msgs.msg 8 | 9 | from cv_bridge import CvBridge, CvBridgeError 10 | 11 | class TestConversions(unittest.TestCase): 12 | 13 | def test_mono16_cv2(self): 14 | import numpy as np 15 | br = CvBridge() 16 | im = np.uint8(np.random.randint(0, 255, size=(480, 640, 3))) 17 | self.assertRaises(CvBridgeError, lambda: br.imgmsg_to_cv2(br.cv2_to_imgmsg(im), "mono16")) 18 | br.imgmsg_to_cv2(br.cv2_to_imgmsg(im,"rgb8"), "mono16") 19 | 20 | def test_encode_decode_cv2(self): 21 | import cv2 22 | import numpy as np 23 | fmts = [cv2.CV_8U, cv2.CV_8S, cv2.CV_16U, cv2.CV_16S, cv2.CV_32S, cv2.CV_32F, cv2.CV_64F] 24 | 25 | cvb_en = CvBridge() 26 | cvb_de = CvBridge() 27 | 28 | for w in range(100, 800, 100): 29 | for h in range(100, 800, 100): 30 | for f in fmts: 31 | for channels in ([], 1, 2, 3, 4, 5): 32 | if channels == []: 33 | original = np.uint8(np.random.randint(0, 255, size=(h, w))) 34 | else: 35 | original = np.uint8(np.random.randint(0, 255, size=(h, w, channels))) 36 | rosmsg = cvb_en.cv2_to_imgmsg(original) 37 | newimg = cvb_de.imgmsg_to_cv2(rosmsg) 38 | 39 | self.assert_(original.dtype == newimg.dtype) 40 | if channels == 1: 41 | # in that case, a gray image has a shape of size 2 42 | self.assert_(original.shape[:2] == newimg.shape[:2]) 43 | else: 44 | self.assert_(original.shape == newimg.shape) 45 | self.assert_(len(original.tostring()) == len(newimg.tostring())) 46 | 47 | def test_encode_decode_cv2_compressed(self): 48 | import numpy as np 49 | # from: http://docs.opencv.org/2.4/modules/highgui/doc/reading_and_writing_images_and_video.html#Mat imread(const string& filename, int flags) 50 | # NOTE: remove jp2(a.k.a JPEG2000) as its JASPER codec is disabled within Ubuntu opencv library 51 | # due to security issues, but it works once you rebuild your opencv library with JASPER enabled 52 | formats = ["jpg", "jpeg", "jpe", "png", "bmp", "dib", 53 | "sr", "ras", "tif", "tiff"] # this formats rviz is not support 54 | 55 | cvb_en = CvBridge() 56 | cvb_de = CvBridge() 57 | 58 | for w in range(100, 800, 100): 59 | for h in range(100, 800, 100): 60 | for f in formats: 61 | for channels in ([], 1, 3): 62 | if channels == []: 63 | original = np.uint8(np.random.randint(0, 255, size=(h, w))) 64 | else: 65 | original = np.uint8(np.random.randint(0, 255, size=(h, w, channels))) 66 | compress_rosmsg = cvb_en.cv2_to_compressed_imgmsg(original, f) 67 | newimg = cvb_de.compressed_imgmsg_to_cv2(compress_rosmsg) 68 | self.assert_(original.dtype == newimg.dtype) 69 | if channels == 1: 70 | # in that case, a gray image has a shape of size 2 71 | self.assert_(original.shape[:2] == newimg.shape[:2]) 72 | else: 73 | self.assert_(original.shape == newimg.shape) 74 | self.assert_(len(original.tostring()) == len(newimg.tostring())) 75 | 76 | def test_endianness(self): 77 | br = CvBridge() 78 | dtype = np.dtype('int32') 79 | # Set to big endian. 80 | dtype = dtype.newbyteorder('>') 81 | img = np.random.randint(0, 255, size=(30, 40)) 82 | msg = br.cv2_to_imgmsg(img.astype(dtype)) 83 | self.assert_(msg.is_bigendian == True) 84 | self.assert_((br.imgmsg_to_cv2(msg) == img).all()) 85 | 86 | if __name__ == '__main__': 87 | rosunit.unitrun('opencv_tests', 'conversions', TestConversions) 88 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/include/image_geometry/stereo_camera_model.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGE_GEOMETRY_STEREO_CAMERA_MODEL_H 2 | #define IMAGE_GEOMETRY_STEREO_CAMERA_MODEL_H 3 | 4 | #include "image_geometry/pinhole_camera_model.h" 5 | #include "exports.h" 6 | 7 | namespace image_geometry { 8 | 9 | /** 10 | * \brief Simplifies interpreting stereo image pairs geometrically using the 11 | * parameters from the left and right sensor_msgs/CameraInfo. 12 | */ 13 | class IMAGE_GEOMETRY_DECL StereoCameraModel 14 | { 15 | public: 16 | StereoCameraModel(); 17 | 18 | StereoCameraModel(const StereoCameraModel& other); 19 | 20 | StereoCameraModel& operator=(const StereoCameraModel& other); 21 | 22 | /** 23 | * \brief Set the camera parameters from the sensor_msgs/CameraInfo messages. 24 | */ 25 | bool fromCameraInfo(const sensor_msgs::CameraInfo& left, 26 | const sensor_msgs::CameraInfo& right); 27 | 28 | /** 29 | * \brief Set the camera parameters from the sensor_msgs/CameraInfo messages. 30 | */ 31 | bool fromCameraInfo(const sensor_msgs::CameraInfoConstPtr& left, 32 | const sensor_msgs::CameraInfoConstPtr& right); 33 | 34 | /** 35 | * \brief Get the left monocular camera model. 36 | */ 37 | const PinholeCameraModel& left() const; 38 | 39 | /** 40 | * \brief Get the right monocular camera model. 41 | */ 42 | const PinholeCameraModel& right() const; 43 | 44 | /** 45 | * \brief Get the name of the camera coordinate frame in tf. 46 | * 47 | * For stereo cameras, both the left and right CameraInfo should be in the left 48 | * optical frame. 49 | */ 50 | std::string tfFrame() const; 51 | 52 | /** 53 | * \brief Project a rectified pixel with disparity to a 3d point. 54 | */ 55 | void projectDisparityTo3d(const cv::Point2d& left_uv_rect, float disparity, cv::Point3d& xyz) const; 56 | 57 | /** 58 | * \brief Project a disparity image to a 3d point cloud. 59 | * 60 | * If handleMissingValues = true, all points with minimal disparity (outliers) have 61 | * Z set to MISSING_Z (currently 10000.0). 62 | */ 63 | void projectDisparityImageTo3d(const cv::Mat& disparity, cv::Mat& point_cloud, 64 | bool handleMissingValues = false) const; 65 | static const double MISSING_Z; 66 | 67 | /** 68 | * \brief Returns the disparity reprojection matrix. 69 | */ 70 | const cv::Matx44d& reprojectionMatrix() const; 71 | 72 | /** 73 | * \brief Returns the horizontal baseline in world coordinates. 74 | */ 75 | double baseline() const; 76 | 77 | /** 78 | * \brief Returns the depth at which a point is observed with a given disparity. 79 | * 80 | * This is the inverse of getDisparity(). 81 | */ 82 | double getZ(double disparity) const; 83 | 84 | /** 85 | * \brief Returns the disparity observed for a point at depth Z. 86 | * 87 | * This is the inverse of getZ(). 88 | */ 89 | double getDisparity(double Z) const; 90 | 91 | /** 92 | * \brief Returns true if the camera has been initialized 93 | */ 94 | bool initialized() const { return left_.initialized() && right_.initialized(); } 95 | protected: 96 | PinholeCameraModel left_, right_; 97 | cv::Matx44d Q_; 98 | 99 | void updateQ(); 100 | }; 101 | 102 | 103 | /* Trivial inline functions */ 104 | inline const PinholeCameraModel& StereoCameraModel::left() const { return left_; } 105 | inline const PinholeCameraModel& StereoCameraModel::right() const { return right_; } 106 | 107 | inline std::string StereoCameraModel::tfFrame() const { return left_.tfFrame(); } 108 | 109 | inline const cv::Matx44d& StereoCameraModel::reprojectionMatrix() const { return Q_; } 110 | 111 | inline double StereoCameraModel::baseline() const 112 | { 113 | /// @todo Currently assuming horizontal baseline 114 | return -right_.Tx() / right_.fx(); 115 | } 116 | 117 | inline double StereoCameraModel::getZ(double disparity) const 118 | { 119 | assert( initialized() ); 120 | return -right_.Tx() / (disparity - (left().cx() - right().cx())); 121 | } 122 | 123 | inline double StereoCameraModel::getDisparity(double Z) const 124 | { 125 | assert( initialized() ); 126 | return -right_.Tx() / Z + (left().cx() - right().cx()); ; 127 | } 128 | 129 | } //namespace image_geometry 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /vision_opencv-noetic/vision_opencv/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package vision_opencv 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 1.16.2 (2022-10-03) 6 | ------------------- 7 | 8 | 1.16.1 (2022-09-06) 9 | ------------------- 10 | 11 | 1.16.0 (2021-11-23) 12 | ------------------- 13 | 14 | 1.15.0 (2020-05-19) 15 | ------------------- 16 | 17 | 1.14.0 (2020-04-06) 18 | ------------------- 19 | * Noetic release (`#323 `_) 20 | * Contributors: Alejandro Hernández Cordero 21 | 22 | 1.13.0 (2018-04-30) 23 | ------------------- 24 | 25 | 1.12.8 (2018-04-17) 26 | ------------------- 27 | 28 | 1.12.7 (2017-11-12) 29 | ------------------- 30 | 31 | 1.12.6 (2017-11-11) 32 | ------------------- 33 | 34 | 1.12.5 (2017-11-05) 35 | ------------------- 36 | 37 | 1.12.4 (2017-01-29) 38 | ------------------- 39 | 40 | 1.12.3 (2016-12-04) 41 | ------------------- 42 | 43 | 1.12.2 (2016-09-24) 44 | ------------------- 45 | 46 | 1.12.1 (2016-07-11) 47 | ------------------- 48 | 49 | 1.12.0 (2016-03-18) 50 | ------------------- 51 | * remove opencv_apps from vision_opencv 52 | * Contributors: Vincent Rabaud 53 | 54 | 1.11.12 (2016-03-10) 55 | -------------------- 56 | 57 | 1.11.11 (2016-01-31) 58 | -------------------- 59 | 60 | 1.11.10 (2016-01-16) 61 | -------------------- 62 | 63 | 1.11.9 (2015-11-29) 64 | ------------------- 65 | * Add opencv_apps to vision_opencv dependency 66 | * Contributors: Ryohei Ueda 67 | 68 | 1.11.8 (2015-07-15) 69 | ------------------- 70 | 71 | 1.11.7 (2014-12-14) 72 | ------------------- 73 | 74 | 1.11.6 (2014-11-16) 75 | ------------------- 76 | 77 | 1.11.5 (2014-09-21) 78 | ------------------- 79 | 80 | 1.11.4 (2014-07-27) 81 | ------------------- 82 | 83 | 1.11.3 (2014-06-08) 84 | ------------------- 85 | 86 | 1.11.2 (2014-04-28) 87 | ------------------- 88 | 89 | 1.11.1 (2014-04-16) 90 | ------------------- 91 | 92 | 1.11.0 (2014-02-15) 93 | ------------------- 94 | 95 | 1.10.15 (2014-02-07) 96 | -------------------- 97 | 98 | 1.10.14 (2013-11-23 16:17) 99 | -------------------------- 100 | * Contributors: Vincent Rabaud 101 | 102 | 1.10.13 (2013-11-23 09:19) 103 | -------------------------- 104 | * Contributors: Vincent Rabaud 105 | 106 | 1.10.12 (2013-11-22) 107 | -------------------- 108 | * Contributors: Vincent Rabaud 109 | 110 | 1.10.11 (2013-10-23) 111 | -------------------- 112 | * Contributors: Vincent Rabaud 113 | 114 | 1.10.10 (2013-10-19) 115 | -------------------- 116 | * Contributors: Vincent Rabaud 117 | 118 | 1.10.9 (2013-10-07) 119 | ------------------- 120 | * Contributors: Vincent Rabaud 121 | 122 | 1.10.8 (2013-09-09) 123 | ------------------- 124 | * update email address 125 | * Contributors: Vincent Rabaud 126 | 127 | 1.10.7 (2013-07-17) 128 | ------------------- 129 | * update to REP 0127 130 | * Contributors: Vincent Rabaud 131 | 132 | 1.10.6 (2013-03-01) 133 | ------------------- 134 | 135 | 1.10.5 (2013-02-11) 136 | ------------------- 137 | 138 | 1.10.4 (2013-02-02) 139 | ------------------- 140 | 141 | 1.10.3 (2013-01-17) 142 | ------------------- 143 | 144 | 1.10.2 (2013-01-13) 145 | ------------------- 146 | 147 | 1.10.1 (2013-01-10) 148 | ------------------- 149 | 150 | 1.10.0 (2013-01-03) 151 | ------------------- 152 | 153 | 1.9.15 (2013-01-02) 154 | ------------------- 155 | 156 | 1.9.14 (2012-12-30) 157 | ------------------- 158 | 159 | 1.9.13 (2012-12-15) 160 | ------------------- 161 | 162 | 1.9.12 (2012-12-14) 163 | ------------------- 164 | 165 | 1.9.11 (2012-12-10) 166 | ------------------- 167 | 168 | 1.9.10 (2012-10-04) 169 | ------------------- 170 | * the CMake file is useless 171 | * add the missing CMake file 172 | * re-add the meta-package 173 | * Contributors: Vincent Rabaud 174 | 175 | 1.9.9 (2012-10-01) 176 | ------------------ 177 | 178 | 1.9.8 (2012-09-30) 179 | ------------------ 180 | 181 | 1.9.7 (2012-09-28 21:07) 182 | ------------------------ 183 | 184 | 1.9.6 (2012-09-28 15:17) 185 | ------------------------ 186 | 187 | 1.9.5 (2012-09-15) 188 | ------------------ 189 | 190 | 1.9.4 (2012-09-13) 191 | ------------------ 192 | 193 | 1.9.3 (2012-09-12) 194 | ------------------ 195 | 196 | 1.9.2 (2012-09-07) 197 | ------------------ 198 | 199 | 1.9.1 (2012-08-28 22:06) 200 | ------------------------ 201 | 202 | 1.9.0 (2012-08-28 14:29) 203 | ------------------------ 204 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/make.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2008-2015 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #include 8 | 9 | #ifndef BOOST_PREDEF_MAKE_H 10 | #define BOOST_PREDEF_MAKE_H 11 | 12 | /* 13 | Shorthands for the common version number formats used by vendors... 14 | */ 15 | 16 | /*` 17 | [heading `BOOST_PREDEF_MAKE_..` macros] 18 | 19 | These set of macros decompose common vendor version number 20 | macros which are composed version, revision, and patch digits. 21 | The naming convention indicates: 22 | 23 | * The base of the specified version number. "`BOOST_PREDEF_MAKE_0X`" for 24 | hexadecimal digits, and "`BOOST_PREDEF_MAKE_10`" for decimal digits. 25 | * The format of the vendor version number. Where "`V`" indicates the version digits, 26 | "`R`" indicates the revision digits, "`P`" indicates the patch digits, and "`0`" 27 | indicates an ignored digit. 28 | 29 | Macros are: 30 | */ 31 | /*` `BOOST_PREDEF_MAKE_0X_VRP(V)` */ 32 | #define BOOST_PREDEF_MAKE_0X_VRP(V) BOOST_VERSION_NUMBER((V&0xF00)>>8,(V&0xF0)>>4,(V&0xF)) 33 | /*` `BOOST_PREDEF_MAKE_0X_VVRP(V)` */ 34 | #define BOOST_PREDEF_MAKE_0X_VVRP(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xF0)>>4,(V&0xF)) 35 | /*` `BOOST_PREDEF_MAKE_0X_VRPP(V)` */ 36 | #define BOOST_PREDEF_MAKE_0X_VRPP(V) BOOST_VERSION_NUMBER((V&0xF000)>>12,(V&0xF00)>>8,(V&0xFF)) 37 | /*` `BOOST_PREDEF_MAKE_0X_VVRR(V)` */ 38 | #define BOOST_PREDEF_MAKE_0X_VVRR(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xFF),0) 39 | /*` `BOOST_PREDEF_MAKE_0X_VRRPPPP(V)` */ 40 | #define BOOST_PREDEF_MAKE_0X_VRRPPPP(V) BOOST_VERSION_NUMBER((V&0xF000000)>>24,(V&0xFF0000)>>16,(V&0xFFFF)) 41 | /*` `BOOST_PREDEF_MAKE_0X_VVRRP(V)` */ 42 | #define BOOST_PREDEF_MAKE_0X_VVRRP(V) BOOST_VERSION_NUMBER((V&0xFF000)>>12,(V&0xFF0)>>4,(V&0xF)) 43 | /*` `BOOST_PREDEF_MAKE_0X_VRRPP000(V)` */ 44 | #define BOOST_PREDEF_MAKE_0X_VRRPP000(V) BOOST_VERSION_NUMBER((V&0xF0000000)>>28,(V&0xFF00000)>>20,(V&0xFF000)>>12) 45 | /*` `BOOST_PREDEF_MAKE_0X_VVRRPP(V)` */ 46 | #define BOOST_PREDEF_MAKE_0X_VVRRPP(V) BOOST_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF)) 47 | /*` `BOOST_PREDEF_MAKE_10_VPPP(V)` */ 48 | #define BOOST_PREDEF_MAKE_10_VPPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000) 49 | /*` `BOOST_PREDEF_MAKE_10_VRP(V)` */ 50 | #define BOOST_PREDEF_MAKE_10_VRP(V) BOOST_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,(V)%10) 51 | /*` `BOOST_PREDEF_MAKE_10_VRP000(V)` */ 52 | #define BOOST_PREDEF_MAKE_10_VRP000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,((V)/1000)%10) 53 | /*` `BOOST_PREDEF_MAKE_10_VRPP(V)` */ 54 | #define BOOST_PREDEF_MAKE_10_VRPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,((V)/100)%10,(V)%100) 55 | /*` `BOOST_PREDEF_MAKE_10_VRR(V)` */ 56 | #define BOOST_PREDEF_MAKE_10_VRR(V) BOOST_VERSION_NUMBER(((V)/100)%10,(V)%100,0) 57 | /*` `BOOST_PREDEF_MAKE_10_VRRPP(V)` */ 58 | #define BOOST_PREDEF_MAKE_10_VRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%10,((V)/100)%100,(V)%100) 59 | /*` `BOOST_PREDEF_MAKE_10_VRR000(V)` */ 60 | #define BOOST_PREDEF_MAKE_10_VRR000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/1000)%100,0) 61 | /*` `BOOST_PREDEF_MAKE_10_VV00(V)` */ 62 | #define BOOST_PREDEF_MAKE_10_VV00(V) BOOST_VERSION_NUMBER(((V)/100)%100,0,0) 63 | /*` `BOOST_PREDEF_MAKE_10_VVRR(V)` */ 64 | #define BOOST_PREDEF_MAKE_10_VVRR(V) BOOST_VERSION_NUMBER(((V)/100)%100,(V)%100,0) 65 | /*` `BOOST_PREDEF_MAKE_10_VVRRPP(V)` */ 66 | #define BOOST_PREDEF_MAKE_10_VVRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%100,((V)/100)%100,(V)%100) 67 | /*` `BOOST_PREDEF_MAKE_10_VVRR0PP00(V)` */ 68 | #define BOOST_PREDEF_MAKE_10_VVRR0PP00(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,((V)/100)%100) 69 | /*` `BOOST_PREDEF_MAKE_10_VVRR0PPPP(V)` */ 70 | #define BOOST_PREDEF_MAKE_10_VVRR0PPPP(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,(V)%10000) 71 | /*` `BOOST_PREDEF_MAKE_10_VVRR00PP00(V)` */ 72 | #define BOOST_PREDEF_MAKE_10_VVRR00PP00(V) BOOST_VERSION_NUMBER(((V)/100000000)%100,((V)/1000000)%100,((V)/100)%100) 73 | /*` 74 | [heading `BOOST_PREDEF_MAKE_*..` date macros] 75 | 76 | Date decomposition macros return a date in the relative to the 1970 77 | Epoch date. If the month is not available, January 1st is used as the month and day. 78 | If the day is not available, but the month is, the 1st of the month is used as the day. 79 | */ 80 | /*` `BOOST_PREDEF_MAKE_DATE(Y,M,D)` */ 81 | #define BOOST_PREDEF_MAKE_DATE(Y,M,D) BOOST_VERSION_NUMBER((Y)%10000-1970,(M)%100,(D)%100) 82 | /*` `BOOST_PREDEF_MAKE_YYYYMMDD(V)` */ 83 | #define BOOST_PREDEF_MAKE_YYYYMMDD(V) BOOST_PREDEF_MAKE_DATE(((V)/10000)%10000,((V)/100)%100,(V)%100) 84 | /*` `BOOST_PREDEF_MAKE_YYYY(V)` */ 85 | #define BOOST_PREDEF_MAKE_YYYY(V) BOOST_PREDEF_MAKE_DATE(V,1,1) 86 | /*` `BOOST_PREDEF_MAKE_YYYYMM(V)` */ 87 | #define BOOST_PREDEF_MAKE_YYYYMM(V) BOOST_PREDEF_MAKE_DATE((V)/100,(V)%100,1) 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /vision_opencv-noetic/opencv_tests/nodes/rosfacedetect.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | """ 3 | This program is demonstration for face and object detection using haar-like features. 4 | The program finds faces in a camera image or video stream and displays a red box around them. 5 | 6 | Original C implementation by: ? 7 | Python implementation by: Roman Stanchak, James Bowman 8 | Updated: Copyright (c) 2016, Tal Regev. 9 | """ 10 | 11 | import sys 12 | import os 13 | from optparse import OptionParser 14 | 15 | import rospy 16 | import sensor_msgs.msg 17 | from cv_bridge import CvBridge 18 | import cv2 19 | import numpy 20 | 21 | # Parameters for haar detection 22 | # From the API: 23 | # The default parameters (scale_factor=2, min_neighbors=3, flags=0) are tuned 24 | # for accurate yet slow object detection. For a faster operation on real video 25 | # images the settings are: 26 | # scale_factor=1.2, min_neighbors=2, flags=CV_HAAR_DO_CANNY_PRUNING, 27 | # min_size= 3 | #include 4 | 5 | 6 | // Tests conversion of non-continuous cv::Mat. #5206 7 | TEST(CvBridgeTest, NonContinuous) 8 | { 9 | cv::Mat full = cv::Mat::eye(8, 8, CV_16U); 10 | cv::Mat partial = full.colRange(2, 5); 11 | 12 | cv_bridge::CvImage cvi; 13 | cvi.encoding = sensor_msgs::image_encodings::MONO16; 14 | cvi.image = partial; 15 | 16 | sensor_msgs::ImagePtr msg = cvi.toImageMsg(); 17 | EXPECT_EQ(msg->height, 8); 18 | EXPECT_EQ(msg->width, 3); 19 | EXPECT_EQ(msg->encoding, cvi.encoding); 20 | EXPECT_EQ(msg->step, 6); 21 | } 22 | 23 | TEST(CvBridgeTest, ChannelOrder) 24 | { 25 | cv::Mat_ mat(200, 200); 26 | mat.setTo(cv::Scalar(1000,0,0,0)); 27 | sensor_msgs::ImagePtr image(new sensor_msgs::Image()); 28 | 29 | image = cv_bridge::CvImage(image->header, sensor_msgs::image_encodings::MONO16, mat).toImageMsg(); 30 | 31 | cv_bridge::CvImageConstPtr cv_ptr = cv_bridge::toCvShare(image); 32 | 33 | cv_bridge::CvImagePtr res = cv_bridge::cvtColor(cv_ptr, sensor_msgs::image_encodings::BGR8); 34 | EXPECT_EQ(res->encoding, sensor_msgs::image_encodings::BGR8); 35 | EXPECT_EQ(res->image.type(), cv_bridge::getCvType(res->encoding)); 36 | EXPECT_EQ(res->image.channels(), sensor_msgs::image_encodings::numChannels(res->encoding)); 37 | EXPECT_EQ(res->image.depth(), CV_8U); 38 | 39 | // The matrix should be the following 40 | cv::Mat_ gt(200, 200); 41 | gt.setTo(cv::Scalar(1, 1, 1)*1000.*255./65535.); 42 | 43 | ASSERT_EQ(res->image.type(), gt.type()); 44 | EXPECT_EQ(cv::norm(res->image, gt, cv::NORM_INF), 0); 45 | } 46 | 47 | TEST(CvBridgeTest, initialization) 48 | { 49 | sensor_msgs::Image image; 50 | cv_bridge::CvImagePtr cv_ptr; 51 | 52 | image.encoding = "bgr8"; 53 | image.height = 200; 54 | image.width = 200; 55 | 56 | try { 57 | cv_ptr = cv_bridge::toCvCopy(image, "mono8"); 58 | // Before the fix, it would never get here, as it would segfault 59 | EXPECT_EQ(1, 0); 60 | } catch (cv_bridge::Exception& e) { 61 | EXPECT_EQ(1, 1); 62 | } 63 | 64 | // Check some normal images with different ratios 65 | for(int height = 100; height <= 300; ++height) { 66 | image.encoding = sensor_msgs::image_encodings::RGB8; 67 | image.step = image.width*3; 68 | image.data.resize(image.height*image.step); 69 | cv_ptr = cv_bridge::toCvCopy(image, "mono8"); 70 | } 71 | } 72 | 73 | TEST(CvBridgeTest, imageMessageStep) 74 | { 75 | // Test 1: image step is padded 76 | sensor_msgs::Image image; 77 | cv_bridge::CvImagePtr cv_ptr; 78 | 79 | image.encoding = "mono8"; 80 | image.height = 220; 81 | image.width = 200; 82 | image.is_bigendian = false; 83 | image.step = 208; 84 | 85 | image.data.resize(image.height*image.step); 86 | 87 | ASSERT_NO_THROW(cv_ptr = cv_bridge::toCvCopy(image, "mono8")); 88 | ASSERT_EQ(220, cv_ptr->image.rows); 89 | ASSERT_EQ(200, cv_ptr->image.cols); 90 | //OpenCV copyTo argument removes the stride 91 | ASSERT_EQ(200, cv_ptr->image.step[0]); 92 | 93 | //Test 2: image step is invalid 94 | image.step = 199; 95 | 96 | ASSERT_THROW(cv_ptr = cv_bridge::toCvCopy(image, "mono8"), cv_bridge::Exception); 97 | 98 | //Test 3: image step == image.width * element size * number of channels 99 | image.step = 200; 100 | image.data.resize(image.height*image.step); 101 | 102 | ASSERT_NO_THROW(cv_ptr = cv_bridge::toCvCopy(image, "mono8")); 103 | ASSERT_EQ(220, cv_ptr->image.rows); 104 | ASSERT_EQ(200, cv_ptr->image.cols); 105 | ASSERT_EQ(200, cv_ptr->image.step[0]); 106 | } 107 | 108 | TEST(CvBridgeTest, imageMessageConversion) 109 | { 110 | sensor_msgs::Image imgmsg; 111 | cv_bridge::CvImagePtr cv_ptr; 112 | imgmsg.height = 220; 113 | imgmsg.width = 200; 114 | imgmsg.is_bigendian = false; 115 | 116 | // image with data type float32 and 1 channels 117 | imgmsg.encoding = "32FC1"; 118 | imgmsg.step = imgmsg.width * 32 / 8 * 1; 119 | imgmsg.data.resize(imgmsg.height * imgmsg.step); 120 | ASSERT_NO_THROW(cv_ptr = cv_bridge::toCvCopy(imgmsg, imgmsg.encoding)); 121 | ASSERT_EQ(imgmsg.height, cv_ptr->image.rows); 122 | ASSERT_EQ(imgmsg.width, cv_ptr->image.cols); 123 | ASSERT_EQ(1, cv_ptr->image.channels()); 124 | ASSERT_EQ(imgmsg.step, cv_ptr->image.step[0]); 125 | 126 | // image with data type float32 and 10 channels 127 | imgmsg.encoding = "32FC10"; 128 | imgmsg.step = imgmsg.width * 32 / 8 * 10; 129 | imgmsg.data.resize(imgmsg.height * imgmsg.step); 130 | ASSERT_NO_THROW(cv_ptr = cv_bridge::toCvCopy(imgmsg, imgmsg.encoding)); 131 | ASSERT_EQ(imgmsg.height, cv_ptr->image.rows); 132 | ASSERT_EQ(imgmsg.width, cv_ptr->image.cols); 133 | ASSERT_EQ(10, cv_ptr->image.channels()); 134 | ASSERT_EQ(imgmsg.step, cv_ptr->image.step[0]); 135 | } 136 | 137 | int main(int argc, char** argv) 138 | { 139 | testing::InitGoogleTest(&argc, argv); 140 | return RUN_ALL_TESTS(); 141 | } 142 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/src/stereo_camera_model.cpp: -------------------------------------------------------------------------------- 1 | #include "image_geometry/stereo_camera_model.h" 2 | #include 3 | 4 | namespace image_geometry { 5 | 6 | StereoCameraModel::StereoCameraModel() 7 | : Q_(0.0) 8 | { 9 | Q_(0,0) = Q_(1,1) = 1.0; 10 | } 11 | 12 | StereoCameraModel::StereoCameraModel(const StereoCameraModel& other) 13 | : left_(other.left_), right_(other.right_), 14 | Q_(0.0) 15 | { 16 | Q_(0,0) = Q_(1,1) = 1.0; 17 | if (other.initialized()) 18 | updateQ(); 19 | } 20 | 21 | StereoCameraModel& StereoCameraModel::operator=(const StereoCameraModel& other) 22 | { 23 | if (other.initialized()) 24 | this->fromCameraInfo(other.left_.cameraInfo(), other.right_.cameraInfo()); 25 | return *this; 26 | } 27 | 28 | bool StereoCameraModel::fromCameraInfo(const sensor_msgs::CameraInfo& left, 29 | const sensor_msgs::CameraInfo& right) 30 | { 31 | bool changed_left = left_.fromCameraInfo(left); 32 | bool changed_right = right_.fromCameraInfo(right); 33 | bool changed = changed_left || changed_right; 34 | 35 | // Note: don't require identical time stamps to allow imperfectly synced stereo. 36 | assert( left_.tfFrame() == right_.tfFrame() ); 37 | assert( left_.fx() == right_.fx() ); 38 | assert( left_.fy() == right_.fy() ); 39 | assert( left_.cy() == right_.cy() ); 40 | // cx may differ for verged cameras 41 | 42 | if (changed) 43 | updateQ(); 44 | 45 | return changed; 46 | } 47 | 48 | bool StereoCameraModel::fromCameraInfo(const sensor_msgs::CameraInfoConstPtr& left, 49 | const sensor_msgs::CameraInfoConstPtr& right) 50 | { 51 | return fromCameraInfo(*left, *right); 52 | } 53 | 54 | void StereoCameraModel::updateQ() 55 | { 56 | // Update variable fields of reprojection matrix 57 | /* 58 | From Springer Handbook of Robotics, p. 524: 59 | 60 | [ Fx 0 Cx 0 ] 61 | P = [ 0 Fy Cy 0 ] 62 | [ 0 0 1 0 ] 63 | 64 | [ Fx 0 Cx' FxTx ] 65 | P' = [ 0 Fy Cy 0 ] 66 | [ 0 0 1 0 ] 67 | where primed parameters are from the left projection matrix, unprimed from the right. 68 | 69 | [u v 1]^T = P * [x y z 1]^T 70 | [u-d v 1]^T = P' * [x y z 1]^T 71 | 72 | Combining the two equations above results in the following equation 73 | 74 | [u v u-d 1]^T = [ Fx 0 Cx 0 ] * [ x y z 1]^T 75 | [ 0 Fy Cy 0 ] 76 | [ Fx 0 Cx' FxTx ] 77 | [ 0 0 1 0 ] 78 | 79 | Subtracting the 3rd from from the first and inverting the expression 80 | results in the following equation. 81 | 82 | [x y z 1]^T = Q * [u v d 1]^T 83 | 84 | Where Q is defined as 85 | 86 | Q = [ FyTx 0 0 -FyCxTx ] 87 | [ 0 FxTx 0 -FxCyTx ] 88 | [ 0 0 0 FxFyTx ] 89 | [ 0 0 -Fy Fy(Cx-Cx') ] 90 | 91 | Using the assumption Fx = Fy Q can be simplified to the following. But for 92 | compatibility with stereo cameras with different focal lengths we will use 93 | the full Q matrix. 94 | 95 | [ 1 0 0 -Cx ] 96 | Q = [ 0 1 0 -Cy ] 97 | [ 0 0 0 Fx ] 98 | [ 0 0 -1/Tx (Cx-Cx')/Tx ] 99 | 100 | Disparity = x_left - x_right 101 | 102 | For compatibility with stereo cameras with different focal lengths we will use 103 | the full Q matrix. 104 | 105 | */ 106 | double Tx = -baseline(); // The baseline member negates our Tx. Undo this negation 107 | Q_(0,0) = left_.fy() * Tx; 108 | Q_(0,3) = -left_.fy() * left_.cx() * Tx; 109 | Q_(1,1) = left_.fx() * Tx; 110 | Q_(1,3) = -left_.fx() * left_.cy() * Tx; 111 | Q_(2,3) = left_.fx() * left_.fy() * Tx; 112 | Q_(3,2) = -left_.fy(); 113 | Q_(3,3) = left_.fy() * (left_.cx() - right_.cx()); // zero when disparities are pre-adjusted 114 | } 115 | 116 | void StereoCameraModel::projectDisparityTo3d(const cv::Point2d& left_uv_rect, float disparity, 117 | cv::Point3d& xyz) const 118 | { 119 | assert( initialized() ); 120 | 121 | // Do the math inline: 122 | // [X Y Z W]^T = Q * [u v d 1]^T 123 | // Point = (X/W, Y/W, Z/W) 124 | // cv::perspectiveTransform could be used but with more overhead. 125 | double u = left_uv_rect.x, v = left_uv_rect.y; 126 | cv::Point3d XYZ( (Q_(0,0) * u) + Q_(0,3), (Q_(1,1) * v) + Q_(1,3), Q_(2,3)); 127 | double W = Q_(3,2)*disparity + Q_(3,3); 128 | xyz = XYZ * (1.0/W); 129 | } 130 | 131 | const double StereoCameraModel::MISSING_Z = 10000.; 132 | 133 | void StereoCameraModel::projectDisparityImageTo3d(const cv::Mat& disparity, cv::Mat& point_cloud, 134 | bool handleMissingValues) const 135 | { 136 | assert( initialized() ); 137 | 138 | cv::reprojectImageTo3D(disparity, point_cloud, Q_, handleMissingValues); 139 | } 140 | 141 | } //namespace image_geometry 142 | -------------------------------------------------------------------------------- /usb_cam/include/usb_cam/usb_cam.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * 3 | * Software License Agreement (BSD License) 4 | * 5 | * Copyright (c) 2014, Robert Bosch LLC. 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer in the documentation and/or other materials provided 17 | * with the distribution. 18 | * * Neither the name of the Robert Bosch nor the names of its 19 | * contributors may be used to endorse or promote products derived 20 | * from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | * POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | *********************************************************************/ 36 | #ifndef USB_CAM_USB_CAM_H 37 | #define USB_CAM_USB_CAM_H 38 | 39 | #include /* for videodev2.h */ 40 | 41 | extern "C" 42 | { 43 | #include 44 | #include 45 | #include 46 | #include 47 | } 48 | 49 | // legacy reasons 50 | #include 51 | #if LIBAVCODEC_VERSION_MAJOR < 55 52 | #define AV_CODEC_ID_MJPEG CODEC_ID_MJPEG 53 | #endif 54 | 55 | #include 56 | #include 57 | 58 | #include 59 | 60 | namespace usb_cam { 61 | 62 | class UsbCam { 63 | public: 64 | typedef enum 65 | { 66 | IO_METHOD_READ, IO_METHOD_MMAP, IO_METHOD_USERPTR, IO_METHOD_UNKNOWN, 67 | } io_method; 68 | 69 | typedef enum 70 | { 71 | PIXEL_FORMAT_YUYV, PIXEL_FORMAT_UYVY, PIXEL_FORMAT_MJPEG, PIXEL_FORMAT_YUVMONO10, PIXEL_FORMAT_RGB24, PIXEL_FORMAT_GREY, PIXEL_FORMAT_UNKNOWN 72 | } pixel_format; 73 | 74 | UsbCam(); 75 | ~UsbCam(); 76 | 77 | // start camera 78 | void start(const std::string& dev, io_method io, pixel_format pf, 79 | int image_width, int image_height, int framerate); 80 | // shutdown camera 81 | void shutdown(void); 82 | 83 | // grabs a new image from the camera 84 | void grab_image(sensor_msgs::Image* image); 85 | 86 | // enables/disable auto focus 87 | void set_auto_focus(int value); 88 | 89 | // Set video device parameters 90 | void set_v4l_parameter(const std::string& param, int value); 91 | void set_v4l_parameter(const std::string& param, const std::string& value); 92 | 93 | static io_method io_method_from_string(const std::string& str); 94 | static pixel_format pixel_format_from_string(const std::string& str); 95 | 96 | void stop_capturing(void); 97 | void start_capturing(void); 98 | bool is_capturing(); 99 | 100 | private: 101 | typedef struct 102 | { 103 | int width; 104 | int height; 105 | int bytes_per_pixel; 106 | int image_size; 107 | char *image; 108 | int is_new; 109 | } camera_image_t; 110 | 111 | struct buffer 112 | { 113 | void * start; 114 | size_t length; 115 | }; 116 | 117 | 118 | int init_mjpeg_decoder(int image_width, int image_height); 119 | void mjpeg2rgb(char *MJPEG, int len, char *RGB, int NumPixels); 120 | void process_image(const void * src, int len, camera_image_t *dest); 121 | int read_frame(); 122 | void uninit_device(void); 123 | void init_read(unsigned int buffer_size); 124 | void init_mmap(void); 125 | void init_userp(unsigned int buffer_size); 126 | void init_device(int image_width, int image_height, int framerate); 127 | void close_device(void); 128 | void open_device(void); 129 | void grab_image(); 130 | bool is_capturing_; 131 | 132 | 133 | std::string camera_dev_; 134 | unsigned int pixelformat_; 135 | bool monochrome_; 136 | io_method io_; 137 | int fd_; 138 | buffer * buffers_; 139 | unsigned int n_buffers_; 140 | AVFrame *avframe_camera_; 141 | AVFrame *avframe_rgb_; 142 | AVCodec *avcodec_; 143 | AVDictionary *avoptions_; 144 | AVCodecContext *avcodec_context_; 145 | int avframe_camera_size_; 146 | int avframe_rgb_size_; 147 | struct SwsContext *video_sws_; 148 | camera_image_t *image_; 149 | 150 | }; 151 | 152 | } 153 | 154 | #endif 155 | 156 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/module.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright (c) 2012, Willow Garage, Inc. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * * Neither the name of the Willow Garage nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | *********************************************************************/ 34 | 35 | #include "module.hpp" 36 | 37 | PyObject *mod_opencv; 38 | 39 | bp::object 40 | cvtColor2Wrap(bp::object obj_in, const std::string & encoding_in, const std::string & encoding_out) { 41 | // Convert the Python input to an image 42 | cv::Mat mat_in; 43 | convert_to_CvMat2(obj_in.ptr(), mat_in); 44 | 45 | // Call cv_bridge for color conversion 46 | cv_bridge::CvImagePtr cv_image(new cv_bridge::CvImage(std_msgs::Header(), encoding_in, mat_in)); 47 | 48 | cv::Mat mat = cv_bridge::cvtColor(cv_image, encoding_out)->image; 49 | 50 | return bp::object(boost::python::handle<>(pyopencv_from(mat))); 51 | } 52 | 53 | bp::object 54 | cvtColorForDisplayWrap(bp::object obj_in, 55 | const std::string & encoding_in, 56 | const std::string & encoding_out, 57 | bool do_dynamic_scaling = false, 58 | double min_image_value = 0.0, 59 | double max_image_value = 0.0) { 60 | // Convert the Python input to an image 61 | cv::Mat mat_in; 62 | convert_to_CvMat2(obj_in.ptr(), mat_in); 63 | 64 | cv_bridge::CvImagePtr cv_image(new cv_bridge::CvImage(std_msgs::Header(), encoding_in, mat_in)); 65 | 66 | cv_bridge::CvtColorForDisplayOptions options; 67 | options.do_dynamic_scaling = do_dynamic_scaling; 68 | options.min_image_value = min_image_value; 69 | options.max_image_value = max_image_value; 70 | cv::Mat mat = cv_bridge::cvtColorForDisplay(/*source=*/cv_image, 71 | /*encoding_out=*/encoding_out, 72 | /*options=*/options)->image; 73 | 74 | return bp::object(boost::python::handle<>(pyopencv_from(mat))); 75 | } 76 | 77 | BOOST_PYTHON_FUNCTION_OVERLOADS(cvtColorForDisplayWrap_overloads, cvtColorForDisplayWrap, 3, 6) 78 | 79 | int CV_MAT_CNWrap(int i) { 80 | return CV_MAT_CN(i); 81 | } 82 | 83 | int CV_MAT_DEPTHWrap(int i) { 84 | return CV_MAT_DEPTH(i); 85 | } 86 | 87 | BOOST_PYTHON_MODULE(cv_bridge_boost) 88 | { 89 | do_numpy_import(); 90 | mod_opencv = PyImport_ImportModule("cv2"); 91 | 92 | // Wrap the function to get encodings as OpenCV types 93 | boost::python::def("getCvType", cv_bridge::getCvType); 94 | boost::python::def("cvtColor2", cvtColor2Wrap); 95 | boost::python::def("CV_MAT_CNWrap", CV_MAT_CNWrap); 96 | boost::python::def("CV_MAT_DEPTHWrap", CV_MAT_DEPTHWrap); 97 | boost::python::def("cvtColorForDisplay", cvtColorForDisplayWrap, 98 | cvtColorForDisplayWrap_overloads( 99 | boost::python::args("source", "encoding_in", "encoding_out", "do_dynamic_scaling", 100 | "min_image_value", "max_image_value"), 101 | "Convert image to display with specified encodings.\n\n" 102 | "Args:\n" 103 | " - source (numpy.ndarray): input image\n" 104 | " - encoding_in (str): input image encoding\n" 105 | " - encoding_out (str): encoding to which the image conveted\n" 106 | " - do_dynamic_scaling (bool): flag to do dynamic scaling with min/max value\n" 107 | " - min_image_value (float): minimum pixel value for dynamic scaling\n" 108 | " - max_image_value (float): maximum pixel value for dynamic scaling\n" 109 | )); 110 | } 111 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/include/cv_bridge/rgb_colors.h: -------------------------------------------------------------------------------- 1 | // -*- mode: c++ -*- 2 | /********************************************************************* 3 | * Original color definition is at scikit-image distributed with 4 | * following license disclaimer: 5 | * 6 | * Copyright (C) 2011, the scikit-image team 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are 11 | * met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in 17 | * the documentation and/or other materials provided with the 18 | * distribution. 19 | * 3. Neither the name of skimage nor the names of its contributors may be 20 | * used to endorse or promote products derived from this software without 21 | * specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 27 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | * POSSIBILITY OF SUCH DAMAGE. 34 | *********************************************************************/ 35 | 36 | #ifndef CV_BRIDGE_RGB_COLORS_H_ 37 | #define CV_BRIDGE_RGB_COLORS_H_ 38 | 39 | #include 40 | 41 | 42 | namespace cv_bridge 43 | { 44 | 45 | namespace rgb_colors 46 | { 47 | 48 | /** 49 | * @brief 50 | * 146 rgb colors 51 | */ 52 | enum Colors { 53 | ALICEBLUE, 54 | ANTIQUEWHITE, 55 | AQUA, 56 | AQUAMARINE, 57 | AZURE, 58 | BEIGE, 59 | BISQUE, 60 | BLACK, 61 | BLANCHEDALMOND, 62 | BLUE, 63 | BLUEVIOLET, 64 | BROWN, 65 | BURLYWOOD, 66 | CADETBLUE, 67 | CHARTREUSE, 68 | CHOCOLATE, 69 | CORAL, 70 | CORNFLOWERBLUE, 71 | CORNSILK, 72 | CRIMSON, 73 | CYAN, 74 | DARKBLUE, 75 | DARKCYAN, 76 | DARKGOLDENROD, 77 | DARKGRAY, 78 | DARKGREEN, 79 | DARKGREY, 80 | DARKKHAKI, 81 | DARKMAGENTA, 82 | DARKOLIVEGREEN, 83 | DARKORANGE, 84 | DARKORCHID, 85 | DARKRED, 86 | DARKSALMON, 87 | DARKSEAGREEN, 88 | DARKSLATEBLUE, 89 | DARKSLATEGRAY, 90 | DARKSLATEGREY, 91 | DARKTURQUOISE, 92 | DARKVIOLET, 93 | DEEPPINK, 94 | DEEPSKYBLUE, 95 | DIMGRAY, 96 | DIMGREY, 97 | DODGERBLUE, 98 | FIREBRICK, 99 | FLORALWHITE, 100 | FORESTGREEN, 101 | FUCHSIA, 102 | GAINSBORO, 103 | GHOSTWHITE, 104 | GOLD, 105 | GOLDENROD, 106 | GRAY, 107 | GREEN, 108 | GREENYELLOW, 109 | GREY, 110 | HONEYDEW, 111 | HOTPINK, 112 | INDIANRED, 113 | INDIGO, 114 | IVORY, 115 | KHAKI, 116 | LAVENDER, 117 | LAVENDERBLUSH, 118 | LAWNGREEN, 119 | LEMONCHIFFON, 120 | LIGHTBLUE, 121 | LIGHTCORAL, 122 | LIGHTCYAN, 123 | LIGHTGOLDENRODYELLOW, 124 | LIGHTGRAY, 125 | LIGHTGREEN, 126 | LIGHTGREY, 127 | LIGHTPINK, 128 | LIGHTSALMON, 129 | LIGHTSEAGREEN, 130 | LIGHTSKYBLUE, 131 | LIGHTSLATEGRAY, 132 | LIGHTSLATEGREY, 133 | LIGHTSTEELBLUE, 134 | LIGHTYELLOW, 135 | LIME, 136 | LIMEGREEN, 137 | LINEN, 138 | MAGENTA, 139 | MAROON, 140 | MEDIUMAQUAMARINE, 141 | MEDIUMBLUE, 142 | MEDIUMORCHID, 143 | MEDIUMPURPLE, 144 | MEDIUMSEAGREEN, 145 | MEDIUMSLATEBLUE, 146 | MEDIUMSPRINGGREEN, 147 | MEDIUMTURQUOISE, 148 | MEDIUMVIOLETRED, 149 | MIDNIGHTBLUE, 150 | MINTCREAM, 151 | MISTYROSE, 152 | MOCCASIN, 153 | NAVAJOWHITE, 154 | NAVY, 155 | OLDLACE, 156 | OLIVE, 157 | OLIVEDRAB, 158 | ORANGE, 159 | ORANGERED, 160 | ORCHID, 161 | PALEGOLDENROD, 162 | PALEGREEN, 163 | PALEVIOLETRED, 164 | PAPAYAWHIP, 165 | PEACHPUFF, 166 | PERU, 167 | PINK, 168 | PLUM, 169 | POWDERBLUE, 170 | PURPLE, 171 | RED, 172 | ROSYBROWN, 173 | ROYALBLUE, 174 | SADDLEBROWN, 175 | SALMON, 176 | SANDYBROWN, 177 | SEAGREEN, 178 | SEASHELL, 179 | SIENNA, 180 | SILVER, 181 | SKYBLUE, 182 | SLATEBLUE, 183 | SLATEGRAY, 184 | SLATEGREY, 185 | SNOW, 186 | SPRINGGREEN, 187 | STEELBLUE, 188 | TAN, 189 | TEAL, 190 | THISTLE, 191 | TOMATO, 192 | TURQUOISE, 193 | VIOLET, 194 | WHEAT, 195 | WHITE, 196 | WHITESMOKE, 197 | YELLOW, 198 | YELLOWGREEN, 199 | }; 200 | 201 | /** 202 | * @brief 203 | * get rgb color with enum. 204 | */ 205 | cv::Vec3d getRGBColor(const int color); 206 | 207 | } // namespace rgb_colors 208 | 209 | } // namespace cv_bridge 210 | 211 | #endif 212 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/os/bsd/open.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2012-2015 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_OS_BSD_OPEN_H 9 | #define BOOST_PREDEF_OS_BSD_OPEN_H 10 | 11 | #include 12 | 13 | /*` 14 | [heading `BOOST_OS_BSD_OPEN`] 15 | 16 | [@http://en.wikipedia.org/wiki/Openbsd OpenBSD] operating system. 17 | 18 | [table 19 | [[__predef_symbol__] [__predef_version__]] 20 | 21 | [[`__OpenBSD__`] [__predef_detection__]] 22 | 23 | [[`OpenBSD2_0`] [2.0.0]] 24 | [[`OpenBSD2_1`] [2.1.0]] 25 | [[`OpenBSD2_2`] [2.2.0]] 26 | [[`OpenBSD2_3`] [2.3.0]] 27 | [[`OpenBSD2_4`] [2.4.0]] 28 | [[`OpenBSD2_5`] [2.5.0]] 29 | [[`OpenBSD2_6`] [2.6.0]] 30 | [[`OpenBSD2_7`] [2.7.0]] 31 | [[`OpenBSD2_8`] [2.8.0]] 32 | [[`OpenBSD2_9`] [2.9.0]] 33 | [[`OpenBSD3_0`] [3.0.0]] 34 | [[`OpenBSD3_1`] [3.1.0]] 35 | [[`OpenBSD3_2`] [3.2.0]] 36 | [[`OpenBSD3_3`] [3.3.0]] 37 | [[`OpenBSD3_4`] [3.4.0]] 38 | [[`OpenBSD3_5`] [3.5.0]] 39 | [[`OpenBSD3_6`] [3.6.0]] 40 | [[`OpenBSD3_7`] [3.7.0]] 41 | [[`OpenBSD3_8`] [3.8.0]] 42 | [[`OpenBSD3_9`] [3.9.0]] 43 | [[`OpenBSD4_0`] [4.0.0]] 44 | [[`OpenBSD4_1`] [4.1.0]] 45 | [[`OpenBSD4_2`] [4.2.0]] 46 | [[`OpenBSD4_3`] [4.3.0]] 47 | [[`OpenBSD4_4`] [4.4.0]] 48 | [[`OpenBSD4_5`] [4.5.0]] 49 | [[`OpenBSD4_6`] [4.6.0]] 50 | [[`OpenBSD4_7`] [4.7.0]] 51 | [[`OpenBSD4_8`] [4.8.0]] 52 | [[`OpenBSD4_9`] [4.9.0]] 53 | ] 54 | */ 55 | 56 | #define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER_NOT_AVAILABLE 57 | 58 | #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ 59 | defined(__OpenBSD__) \ 60 | ) 61 | # ifndef BOOST_OS_BSD_AVAILABLE 62 | # define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE 63 | # define BOOST_OS_BSD_AVAILABLE 64 | # endif 65 | # undef BOOST_OS_BSD_OPEN 66 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_0) 67 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,0,0) 68 | # endif 69 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_1) 70 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,1,0) 71 | # endif 72 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_2) 73 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,2,0) 74 | # endif 75 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_3) 76 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,3,0) 77 | # endif 78 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_4) 79 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,4,0) 80 | # endif 81 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_5) 82 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,5,0) 83 | # endif 84 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_6) 85 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,6,0) 86 | # endif 87 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_7) 88 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,7,0) 89 | # endif 90 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_8) 91 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,8,0) 92 | # endif 93 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_9) 94 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,9,0) 95 | # endif 96 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_0) 97 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,0,0) 98 | # endif 99 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_1) 100 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,1,0) 101 | # endif 102 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_2) 103 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,2,0) 104 | # endif 105 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_3) 106 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,3,0) 107 | # endif 108 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_4) 109 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,4,0) 110 | # endif 111 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_5) 112 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,5,0) 113 | # endif 114 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_6) 115 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,6,0) 116 | # endif 117 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_7) 118 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,7,0) 119 | # endif 120 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_8) 121 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,8,0) 122 | # endif 123 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_9) 124 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,9,0) 125 | # endif 126 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_0) 127 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,0,0) 128 | # endif 129 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_1) 130 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,1,0) 131 | # endif 132 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_2) 133 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,2,0) 134 | # endif 135 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_3) 136 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,3,0) 137 | # endif 138 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_4) 139 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,4,0) 140 | # endif 141 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_5) 142 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,5,0) 143 | # endif 144 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_6) 145 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,6,0) 146 | # endif 147 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_7) 148 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,7,0) 149 | # endif 150 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_8) 151 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,8,0) 152 | # endif 153 | # if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_9) 154 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,9,0) 155 | # endif 156 | # if !defined(BOOST_OS_BSD_OPEN) 157 | # define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER_AVAILABLE 158 | # endif 159 | #endif 160 | 161 | #if BOOST_OS_BSD_OPEN 162 | # define BOOST_OS_BSD_OPEN_AVAILABLE 163 | # include 164 | #endif 165 | 166 | #define BOOST_OS_BSD_OPEN_NAME "OpenBSD" 167 | 168 | #endif 169 | 170 | #include 171 | BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_OPEN,BOOST_OS_BSD_OPEN_NAME) 172 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/doc/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # cv_bridge documentation build configuration file, created by 4 | # sphinx-quickstart on Mon Jun 1 14:21:53 2009. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.append(os.path.abspath('.')) 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # Add any Sphinx extension module names here, as strings. They can be extensions 24 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 25 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.pngmath'] 26 | 27 | # Add any paths that contain templates here, relative to this directory. 28 | templates_path = ['_templates'] 29 | 30 | # The suffix of source filenames. 31 | source_suffix = '.rst' 32 | 33 | # The encoding of source files. 34 | #source_encoding = 'utf-8' 35 | 36 | # The master toctree document. 37 | master_doc = 'index' 38 | 39 | # General information about the project. 40 | project = u'cv_bridge' 41 | copyright = u'2009, Willow Garage, Inc.' 42 | 43 | # The version info for the project you're documenting, acts as replacement for 44 | # |version| and |release|, also used in various other places throughout the 45 | # built documents. 46 | # 47 | # The short X.Y version. 48 | version = '0.1' 49 | # The full version, including alpha/beta/rc tags. 50 | release = '0.1.0' 51 | 52 | # The language for content autogenerated by Sphinx. Refer to documentation 53 | # for a list of supported languages. 54 | #language = None 55 | 56 | # There are two options for replacing |today|: either, you set today to some 57 | # non-false value, then it is used: 58 | #today = '' 59 | # Else, today_fmt is used as the format for a strftime call. 60 | #today_fmt = '%B %d, %Y' 61 | 62 | # List of documents that shouldn't be included in the build. 63 | #unused_docs = [] 64 | 65 | # List of directories, relative to source directory, that shouldn't be searched 66 | # for source files. 67 | exclude_trees = ['_build'] 68 | 69 | # The reST default role (used for this markup: `text`) to use for all documents. 70 | #default_role = None 71 | 72 | # If true, '()' will be appended to :func: etc. cross-reference text. 73 | #add_function_parentheses = True 74 | 75 | # If true, the current module name will be prepended to all description 76 | # unit titles (such as .. function::). 77 | #add_module_names = True 78 | 79 | # If true, sectionauthor and moduleauthor directives will be shown in the 80 | # output. They are ignored by default. 81 | #show_authors = False 82 | 83 | # The name of the Pygments (syntax highlighting) style to use. 84 | pygments_style = 'sphinx' 85 | 86 | # A list of ignored prefixes for module index sorting. 87 | #modindex_common_prefix = [] 88 | 89 | 90 | # -- Options for HTML output --------------------------------------------------- 91 | 92 | # The theme to use for HTML and HTML Help pages. Major themes that come with 93 | # Sphinx are currently 'default' and 'sphinxdoc'. 94 | html_theme = 'default' 95 | 96 | # Theme options are theme-specific and customize the look and feel of a theme 97 | # further. For a list of options available for each theme, see the 98 | # documentation. 99 | #html_theme_options = {} 100 | 101 | # Add any paths that contain custom themes here, relative to this directory. 102 | #html_theme_path = [] 103 | 104 | # The name for this set of Sphinx documents. If None, it defaults to 105 | # " v documentation". 106 | #html_title = None 107 | 108 | # A shorter title for the navigation bar. Default is the same as html_title. 109 | #html_short_title = None 110 | 111 | # The name of an image file (relative to this directory) to place at the top 112 | # of the sidebar. 113 | #html_logo = None 114 | 115 | # The name of an image file (within the static path) to use as favicon of the 116 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 117 | # pixels large. 118 | #html_favicon = None 119 | 120 | # Add any paths that contain custom static files (such as style sheets) here, 121 | # relative to this directory. They are copied after the builtin static files, 122 | # so a file named "default.css" will overwrite the builtin "default.css". 123 | #html_static_path = ['_static'] 124 | 125 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 126 | # using the given strftime format. 127 | #html_last_updated_fmt = '%b %d, %Y' 128 | 129 | # If true, SmartyPants will be used to convert quotes and dashes to 130 | # typographically correct entities. 131 | #html_use_smartypants = True 132 | 133 | # Custom sidebar templates, maps document names to template names. 134 | #html_sidebars = {} 135 | 136 | # Additional templates that should be rendered to pages, maps page names to 137 | # template names. 138 | #html_additional_pages = {} 139 | 140 | # If false, no module index is generated. 141 | #html_use_modindex = True 142 | 143 | # If false, no index is generated. 144 | #html_use_index = True 145 | 146 | # If true, the index is split into individual pages for each letter. 147 | #html_split_index = False 148 | 149 | # If true, links to the reST sources are added to the pages. 150 | #html_show_sourcelink = True 151 | 152 | # If true, an OpenSearch description file will be output, and all pages will 153 | # contain a tag referring to it. The value of this option must be the 154 | # base URL from which the finished HTML is served. 155 | #html_use_opensearch = '' 156 | 157 | # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). 158 | #html_file_suffix = '' 159 | 160 | # Output file base name for HTML help builder. 161 | htmlhelp_basename = 'cv_bridgedoc' 162 | 163 | 164 | # -- Options for LaTeX output -------------------------------------------------- 165 | 166 | # The paper size ('letter' or 'a4'). 167 | #latex_paper_size = 'letter' 168 | 169 | # The font size ('10pt', '11pt' or '12pt'). 170 | #latex_font_size = '10pt' 171 | 172 | # Grouping the document tree into LaTeX files. List of tuples 173 | # (source start file, target name, title, author, documentclass [howto/manual]). 174 | latex_documents = [ 175 | ('index', 'cv_bridge.tex', u'stereo\\_utils Documentation', 176 | u'James Bowman', 'manual'), 177 | ] 178 | 179 | # The name of an image file (relative to this directory) to place at the top of 180 | # the title page. 181 | #latex_logo = None 182 | 183 | # For "manual" documents, if this is true, then toplevel headings are parts, 184 | # not chapters. 185 | #latex_use_parts = False 186 | 187 | # Additional stuff for the LaTeX preamble. 188 | #latex_preamble = '' 189 | 190 | # Documents to append as an appendix to all manuals. 191 | #latex_appendices = [] 192 | 193 | # If false, no module index is generated. 194 | #latex_use_modindex = True 195 | 196 | 197 | # Example configuration for intersphinx: refer to the Python standard library. 198 | intersphinx_mapping = { 199 | 'http://docs.python.org/': None, 200 | 'http://docs.scipy.org/doc/numpy' : None, 201 | } 202 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/doc/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # image_geometry documentation build configuration file, created by 4 | # sphinx-quickstart on Mon Jun 1 14:21:53 2009. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.append(os.path.abspath('.')) 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # Add any Sphinx extension module names here, as strings. They can be extensions 24 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 25 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.imgmath'] 26 | 27 | # Add any paths that contain templates here, relative to this directory. 28 | templates_path = ['_templates'] 29 | 30 | # The suffix of source filenames. 31 | source_suffix = '.rst' 32 | 33 | # The encoding of source files. 34 | #source_encoding = 'utf-8' 35 | 36 | # The master toctree document. 37 | master_doc = 'index' 38 | 39 | # General information about the project. 40 | project = u'image_geometry' 41 | copyright = u'2009, Willow Garage, Inc.' 42 | 43 | # The version info for the project you're documenting, acts as replacement for 44 | # |version| and |release|, also used in various other places throughout the 45 | # built documents. 46 | # 47 | # The short X.Y version. 48 | version = '0.1' 49 | # The full version, including alpha/beta/rc tags. 50 | release = '0.1.0' 51 | 52 | # The language for content autogenerated by Sphinx. Refer to documentation 53 | # for a list of supported languages. 54 | #language = None 55 | 56 | # There are two options for replacing |today|: either, you set today to some 57 | # non-false value, then it is used: 58 | #today = '' 59 | # Else, today_fmt is used as the format for a strftime call. 60 | #today_fmt = '%B %d, %Y' 61 | 62 | # List of documents that shouldn't be included in the build. 63 | #unused_docs = [] 64 | 65 | # List of directories, relative to source directory, that shouldn't be searched 66 | # for source files. 67 | exclude_trees = ['_build'] 68 | 69 | # The reST default role (used for this markup: `text`) to use for all documents. 70 | #default_role = None 71 | 72 | # If true, '()' will be appended to :func: etc. cross-reference text. 73 | #add_function_parentheses = True 74 | 75 | # If true, the current module name will be prepended to all description 76 | # unit titles (such as .. function::). 77 | #add_module_names = True 78 | 79 | # If true, sectionauthor and moduleauthor directives will be shown in the 80 | # output. They are ignored by default. 81 | #show_authors = False 82 | 83 | # The name of the Pygments (syntax highlighting) style to use. 84 | pygments_style = 'sphinx' 85 | 86 | # A list of ignored prefixes for module index sorting. 87 | #modindex_common_prefix = [] 88 | 89 | 90 | # -- Options for HTML output --------------------------------------------------- 91 | 92 | # The theme to use for HTML and HTML Help pages. Major themes that come with 93 | # Sphinx are currently 'default' and 'sphinxdoc'. 94 | html_theme = 'default' 95 | 96 | # Theme options are theme-specific and customize the look and feel of a theme 97 | # further. For a list of options available for each theme, see the 98 | # documentation. 99 | #html_theme_options = {} 100 | 101 | # Add any paths that contain custom themes here, relative to this directory. 102 | #html_theme_path = [] 103 | 104 | # The name for this set of Sphinx documents. If None, it defaults to 105 | # " v documentation". 106 | #html_title = None 107 | 108 | # A shorter title for the navigation bar. Default is the same as html_title. 109 | #html_short_title = None 110 | 111 | # The name of an image file (relative to this directory) to place at the top 112 | # of the sidebar. 113 | #html_logo = None 114 | 115 | # The name of an image file (within the static path) to use as favicon of the 116 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 117 | # pixels large. 118 | #html_favicon = None 119 | 120 | # Add any paths that contain custom static files (such as style sheets) here, 121 | # relative to this directory. They are copied after the builtin static files, 122 | # so a file named "default.css" will overwrite the builtin "default.css". 123 | #html_static_path = ['_static'] 124 | 125 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 126 | # using the given strftime format. 127 | #html_last_updated_fmt = '%b %d, %Y' 128 | 129 | # If true, SmartyPants will be used to convert quotes and dashes to 130 | # typographically correct entities. 131 | #html_use_smartypants = True 132 | 133 | # Custom sidebar templates, maps document names to template names. 134 | #html_sidebars = {} 135 | 136 | # Additional templates that should be rendered to pages, maps page names to 137 | # template names. 138 | #html_additional_pages = {} 139 | 140 | # If false, no module index is generated. 141 | #html_use_modindex = True 142 | 143 | # If false, no index is generated. 144 | #html_use_index = True 145 | 146 | # If true, the index is split into individual pages for each letter. 147 | #html_split_index = False 148 | 149 | # If true, links to the reST sources are added to the pages. 150 | #html_show_sourcelink = True 151 | 152 | # If true, an OpenSearch description file will be output, and all pages will 153 | # contain a tag referring to it. The value of this option must be the 154 | # base URL from which the finished HTML is served. 155 | #html_use_opensearch = '' 156 | 157 | # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). 158 | #html_file_suffix = '' 159 | 160 | # Output file base name for HTML help builder. 161 | htmlhelp_basename = 'image_geometrydoc' 162 | 163 | 164 | # -- Options for LaTeX output -------------------------------------------------- 165 | 166 | # The paper size ('letter' or 'a4'). 167 | #latex_paper_size = 'letter' 168 | 169 | # The font size ('10pt', '11pt' or '12pt'). 170 | #latex_font_size = '10pt' 171 | 172 | # Grouping the document tree into LaTeX files. List of tuples 173 | # (source start file, target name, title, author, documentclass [howto/manual]). 174 | latex_documents = [ 175 | ('index', 'image_geometry.tex', u'stereo\\_utils Documentation', 176 | u'James Bowman', 'manual'), 177 | ] 178 | 179 | # The name of an image file (relative to this directory) to place at the top of 180 | # the title page. 181 | #latex_logo = None 182 | 183 | # For "manual" documents, if this is true, then toplevel headings are parts, 184 | # not chapters. 185 | #latex_use_parts = False 186 | 187 | # Additional stuff for the LaTeX preamble. 188 | #latex_preamble = '' 189 | 190 | # Documents to append as an appendix to all manuals. 191 | #latex_appendices = [] 192 | 193 | # If false, no module index is generated. 194 | #latex_use_modindex = True 195 | 196 | # Example configuration for intersphinx: refer to the Python standard library. 197 | intersphinx_mapping = { 198 | 'http://docs.python.org/': None, 199 | 'http://docs.scipy.org/doc/numpy' : None, 200 | 'http://docs.ros.org/api/tf/html/python/' : None, 201 | } 202 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/core/scoped_enum.hpp: -------------------------------------------------------------------------------- 1 | // scoped_enum.hpp ---------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes, 2009 4 | // Copyright (C) 2011-2012 Vicente J. Botet Escriba 5 | // Copyright (C) 2012 Anthony Williams 6 | 7 | // Distributed under the Boost Software License, Version 1.0. 8 | // See http://www.boost.org/LICENSE_1_0.txt 9 | 10 | #ifndef BOOST_CORE_SCOPED_ENUM_HPP 11 | #define BOOST_CORE_SCOPED_ENUM_HPP 12 | 13 | #include 14 | 15 | #ifdef BOOST_HAS_PRAGMA_ONCE 16 | #pragma once 17 | #endif 18 | 19 | namespace boost 20 | { 21 | 22 | #ifdef BOOST_NO_CXX11_SCOPED_ENUMS 23 | 24 | /** 25 | * Meta-function to get the native enum type associated to an enum class or its emulation. 26 | */ 27 | template 28 | struct native_type 29 | { 30 | /** 31 | * The member typedef type names the native enum type associated to the scoped enum, 32 | * which is it self if the compiler supports scoped enums or EnumType::enum_type if it is an emulated scoped enum. 33 | */ 34 | typedef typename EnumType::enum_type type; 35 | }; 36 | 37 | /** 38 | * Casts a scoped enum to its underlying type. 39 | * 40 | * This function is useful when working with scoped enum classes, which doens't implicitly convert to the underlying type. 41 | * @param v A scoped enum. 42 | * @returns The underlying type. 43 | * @throws No-throws. 44 | */ 45 | template 46 | UnderlyingType underlying_cast(EnumType v) 47 | { 48 | return v.get_underlying_value_(); 49 | } 50 | 51 | /** 52 | * Casts a scoped enum to its native enum type. 53 | * 54 | * This function is useful to make programs portable when the scoped enum emulation can not be use where native enums can. 55 | * 56 | * EnumType the scoped enum type 57 | * 58 | * @param v A scoped enum. 59 | * @returns The native enum value. 60 | * @throws No-throws. 61 | */ 62 | template 63 | inline 64 | typename EnumType::enum_type native_value(EnumType e) 65 | { 66 | return e.get_native_value_(); 67 | } 68 | 69 | #else // BOOST_NO_CXX11_SCOPED_ENUMS 70 | 71 | template 72 | struct native_type 73 | { 74 | typedef EnumType type; 75 | }; 76 | 77 | template 78 | UnderlyingType underlying_cast(EnumType v) 79 | { 80 | return static_cast(v); 81 | } 82 | 83 | template 84 | inline 85 | EnumType native_value(EnumType e) 86 | { 87 | return e; 88 | } 89 | 90 | #endif // BOOST_NO_CXX11_SCOPED_ENUMS 91 | } 92 | 93 | 94 | #ifdef BOOST_NO_CXX11_SCOPED_ENUMS 95 | 96 | #ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS 97 | 98 | #define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \ 99 | explicit operator underlying_type() const BOOST_NOEXCEPT { return get_underlying_value_(); } 100 | 101 | #else 102 | 103 | #define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR 104 | 105 | #endif 106 | 107 | /** 108 | * Start a declaration of a scoped enum. 109 | * 110 | * @param EnumType The new scoped enum. 111 | * @param UnderlyingType The underlying type. 112 | */ 113 | #define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType, UnderlyingType) \ 114 | struct EnumType { \ 115 | typedef void is_boost_scoped_enum_tag; \ 116 | typedef UnderlyingType underlying_type; \ 117 | EnumType() BOOST_NOEXCEPT {} \ 118 | explicit EnumType(underlying_type v) BOOST_NOEXCEPT : v_(v) {} \ 119 | underlying_type get_underlying_value_() const BOOST_NOEXCEPT { return v_; } \ 120 | BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \ 121 | private: \ 122 | underlying_type v_; \ 123 | typedef EnumType self_type; \ 124 | public: \ 125 | enum enum_type 126 | 127 | #define BOOST_SCOPED_ENUM_DECLARE_END2() \ 128 | enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \ 129 | friend bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \ 130 | friend bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \ 131 | friend bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \ 132 | friend bool operator !=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=enum_type(rhs.v_); } \ 133 | friend bool operator !=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=rhs; } \ 134 | friend bool operator !=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs!=enum_type(rhs.v_); } \ 135 | friend bool operator <(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>enum_type(rhs.v_); } \ 142 | friend bool operator >(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>rhs; } \ 143 | friend bool operator >(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>enum_type(rhs.v_); } \ 144 | friend bool operator >=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=enum_type(rhs.v_); } \ 145 | friend bool operator >=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=rhs; } \ 146 | friend bool operator >=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>=enum_type(rhs.v_); } \ 147 | }; 148 | 149 | #define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) \ 150 | ; \ 151 | EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {} \ 152 | BOOST_SCOPED_ENUM_DECLARE_END2() 153 | 154 | /** 155 | * Starts a declaration of a scoped enum with the default int underlying type. 156 | * 157 | * @param EnumType The new scoped enum. 158 | */ 159 | #define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) \ 160 | BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,int) 161 | 162 | /** 163 | * Name of the native enum type. 164 | * 165 | * @param EnumType The new scoped enum. 166 | */ 167 | #define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType::enum_type 168 | /** 169 | * Forward declares an scoped enum. 170 | * 171 | * @param EnumType The scoped enum. 172 | */ 173 | #define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) struct EnumType 174 | 175 | #else // BOOST_NO_CXX11_SCOPED_ENUMS 176 | 177 | #define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,UnderlyingType) enum class EnumType : UnderlyingType 178 | #define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) enum class EnumType 179 | #define BOOST_SCOPED_ENUM_DECLARE_END2() 180 | #define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) ; 181 | 182 | #define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType 183 | #define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) enum class EnumType 184 | 185 | #endif // BOOST_NO_CXX11_SCOPED_ENUMS 186 | 187 | // Deprecated macros 188 | #define BOOST_SCOPED_ENUM_START(name) BOOST_SCOPED_ENUM_DECLARE_BEGIN(name) 189 | #define BOOST_SCOPED_ENUM_END BOOST_SCOPED_ENUM_DECLARE_END2() 190 | #define BOOST_SCOPED_ENUM(name) BOOST_SCOPED_ENUM_NATIVE(name) 191 | 192 | #endif // BOOST_CORE_SCOPED_ENUM_HPP 193 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/src/boost/predef/other/endian.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Rene Rivera 2013-2015 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef BOOST_PREDEF_ENDIAN_H 9 | #define BOOST_PREDEF_ENDIAN_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | /*` 19 | [heading `BOOST_ENDIAN_*`] 20 | 21 | Detection of endian memory ordering. There are four defined macros 22 | in this header that define the various generally possible endian 23 | memory orderings: 24 | 25 | * `BOOST_ENDIAN_BIG_BYTE`, byte-swapped big-endian. 26 | * `BOOST_ENDIAN_BIG_WORD`, word-swapped big-endian. 27 | * `BOOST_ENDIAN_LITTLE_BYTE`, byte-swapped little-endian. 28 | * `BOOST_ENDIAN_LITTLE_WORD`, word-swapped little-endian. 29 | 30 | The detection is conservative in that it only identifies endianness 31 | that it knows for certain. In particular bi-endianness is not 32 | indicated as is it not practically possible to determine the 33 | endianness from anything but an operating system provided 34 | header. And the currently known headers do not define that 35 | programatic bi-endianness is available. 36 | 37 | This implementation is a compilation of various publicly available 38 | information and acquired knowledge: 39 | 40 | # The indispensable documentation of "Pre-defined Compiler Macros" 41 | [@http://sourceforge.net/p/predef/wiki/Endianness Endianness]. 42 | # The various endian specifications available in the 43 | [@http://wikipedia.org/ Wikipedia] computer architecture pages. 44 | # Generally available searches for headers that define endianness. 45 | */ 46 | 47 | #define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE 48 | #define BOOST_ENDIAN_BIG_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE 49 | #define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE 50 | #define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE 51 | 52 | /* GNU libc provides a header defining __BYTE_ORDER, or _BYTE_ORDER. 53 | * And some OSs provide some for of endian header also. 54 | */ 55 | #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ 56 | !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD 57 | # if BOOST_LIB_C_GNU || BOOST_OS_ANDROID 58 | # include 59 | # else 60 | # if BOOST_OS_MACOS 61 | # include 62 | # else 63 | # if BOOST_OS_BSD 64 | # if BOOST_OS_BSD_OPEN 65 | # include 66 | # else 67 | # include 68 | # endif 69 | # endif 70 | # endif 71 | # endif 72 | # if defined(__BYTE_ORDER) 73 | # if defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN) 74 | # undef BOOST_ENDIAN_BIG_BYTE 75 | # define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE 76 | # endif 77 | # if defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == __LITTLE_ENDIAN) 78 | # undef BOOST_ENDIAN_LITTLE_BYTE 79 | # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE 80 | # endif 81 | # if defined(__PDP_ENDIAN) && (__BYTE_ORDER == __PDP_ENDIAN) 82 | # undef BOOST_ENDIAN_LITTLE_WORD 83 | # define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE 84 | # endif 85 | # endif 86 | # if !defined(__BYTE_ORDER) && defined(_BYTE_ORDER) 87 | # if defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN) 88 | # undef BOOST_ENDIAN_BIG_BYTE 89 | # define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE 90 | # endif 91 | # if defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN) 92 | # undef BOOST_ENDIAN_LITTLE_BYTE 93 | # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE 94 | # endif 95 | # if defined(_PDP_ENDIAN) && (_BYTE_ORDER == _PDP_ENDIAN) 96 | # undef BOOST_ENDIAN_LITTLE_WORD 97 | # define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE 98 | # endif 99 | # endif 100 | #endif 101 | 102 | /* Built-in byte-swpped big-endian macros. 103 | */ 104 | #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ 105 | !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD 106 | # if (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) || \ 107 | (defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)) || \ 108 | defined(__ARMEB__) || \ 109 | defined(__THUMBEB__) || \ 110 | defined(__AARCH64EB__) || \ 111 | defined(_MIPSEB) || \ 112 | defined(__MIPSEB) || \ 113 | defined(__MIPSEB__) 114 | # undef BOOST_ENDIAN_BIG_BYTE 115 | # define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE 116 | # endif 117 | #endif 118 | 119 | /* Built-in byte-swpped little-endian macros. 120 | */ 121 | #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ 122 | !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD 123 | # if (defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \ 124 | (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) || \ 125 | defined(__ARMEL__) || \ 126 | defined(__THUMBEL__) || \ 127 | defined(__AARCH64EL__) || \ 128 | defined(_MIPSEL) || \ 129 | defined(__MIPSEL) || \ 130 | defined(__MIPSEL__) 131 | # undef BOOST_ENDIAN_LITTLE_BYTE 132 | # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE 133 | # endif 134 | #endif 135 | 136 | /* Some architectures are strictly one endianess (as opposed 137 | * the current common bi-endianess). 138 | */ 139 | #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ 140 | !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD 141 | # include 142 | # if BOOST_ARCH_M68K || \ 143 | BOOST_ARCH_PARISC || \ 144 | BOOST_ARCH_SPARC || \ 145 | BOOST_ARCH_SYS370 || \ 146 | BOOST_ARCH_SYS390 || \ 147 | BOOST_ARCH_Z 148 | # undef BOOST_ENDIAN_BIG_BYTE 149 | # define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE 150 | # endif 151 | # if BOOST_ARCH_AMD64 || \ 152 | BOOST_ARCH_IA64 || \ 153 | BOOST_ARCH_X86 || \ 154 | BOOST_ARCH_BLACKFIN 155 | # undef BOOST_ENDIAN_LITTLE_BYTE 156 | # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE 157 | # endif 158 | #endif 159 | 160 | /* Windows on ARM, if not otherwise detected/specified, is always 161 | * byte-swaped little-endian. 162 | */ 163 | #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ 164 | !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD 165 | # if BOOST_ARCH_ARM 166 | # include 167 | # if BOOST_OS_WINDOWS 168 | # undef BOOST_ENDIAN_LITTLE_BYTE 169 | # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE 170 | # endif 171 | # endif 172 | #endif 173 | 174 | #if BOOST_ENDIAN_BIG_BYTE 175 | # define BOOST_ENDIAN_BIG_BYTE_AVAILABLE 176 | #endif 177 | #if BOOST_ENDIAN_BIG_WORD 178 | # define BOOST_ENDIAN_BIG_WORD_BYTE_AVAILABLE 179 | #endif 180 | #if BOOST_ENDIAN_LITTLE_BYTE 181 | # define BOOST_ENDIAN_LITTLE_BYTE_AVAILABLE 182 | #endif 183 | #if BOOST_ENDIAN_LITTLE_WORD 184 | # define BOOST_ENDIAN_LITTLE_WORD_BYTE_AVAILABLE 185 | #endif 186 | 187 | #define BOOST_ENDIAN_BIG_BYTE_NAME "Byte-Swapped Big-Endian" 188 | #define BOOST_ENDIAN_BIG_WORD_NAME "Word-Swapped Big-Endian" 189 | #define BOOST_ENDIAN_LITTLE_BYTE_NAME "Byte-Swapped Little-Endian" 190 | #define BOOST_ENDIAN_LITTLE_WORD_NAME "Word-Swapped Little-Endian" 191 | 192 | #endif 193 | 194 | #include 195 | BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_BYTE,BOOST_ENDIAN_BIG_BYTE_NAME) 196 | 197 | #include 198 | BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_WORD,BOOST_ENDIAN_BIG_WORD_NAME) 199 | 200 | #include 201 | BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_BYTE,BOOST_ENDIAN_LITTLE_BYTE_NAME) 202 | 203 | #include 204 | BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_WORD,BOOST_ENDIAN_LITTLE_WORD_NAME) 205 | -------------------------------------------------------------------------------- /vision_opencv-noetic/cv_bridge/test/utest2.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright (c) 2009, Willow Garage, Inc. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * * Neither the name of the Willow Garage nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | *********************************************************************/ 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | #include "opencv2/core/core.hpp" 40 | 41 | #include "cv_bridge/cv_bridge.h" 42 | #include 43 | #include 44 | 45 | using namespace sensor_msgs::image_encodings; 46 | 47 | bool isUnsigned(const std::string & encoding) { 48 | return encoding == RGB8 || encoding == RGBA8 || encoding == RGB16 || encoding == RGBA16 || encoding == BGR8 || encoding == BGRA8 || encoding == BGR16 || encoding == BGRA16 || encoding == MONO8 || encoding == MONO16 || 49 | encoding == MONO8 || encoding == MONO16 || encoding == TYPE_8UC1 || encoding == TYPE_8UC2 || encoding == TYPE_8UC3 || encoding == TYPE_8UC4 || 50 | encoding == TYPE_16UC1 || encoding == TYPE_16UC2 || encoding == TYPE_16UC3 || encoding == TYPE_16UC4; 51 | //BAYER_RGGB8, BAYER_BGGR8, BAYER_GBRG8, BAYER_GRBG8, BAYER_RGGB16, BAYER_BGGR16, BAYER_GBRG16, BAYER_GRBG16, 52 | //YUV422 53 | } 54 | std::vector 55 | getEncodings() { 56 | // TODO for Groovy, the following types should be uncommented 57 | std::string encodings[] = { RGB8, RGBA8, RGB16, RGBA16, BGR8, BGRA8, BGR16, BGRA16, MONO8, MONO16, 58 | TYPE_8UC1, /*TYPE_8UC2,*/ TYPE_8UC3, TYPE_8UC4, 59 | TYPE_8SC1, /*TYPE_8SC2,*/ TYPE_8SC3, TYPE_8SC4, 60 | TYPE_16UC1, /*TYPE_16UC2,*/ TYPE_16UC3, TYPE_16UC4, 61 | TYPE_16SC1, /*TYPE_16SC2,*/ TYPE_16SC3, TYPE_16SC4, 62 | TYPE_32SC1, /*TYPE_32SC2,*/ TYPE_32SC3, TYPE_32SC4, 63 | TYPE_32FC1, /*TYPE_32FC2,*/ TYPE_32FC3, TYPE_32FC4, 64 | TYPE_64FC1, /*TYPE_64FC2,*/ TYPE_64FC3, TYPE_64FC4, 65 | //BAYER_RGGB8, BAYER_BGGR8, BAYER_GBRG8, BAYER_GRBG8, BAYER_RGGB16, BAYER_BGGR16, BAYER_GBRG16, BAYER_GRBG16, 66 | YUV422 67 | }; 68 | return std::vector(encodings, encodings+47-8-7); 69 | } 70 | 71 | TEST(OpencvTests, testCase_encode_decode) 72 | { 73 | std::vector encodings = getEncodings(); 74 | for(size_t i=0; iimage, cv_bridge::Exception); 117 | continue; 118 | } 119 | // We do not support conversion to YUV422 for now, except from YUV422 120 | if ((dst_encoding == YUV422) && (src_encoding != YUV422)) { 121 | EXPECT_THROW(cv_bridge::toCvShare(image_msg, dst_encoding), cv_bridge::Exception); 122 | continue; 123 | } 124 | 125 | cv_image = cv_bridge::toCvShare(image_msg, dst_encoding); 126 | 127 | // We do not support conversion to YUV422 for now, except from YUV422 128 | if ((src_encoding == YUV422) && (dst_encoding != YUV422)) { 129 | EXPECT_THROW(cvtColor(cv_image, src_encoding)->image, cv_bridge::Exception); 130 | continue; 131 | } 132 | } 133 | // And convert back to a cv::Mat 134 | image_back = cvtColor(cv_image, src_encoding)->image; 135 | 136 | // If the number of channels,s different some information got lost at some point, so no possible test 137 | if (!is_num_channels_the_same) 138 | continue; 139 | if (bitDepth(src_encoding) >= 32) { 140 | // In the case where the input has floats, we will lose precision but no more than 1 141 | EXPECT_LT(cv::norm(image_original, image_back, cv::NORM_INF), 1) << "problem converting from " << src_encoding << " to " << dst_encoding << " and back."; 142 | } else if ((bitDepth(src_encoding) == 16) && (bitDepth(dst_encoding) == 8)) { 143 | // In the case where the input has floats, we will lose precision but no more than 1 * max(127) 144 | EXPECT_LT(cv::norm(image_original, image_back, cv::NORM_INF), 128) << "problem converting from " << src_encoding << " to " << dst_encoding << " and back."; 145 | } else { 146 | EXPECT_EQ(cv::norm(image_original, image_back, cv::NORM_INF), 0) << "problem converting from " << src_encoding << " to " << dst_encoding << " and back."; 147 | } 148 | } 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /vision_opencv-noetic/opencv_tests/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package opencv_tests 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 1.16.2 (2022-10-03) 6 | ------------------- 7 | 8 | 1.16.1 (2022-09-06) 9 | ------------------- 10 | 11 | 1.16.0 (2021-11-23) 12 | ------------------- 13 | 14 | 1.15.0 (2020-05-19) 15 | ------------------- 16 | 17 | 1.14.0 (2020-04-06) 18 | ------------------- 19 | * Noetic release (`#323 `_) 20 | * Contributors: Alejandro Hernández Cordero 21 | 22 | 1.13.0 (2018-04-30) 23 | ------------------- 24 | 25 | 1.12.8 (2018-04-17) 26 | ------------------- 27 | 28 | 1.12.7 (2017-11-12) 29 | ------------------- 30 | 31 | 1.12.6 (2017-11-11) 32 | ------------------- 33 | 34 | 1.12.5 (2017-11-05) 35 | ------------------- 36 | 37 | 1.12.4 (2017-01-29) 38 | ------------------- 39 | 40 | 1.12.3 (2016-12-04) 41 | ------------------- 42 | 43 | 1.12.2 (2016-09-24) 44 | ------------------- 45 | 46 | 1.12.1 (2016-07-11) 47 | ------------------- 48 | * Support compressed Images messages in python for indigo 49 | - Add cv2_to_comprssed_imgmsg: Convert from cv2 image to compressed image ros msg. 50 | - Add comprssed_imgmsg_to_cv2: Convert the compress message to a new image. 51 | - Add compressed image tests. 52 | - Add time to msgs (compressed and regular). 53 | add enumerants test for compressed image. 54 | merge the compressed tests with the regular ones. 55 | better comment explanation. I will squash this commit. 56 | Fix indentation 57 | fix typo mistage: from .imgmsg_to_compressed_cv2 to .compressed_imgmsg_to_cv2. 58 | remove cv2.CV_8UC1 59 | remove rospy and time depndency. 60 | change from IMREAD_COLOR to IMREAD_ANYCOLOR. 61 | - make indentaion of 4. 62 | - remove space trailer. 63 | - remove space from empty lines. 64 | - another set of for loops, it will make things easier to track. In that new set, just have the number of channels in ([],1,3,4) (ignore two for jpg). from: https://github.com/ros-perception/vision_opencv/pull/132#discussion_r66721943 65 | - keep the OpenCV error message. from: https://github.com/ros-perception/vision_opencv/pull/132#discussion_r66721013 66 | add debug print for test. 67 | add case for 4 channels in test. 68 | remove 4 channels case from compressed test. 69 | add debug print for test. 70 | change typo of format. 71 | fix typo in format. change from dip to dib. 72 | change to IMREAD_ANYCOLOR as python code. (as it should). 73 | rename TIFF to tiff 74 | Sperate the tests one for regular images and one for compressed. 75 | update comment 76 | * Contributors: talregev 77 | 78 | 1.12.0 (2016-03-18) 79 | ------------------- 80 | 81 | 1.11.12 (2016-03-10) 82 | -------------------- 83 | 84 | 1.11.11 (2016-01-31) 85 | -------------------- 86 | * fix a few warnings in doc jobs 87 | * Contributors: Vincent Rabaud 88 | 89 | 1.11.10 (2016-01-16) 90 | -------------------- 91 | 92 | 1.11.9 (2015-11-29) 93 | ------------------- 94 | 95 | 1.11.8 (2015-07-15) 96 | ------------------- 97 | * simplify dependencies 98 | * Contributors: Vincent Rabaud 99 | 100 | 1.11.7 (2014-12-14) 101 | ------------------- 102 | 103 | 1.11.6 (2014-11-16) 104 | ------------------- 105 | 106 | 1.11.5 (2014-09-21) 107 | ------------------- 108 | 109 | 1.11.4 (2014-07-27) 110 | ------------------- 111 | 112 | 1.11.3 (2014-06-08) 113 | ------------------- 114 | * remove file whose functinality is now in cv_bridge 115 | * remove references to cv (use cv2) 116 | * Correct dependency from non-existent package to cv_bridge 117 | * Contributors: Isaac Isao Saito, Vincent Rabaud 118 | 119 | 1.11.2 (2014-04-28) 120 | ------------------- 121 | 122 | 1.11.1 (2014-04-16) 123 | ------------------- 124 | 125 | 1.11.0 (2014-02-15) 126 | ------------------- 127 | 128 | 1.10.15 (2014-02-07) 129 | -------------------- 130 | 131 | 1.10.14 (2013-11-23 16:17) 132 | -------------------------- 133 | * Contributors: Vincent Rabaud 134 | 135 | 1.10.13 (2013-11-23 09:19) 136 | -------------------------- 137 | * Contributors: Vincent Rabaud 138 | 139 | 1.10.12 (2013-11-22) 140 | -------------------- 141 | * Contributors: Vincent Rabaud 142 | 143 | 1.10.11 (2013-10-23) 144 | -------------------- 145 | * Contributors: Vincent Rabaud 146 | 147 | 1.10.10 (2013-10-19) 148 | -------------------- 149 | * Contributors: Vincent Rabaud 150 | 151 | 1.10.9 (2013-10-07) 152 | ------------------- 153 | * Contributors: Vincent Rabaud 154 | 155 | 1.10.8 (2013-09-09) 156 | ------------------- 157 | * update email address 158 | * Contributors: Vincent Rabaud 159 | 160 | 1.10.7 (2013-07-17) 161 | ------------------- 162 | 163 | 1.10.6 (2013-03-01) 164 | ------------------- 165 | 166 | 1.10.5 (2013-02-11) 167 | ------------------- 168 | 169 | 1.10.4 (2013-02-02) 170 | ------------------- 171 | 172 | 1.10.3 (2013-01-17) 173 | ------------------- 174 | 175 | 1.10.2 (2013-01-13) 176 | ------------------- 177 | 178 | 1.10.1 (2013-01-10) 179 | ------------------- 180 | * fixes `#5 `_ by removing the logic from Python and using wrapped C++ and adding a test for it 181 | * Contributors: Vincent Rabaud 182 | 183 | 1.10.0 (2013-01-03) 184 | ------------------- 185 | 186 | 1.9.15 (2013-01-02) 187 | ------------------- 188 | 189 | 1.9.14 (2012-12-30) 190 | ------------------- 191 | 192 | 1.9.13 (2012-12-15) 193 | ------------------- 194 | 195 | 1.9.12 (2012-12-14) 196 | ------------------- 197 | * Removed brief tag 198 | Conflicts: 199 | opencv_tests/package.xml 200 | * buildtool_depend catkin fix 201 | * Contributors: William Woodall 202 | 203 | 1.9.11 (2012-12-10) 204 | ------------------- 205 | 206 | 1.9.10 (2012-10-04) 207 | ------------------- 208 | 209 | 1.9.9 (2012-10-01) 210 | ------------------ 211 | 212 | 1.9.8 (2012-09-30) 213 | ------------------ 214 | 215 | 1.9.7 (2012-09-28 21:07) 216 | ------------------------ 217 | * add missing stuff 218 | * make sure we find catkin 219 | * Contributors: Vincent Rabaud 220 | 221 | 1.9.6 (2012-09-28 15:17) 222 | ------------------------ 223 | * move the test to where it belongs 224 | * fix the tests and the API to not handle conversion from CV_TYPE to Color type (does not make sense) 225 | * make all the tests pass 226 | * comply to the new Catkin API 227 | * backport the C++ test from Fuerte 228 | * Contributors: Vincent Rabaud 229 | 230 | 1.9.5 (2012-09-15) 231 | ------------------ 232 | * remove dependencies to the opencv2 ROS package 233 | * Contributors: Vincent Rabaud 234 | 235 | 1.9.4 (2012-09-13) 236 | ------------------ 237 | 238 | 1.9.3 (2012-09-12) 239 | ------------------ 240 | * update to nosetests 241 | * Contributors: Vincent Rabaud 242 | 243 | 1.9.2 (2012-09-07) 244 | ------------------ 245 | * be more compliant to the latest catkin 246 | * added catkin_project() to cv_bridge, image_geometry, and opencv_tests 247 | * Contributors: Jonathan Binney, Vincent Rabaud 248 | 249 | 1.9.1 (2012-08-28 22:06) 250 | ------------------------ 251 | * remove a deprecated header 252 | * Contributors: Vincent Rabaud 253 | 254 | 1.9.0 (2012-08-28 14:29) 255 | ------------------------ 256 | * cleanup by Jon Binney 257 | * catkinized opencv_tests by Jon Binney 258 | * remove the version check, let's trust OpenCV :) 259 | * revert the removal of opencv2 260 | * finally get rid of opencv2 as it is a system dependency now 261 | * bump REQUIRED version of OpenCV to 2.3.2, which is what's in ros-fuerte-opencv 262 | * switch rosdep name to opencv2, to refer to ros-fuerte-opencv2 263 | * Fixing link lines for gtest against opencv. 264 | * Adding opencv2 to all manifests, so that client packages may 265 | not break when using them. 266 | * baking in opencv debs and attempting a pre-release 267 | * Another hack for prerelease to quiet test failures. 268 | * Dissable a dubious opencv test. Temporary HACK. 269 | * Changing to expect for more verbose failure. 270 | * Minor change to test. 271 | * Making this depend on libopencv-2.3-dev debian available in ros-shadow. 272 | * mono16 -> bgr conversion tested and fixed in C 273 | * Added Ubuntu platform tags to manifest 274 | * Tuned for parc loop 275 | * Demo of ROS node face detecton 276 | * mono16 support, ticket `#2890 `_ 277 | * Remove use of deprecated rosbuild macros 278 | * cv_bridge split from opencv2 279 | * Name changes for opencv -> vision_opencv 280 | * Validation for image message encoding 281 | * utest changed to reflect rosimgtocv change to imgmsgtocv 282 | * Add opencvpython as empty package 283 | * New methods for cv image conversion 284 | * Disabling tests on OSX, `#2769 `_ 285 | * New Python CvBridge, rewrote C CvBridge, regression test for C and Python CvBridge 286 | * Fix underscore problem, test 8UC3->BGR8, fix 8UC3->BGR8 287 | * New image format 288 | * Image message and CvBridge change 289 | * Rename rows,cols to height,width in Image message 290 | * New node bbc for image testing 291 | * Make executable 292 | * Pong demo 293 | * Missing utest.cpp 294 | * New sensor_msgs::Image message 295 | * Contributors: Vincent Rabaud, ethanrublee, gerkey, jamesb, jamesbowman, pantofaru, vrabaud, wheeler 296 | -------------------------------------------------------------------------------- /usb_cam/nodes/usb_cam_node.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * 3 | * Software License Agreement (BSD License) 4 | * 5 | * Copyright (c) 2014, Robert Bosch LLC. 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer in the documentation and/or other materials provided 17 | * with the distribution. 18 | * * Neither the name of the Robert Bosch nor the names of its 19 | * contributors may be used to endorse or promote products derived 20 | * from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | * POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | *********************************************************************/ 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | namespace usb_cam { 45 | 46 | class UsbCamNode 47 | { 48 | public: 49 | // private ROS node handle 50 | ros::NodeHandle node_; 51 | 52 | // shared image message 53 | sensor_msgs::Image img_; 54 | image_transport::CameraPublisher image_pub_; 55 | 56 | // parameters 57 | std::string video_device_name_, io_method_name_, pixel_format_name_, camera_name_, camera_info_url_; 58 | //std::string start_service_name_, start_service_name_; 59 | bool streaming_status_; 60 | int image_width_, image_height_, framerate_, exposure_, brightness_, contrast_, saturation_, sharpness_, focus_, 61 | white_balance_, gain_; 62 | bool autofocus_, autoexposure_, auto_white_balance_; 63 | boost::shared_ptr cinfo_; 64 | 65 | UsbCam cam_; 66 | 67 | ros::ServiceServer service_start_, service_stop_; 68 | 69 | 70 | 71 | bool service_start_cap(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res ) 72 | { 73 | cam_.start_capturing(); 74 | return true; 75 | } 76 | 77 | 78 | bool service_stop_cap( std_srvs::Empty::Request &req, std_srvs::Empty::Response &res ) 79 | { 80 | cam_.stop_capturing(); 81 | return true; 82 | } 83 | 84 | UsbCamNode() : 85 | node_("~") 86 | { 87 | // advertise the main image topic 88 | image_transport::ImageTransport it(node_); 89 | image_pub_ = it.advertiseCamera("image_raw", 1); 90 | 91 | // grab the parameters 92 | node_.param("video_device", video_device_name_, std::string("/dev/video0")); 93 | node_.param("brightness", brightness_, -1); //0-255, -1 "leave alone" 94 | node_.param("contrast", contrast_, -1); //0-255, -1 "leave alone" 95 | node_.param("saturation", saturation_, -1); //0-255, -1 "leave alone" 96 | node_.param("sharpness", sharpness_, -1); //0-255, -1 "leave alone" 97 | // possible values: mmap, read, userptr 98 | node_.param("io_method", io_method_name_, std::string("mmap")); 99 | node_.param("image_width", image_width_, 640); 100 | node_.param("image_height", image_height_, 480); 101 | node_.param("framerate", framerate_, 30); 102 | // possible values: yuyv, uyvy, mjpeg, yuvmono10, rgb24 103 | node_.param("pixel_format", pixel_format_name_, std::string("mjpeg")); 104 | // enable/disable autofocus 105 | node_.param("autofocus", autofocus_, false); 106 | node_.param("focus", focus_, -1); //0-255, -1 "leave alone" 107 | // enable/disable autoexposure 108 | node_.param("autoexposure", autoexposure_, true); 109 | node_.param("exposure", exposure_, 100); 110 | node_.param("gain", gain_, -1); //0-100?, -1 "leave alone" 111 | // enable/disable auto white balance temperature 112 | node_.param("auto_white_balance", auto_white_balance_, true); 113 | node_.param("white_balance", white_balance_, 4000); 114 | 115 | // load the camera info 116 | node_.param("camera_frame_id", img_.header.frame_id, std::string("head_camera")); 117 | node_.param("camera_name", camera_name_, std::string("head_camera")); 118 | node_.param("camera_info_url", camera_info_url_, std::string("")); 119 | cinfo_.reset(new camera_info_manager::CameraInfoManager(node_, camera_name_, camera_info_url_)); 120 | 121 | // create Services 122 | service_start_ = node_.advertiseService("start_capture", &UsbCamNode::service_start_cap, this); 123 | service_stop_ = node_.advertiseService("stop_capture", &UsbCamNode::service_stop_cap, this); 124 | 125 | // check for default camera info 126 | if (!cinfo_->isCalibrated()) 127 | { 128 | cinfo_->setCameraName(video_device_name_); 129 | sensor_msgs::CameraInfo camera_info; 130 | camera_info.header.frame_id = img_.header.frame_id; 131 | camera_info.width = image_width_; 132 | camera_info.height = image_height_; 133 | cinfo_->setCameraInfo(camera_info); 134 | } 135 | 136 | 137 | ROS_INFO("Starting '%s' (%s) at %dx%d via %s (%s) at %i FPS", camera_name_.c_str(), video_device_name_.c_str(), 138 | image_width_, image_height_, io_method_name_.c_str(), pixel_format_name_.c_str(), framerate_); 139 | 140 | // set the IO method 141 | UsbCam::io_method io_method = UsbCam::io_method_from_string(io_method_name_); 142 | if(io_method == UsbCam::IO_METHOD_UNKNOWN) 143 | { 144 | ROS_FATAL("Unknown IO method '%s'", io_method_name_.c_str()); 145 | node_.shutdown(); 146 | return; 147 | } 148 | 149 | // set the pixel format 150 | UsbCam::pixel_format pixel_format = UsbCam::pixel_format_from_string(pixel_format_name_); 151 | if (pixel_format == UsbCam::PIXEL_FORMAT_UNKNOWN) 152 | { 153 | ROS_FATAL("Unknown pixel format '%s'", pixel_format_name_.c_str()); 154 | node_.shutdown(); 155 | return; 156 | } 157 | 158 | // start the camera 159 | cam_.start(video_device_name_.c_str(), io_method, pixel_format, image_width_, 160 | image_height_, framerate_); 161 | 162 | // set camera parameters 163 | if (brightness_ >= 0) 164 | { 165 | cam_.set_v4l_parameter("brightness", brightness_); 166 | } 167 | 168 | if (contrast_ >= 0) 169 | { 170 | cam_.set_v4l_parameter("contrast", contrast_); 171 | } 172 | 173 | if (saturation_ >= 0) 174 | { 175 | cam_.set_v4l_parameter("saturation", saturation_); 176 | } 177 | 178 | if (sharpness_ >= 0) 179 | { 180 | cam_.set_v4l_parameter("sharpness", sharpness_); 181 | } 182 | 183 | if (gain_ >= 0) 184 | { 185 | cam_.set_v4l_parameter("gain", gain_); 186 | } 187 | 188 | // check auto white balance 189 | if (auto_white_balance_) 190 | { 191 | cam_.set_v4l_parameter("white_balance_temperature_auto", 1); 192 | } 193 | else 194 | { 195 | cam_.set_v4l_parameter("white_balance_temperature_auto", 0); 196 | cam_.set_v4l_parameter("white_balance_temperature", white_balance_); 197 | } 198 | 199 | // check auto exposure 200 | if (!autoexposure_) 201 | { 202 | // turn down exposure control (from max of 3) 203 | cam_.set_v4l_parameter("exposure_auto", 1); 204 | // change the exposure level 205 | cam_.set_v4l_parameter("exposure_absolute", exposure_); 206 | } 207 | 208 | // check auto focus 209 | if (autofocus_) 210 | { 211 | cam_.set_auto_focus(1); 212 | cam_.set_v4l_parameter("focus_auto", 1); 213 | } 214 | else 215 | { 216 | cam_.set_v4l_parameter("focus_auto", 0); 217 | if (focus_ >= 0) 218 | { 219 | cam_.set_v4l_parameter("focus_absolute", focus_); 220 | } 221 | } 222 | } 223 | 224 | virtual ~UsbCamNode() 225 | { 226 | cam_.shutdown(); 227 | } 228 | 229 | bool take_and_send_image() 230 | { 231 | // grab the image 232 | cam_.grab_image(&img_); 233 | 234 | // grab the camera info 235 | sensor_msgs::CameraInfoPtr ci(new sensor_msgs::CameraInfo(cinfo_->getCameraInfo())); 236 | ci->header.frame_id = img_.header.frame_id; 237 | ci->header.stamp = img_.header.stamp; 238 | 239 | // publish the image 240 | image_pub_.publish(img_, *ci); 241 | 242 | return true; 243 | } 244 | 245 | bool spin() 246 | { 247 | ros::Rate loop_rate(this->framerate_); 248 | while (node_.ok()) 249 | { 250 | if (cam_.is_capturing()) { 251 | if (!take_and_send_image()) ROS_WARN("USB camera did not respond in time."); 252 | } 253 | ros::spinOnce(); 254 | loop_rate.sleep(); 255 | 256 | } 257 | return true; 258 | } 259 | 260 | 261 | 262 | 263 | 264 | 265 | }; 266 | 267 | } 268 | 269 | int main(int argc, char **argv) 270 | { 271 | ros::init(argc, argv, "usb_cam"); 272 | usb_cam::UsbCamNode a; 273 | a.spin(); 274 | return EXIT_SUCCESS; 275 | } 276 | -------------------------------------------------------------------------------- /vision_opencv-noetic/image_geometry/test/utest_equi.cpp: -------------------------------------------------------------------------------- 1 | #include "image_geometry/pinhole_camera_model.h" 2 | #include 3 | #include 4 | 5 | /// @todo Tests with simple values (R = identity, D = 0, P = K or simple scaling) 6 | /// @todo Test projection functions for right stereo values, P(:,3) != 0 7 | /// @todo Tests for [un]rectifyImage 8 | /// @todo Tests using ROI, needs support from PinholeCameraModel 9 | /// @todo Tests for StereoCameraModel 10 | 11 | class EquidistantTest : public testing::Test 12 | { 13 | protected: 14 | virtual void SetUp() 15 | { 16 | /// @todo Just load these from file 17 | // These parameters are taken from a real camera calibration 18 | double D[] = {-0.08857683871674071, 0.0708113094372378, -0.09127623055964429, 0.04006922269778478}; 19 | double K[] = {403.603063319358, 0.0, 306.15842863283063, 20 | 0.0, 403.7028851121003, 261.09715697592696, 21 | 0.0, 0.0, 1.0}; 22 | double R[] = {0.999963944103842, -0.008484152966323483, 0.00036005656766869323, 23 | 0.008484153516269438, 0.9999640089218772, 0.0, 24 | -0.0003600436088446379, 3.0547751946422504e-06, 0.999999935179632}; 25 | double P[] = {347.2569964503485, 0.0, 350.5, 0.0, 26 | 0.0, 347.2569964503485, 256.0, 0.0, 27 | 0.0, 0.0, 1.0, 0.0}; 28 | 29 | cam_info_.header.frame_id = "tf_frame"; 30 | cam_info_.height = 512; 31 | cam_info_.width = 640; 32 | // No ROI 33 | cam_info_.D.resize(4); 34 | std::copy(D, D+4, cam_info_.D.begin()); 35 | std::copy(K, K+9, cam_info_.K.begin()); 36 | std::copy(R, R+9, cam_info_.R.begin()); 37 | std::copy(P, P+12, cam_info_.P.begin()); 38 | cam_info_.distortion_model = sensor_msgs::distortion_models::EQUIDISTANT; 39 | 40 | model_.fromCameraInfo(cam_info_); 41 | } 42 | 43 | sensor_msgs::CameraInfo cam_info_; 44 | image_geometry::PinholeCameraModel model_; 45 | }; 46 | 47 | TEST_F(EquidistantTest, accessorsCorrect) 48 | { 49 | EXPECT_STREQ("tf_frame", model_.tfFrame().c_str()); 50 | EXPECT_EQ(cam_info_.P[0], model_.fx()); 51 | EXPECT_EQ(cam_info_.P[5], model_.fy()); 52 | EXPECT_EQ(cam_info_.P[2], model_.cx()); 53 | EXPECT_EQ(cam_info_.P[6], model_.cy()); 54 | } 55 | 56 | TEST_F(EquidistantTest, projectPoint) 57 | { 58 | // Spot test an arbitrary point. 59 | { 60 | cv::Point2d uv(100, 100); 61 | cv::Point3d xyz = model_.projectPixelTo3dRay(uv); 62 | EXPECT_NEAR(-0.72136775518018115, xyz.x, 1e-8); 63 | EXPECT_NEAR(-0.449235009214005, xyz.y, 1e-8); 64 | EXPECT_DOUBLE_EQ(1.0, xyz.z); 65 | } 66 | 67 | // Principal point should project straight out. 68 | { 69 | cv::Point2d uv(model_.cx(), model_.cy()); 70 | cv::Point3d xyz = model_.projectPixelTo3dRay(uv); 71 | EXPECT_DOUBLE_EQ(0.0, xyz.x); 72 | EXPECT_DOUBLE_EQ(0.0, xyz.y); 73 | EXPECT_DOUBLE_EQ(1.0, xyz.z); 74 | } 75 | 76 | // Check projecting to 3d and back over entire image is accurate. 77 | const size_t step = 10; 78 | for (size_t row = 0; row <= cam_info_.height; row += step) { 79 | for (size_t col = 0; col <= cam_info_.width; col += step) { 80 | cv::Point2d uv(row, col), uv_back; 81 | cv::Point3d xyz = model_.projectPixelTo3dRay(uv); 82 | uv_back = model_.project3dToPixel(xyz); 83 | // Measured max error at 1.13687e-13 84 | EXPECT_NEAR(uv.x, uv_back.x, 1.14e-13) << "at (" << row << ", " << col << ")"; 85 | EXPECT_NEAR(uv.y, uv_back.y, 1.14e-13) << "at (" << row << ", " << col << ")"; 86 | } 87 | } 88 | } 89 | 90 | TEST_F(EquidistantTest, rectifyPoint) 91 | { 92 | // Spot test an arbitrary point. 93 | { 94 | cv::Point2d uv_raw(100, 100), uv_rect; 95 | uv_rect = model_.rectifyPoint(uv_raw); 96 | EXPECT_DOUBLE_EQ(135.45747375488281, uv_rect.x); 97 | EXPECT_DOUBLE_EQ(84.945091247558594, uv_rect.y); 98 | } 99 | 100 | /// @todo Need R = identity for the principal point tests. 101 | #if 0 102 | // Test rectifyPoint takes (c'x, c'y) [from K] -> (cx, cy) [from P]. 103 | double cxp = model_.intrinsicMatrix()(0,2), cyp = model_.intrinsicMatrix()(1,2); 104 | { 105 | cv::Point2d uv_raw(cxp, cyp), uv_rect; 106 | model_.rectifyPoint(uv_raw, uv_rect); 107 | EXPECT_NEAR(uv_rect.x, model_.cx(), 1e-4); 108 | EXPECT_NEAR(uv_rect.y, model_.cy(), 1e-4); 109 | } 110 | 111 | // Test unrectifyPoint takes (cx, cy) [from P] -> (c'x, c'y) [from K]. 112 | { 113 | cv::Point2d uv_rect(model_.cx(), model_.cy()), uv_raw; 114 | model_.unrectifyPoint(uv_rect, uv_raw); 115 | EXPECT_NEAR(uv_raw.x, cxp, 1e-4); 116 | EXPECT_NEAR(uv_raw.y, cyp, 1e-4); 117 | } 118 | #endif 119 | 120 | // Check rectifying then unrectifying is accurate. 121 | const size_t step = 5; 122 | for (size_t row = 0; row <= cam_info_.height; row += step) { 123 | for (size_t col = 0; col <= cam_info_.width; col += step) { 124 | cv::Point2d uv_raw(row, col), uv_rect, uv_unrect; 125 | uv_rect = model_.rectifyPoint(uv_raw); 126 | uv_unrect = model_.unrectifyPoint(uv_rect); 127 | EXPECT_NEAR(uv_raw.x, uv_unrect.x, 0.01); 128 | EXPECT_NEAR(uv_raw.y, uv_unrect.y, 0.01); 129 | } 130 | } 131 | } 132 | 133 | TEST_F(EquidistantTest, getDeltas) 134 | { 135 | double u = 100.0, v = 200.0, du = 17.0, dv = 23.0, Z = 2.0; 136 | cv::Point2d uv0(u, v), uv1(u + du, v + dv); 137 | cv::Point3d xyz0, xyz1; 138 | xyz0 = model_.projectPixelTo3dRay(uv0); 139 | xyz0 *= (Z / xyz0.z); 140 | xyz1 = model_.projectPixelTo3dRay(uv1); 141 | xyz1 *= (Z / xyz1.z); 142 | 143 | EXPECT_NEAR(model_.getDeltaU(xyz1.x - xyz0.x, Z), du, 1e-4); 144 | EXPECT_NEAR(model_.getDeltaV(xyz1.y - xyz0.y, Z), dv, 1e-4); 145 | EXPECT_NEAR(model_.getDeltaX(du, Z), xyz1.x - xyz0.x, 1e-4); 146 | EXPECT_NEAR(model_.getDeltaY(dv, Z), xyz1.y - xyz0.y, 1e-4); 147 | } 148 | 149 | TEST_F(EquidistantTest, initialization) 150 | { 151 | 152 | sensor_msgs::CameraInfo info; 153 | image_geometry::PinholeCameraModel camera; 154 | 155 | camera.fromCameraInfo(info); 156 | 157 | EXPECT_EQ(camera.initialized(), 1); 158 | EXPECT_EQ(camera.projectionMatrix().rows, 3); 159 | EXPECT_EQ(camera.projectionMatrix().cols, 4); 160 | } 161 | 162 | TEST_F(EquidistantTest, rectifyIfCalibrated) 163 | { 164 | /// @todo use forward distortion for a better test 165 | // Ideally this test would have two images stored on disk 166 | // one which is distorted and the other which is rectified, 167 | // and then rectification would take place here and the output 168 | // image compared to the one on disk (which would mean if 169 | // the distortion coefficients above can't change once paired with 170 | // an image). 171 | 172 | // Later could incorporate distort code 173 | // (https://github.com/lucasw/vimjay/blob/master/src/standalone/distort_image.cpp) 174 | // to take any image distort it, then undistort with rectifyImage, 175 | // and given the distortion coefficients are consistent the input image 176 | // and final output image should be mostly the same (though some 177 | // interpolation error 178 | // creeps in), except for outside a masked region where information was lost. 179 | // The masked region can be generated with a pure white image that 180 | // goes through the same process (if it comes out completely black 181 | // then the distortion parameters are problematic). 182 | 183 | // For now generate an image and pass the test simply if 184 | // the rectified image does not match the distorted image. 185 | // Then zero out the first distortion coefficient and run 186 | // the test again. 187 | // Then zero out all the distortion coefficients and test 188 | // that the output image is the same as the input. 189 | cv::Mat distorted_image(cv::Size(cam_info_.width, cam_info_.height), CV_8UC3, cv::Scalar(0, 0, 0)); 190 | 191 | // draw a grid 192 | const cv::Scalar color = cv::Scalar(255, 255, 255); 193 | // draw the lines thick so the proportion of error due to 194 | // interpolation is reduced 195 | const int thickness = 7; 196 | const int type = 8; 197 | for (size_t y = 0; y <= cam_info_.height; y += cam_info_.height/10) 198 | { 199 | cv::line(distorted_image, 200 | cv::Point(0, y), cv::Point(cam_info_.width, y), 201 | color, type, thickness); 202 | } 203 | for (size_t x = 0; x <= cam_info_.width; x += cam_info_.width/10) 204 | { 205 | // draw the lines thick so the prorportion of interpolation error is reduced 206 | cv::line(distorted_image, 207 | cv::Point(x, 0), cv::Point(x, cam_info_.height), 208 | color, type, thickness); 209 | } 210 | 211 | cv::Mat rectified_image; 212 | // Just making this number up, maybe ought to be larger 213 | // since a completely different image would be on the order of 214 | // width * height * 255 = 78e6 215 | const double diff_threshold = 10000.0; 216 | double error; 217 | 218 | // Test that rectified image is sufficiently different 219 | // using default distortion 220 | model_.rectifyImage(distorted_image, rectified_image); 221 | error = cv::norm(distorted_image, rectified_image, cv::NORM_L1); 222 | // Just making this number up, maybe ought to be larger 223 | EXPECT_GT(error, diff_threshold); 224 | 225 | // Test that rectified image is sufficiently different 226 | // using default distortion but with first element zeroed 227 | // out. 228 | sensor_msgs::CameraInfo cam_info_2 = cam_info_; 229 | cam_info_2.D[0] = 0.0; 230 | model_.fromCameraInfo(cam_info_2); 231 | model_.rectifyImage(distorted_image, rectified_image); 232 | error = cv::norm(distorted_image, rectified_image, cv::NORM_L1); 233 | EXPECT_GT(error, diff_threshold); 234 | 235 | // Test that rectified image is the same using zero distortion 236 | cam_info_2.D.assign(cam_info_2.D.size(), 0); 237 | model_.fromCameraInfo(cam_info_2); 238 | model_.rectifyImage(distorted_image, rectified_image); 239 | error = cv::norm(distorted_image, rectified_image, cv::NORM_L1); 240 | EXPECT_EQ(error, 0); 241 | 242 | // Test that rectified image is the same using empty distortion 243 | cam_info_2.D.clear(); 244 | model_.fromCameraInfo(cam_info_2); 245 | model_.rectifyImage(distorted_image, rectified_image); 246 | error = cv::norm(distorted_image, rectified_image, cv::NORM_L1); 247 | EXPECT_EQ(error, 0); 248 | 249 | // restore original distortion 250 | model_.fromCameraInfo(cam_info_); 251 | } 252 | 253 | int main(int argc, char** argv) 254 | { 255 | testing::InitGoogleTest(&argc, argv); 256 | return RUN_ALL_TESTS(); 257 | } 258 | --------------------------------------------------------------------------------