Update upstream source from tag 'upstream/2.0.2'
Update to upstream version '2.0.2'
with Debian dir db20ffc55d3c4ff63dc29632fa10ff4b5485c335
Jochen Sprickerhof
3 years ago
27 | 27 | # Install ROS |
28 | 28 | sudo sh -c "echo \"deb http://packages.ros.org/ros-shadow-fixed/ubuntu `lsb_release -cs` main\" > /etc/apt/sources.list.d/ros-latest.list" |
29 | 29 | wget http://packages.ros.org/ros.key -O - | sudo apt-key add - |
30 | # Setup EoL repository | |
31 | if [[ "$ROS_DISTRO" == "hydro" || "$ROS_DISTRO" == "jade" || "$ROS_DISTRO" == "lunar" ]]; then | |
32 | sudo -E sh -c 'echo "deb http://snapshots.ros.org/$ROS_DISTRO/final/ubuntu `lsb_release -sc` main" >> /etc/apt/sources.list.d/ros-latest.list' | |
33 | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 0xCBF125EA | |
34 | fi | |
30 | 35 | sudo apt-get update -qq |
36 | ### HotFix: Hold python-vcs-tools for hydro (https://github.com/vcstools/vcstools/issues/157) | |
37 | if [[ "$ROS_DISTRO" == "hydro" ]]; then | |
38 | sudo apt-get install -y --force-yes -q python-vcstools=0.1.40-1 | |
39 | sudo apt-mark hold python-vcstools | |
40 | fi | |
41 | ### | |
31 | 42 | # Install ROS |
32 | sudo apt-get install -y -q python-catkin-pkg python-catkin-tools python-rosdep python-wstool python-rosinstall-generator ros-$ROS_DISTRO-catkin | |
43 | if [[ "$ROS_DISTRO" == "noetic" ]]; then | |
44 | sudo apt-get install -y -q python3-catkin-pkg python3-catkin-tools python3-rosdep python3-wstool python3-rosinstall-generator python3-osrf-pycommon | |
45 | else | |
46 | sudo apt-get install -y -q python-catkin-pkg python-catkin-tools python-rosdep python-wstool python-rosinstall-generator | |
47 | fi | |
48 | sudo apt-get install -y -q ros-$ROS_DISTRO-catkin | |
33 | 49 | source /opt/ros/$ROS_DISTRO/setup.bash |
34 | 50 | # Setup for rosdep |
35 | 51 | sudo rosdep init |
36 | rosdep update | |
52 | rosdep update --include-eol-distros | |
37 | 53 | travis_time_end |
38 | 54 | |
39 | 55 | travis_time_start setup.install |
102 | 118 | echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections |
103 | 119 | travis_time_end |
104 | 120 | |
105 | if [ $TEST == "catkin_lint" ]; then | |
121 | if [ "$TEST" == "catkin_lint" ]; then | |
106 | 122 | |
107 | 123 | travis_time_start catkin_lint.script |
108 | 124 | apt-get install -y -q python-pip |
113 | 129 | ROS_DISTRO=melodic catkin_lint --resolve-env --strict $CI_SOURCE_PATH |
114 | 130 | |
115 | 131 | |
116 | elif [ $TEST == "clang-format" ]; then | |
132 | elif [ "$TEST" == "clang-format" ]; then | |
117 | 133 | |
118 | 134 | travis_time_start clang_format.script |
119 | 135 | apt-get install -y -q clang-format-3.9 git |
122 | 138 | git -C $CI_SOURCE_PATH --no-pager diff |
123 | 139 | git -C $CI_SOURCE_PATH diff-index --quiet HEAD -- . |
124 | 140 | |
125 | elif [ $TEST == "clang-tidy" ]; then | |
141 | elif [ "$TEST" == "clang-tidy" ]; then | |
126 | 142 | |
127 | 143 | setup |
128 | 144 |
0 | 0 | sudo: required |
1 | dist: trusty | |
1 | dist: bionic | |
2 | 2 | language: generic |
3 | 3 | env: |
4 | - CHECK_PYTHON3_COMPILE=true | |
4 | 5 | - TEST=catkin_lint DOCKER_IMAGE=ubuntu:bionic |
5 | 6 | - TEST=clang-format DOCKER_IMAGE=ubuntu:bionic |
6 | 7 | - TEST=clang-tidy ROS_DISTRO=melodic DOCKER_IMAGE=ubuntu:bionic |
9 | 10 | - OPENCV_VERSION=3 ROS_DISTRO=indigo DOCKER_IMAGE=ubuntu:trusty |
10 | 11 | - ROS_DISTRO=kinetic DOCKER_IMAGE=ubuntu:xenial |
11 | 12 | - ROS_DISTRO=melodic DOCKER_IMAGE=ubuntu:bionic |
13 | - ROS_DISTRO=noetic DOCKER_IMAGE=ubuntu:focal | |
12 | 14 | # Install system dependencies, namely ROS. |
13 | 15 | script: |
16 | - if [ "${CHECK_PYTHON3_COMPILE}" == "true" ]; then python3 -m compileall .; exit $?; fi | |
14 | 17 | - export CI_SOURCE_PATH=$(pwd) |
15 | 18 | - export REPOSITORY_NAME=${PWD##*/} |
16 | 19 | - echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME" |
0 | 0 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
1 | 1 | Changelog for package opencv_apps |
2 | 2 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
3 | ||
4 | 2.0.2 (2020-08-19) | |
5 | ------------------ | |
6 | * .travis.yml: add noetic test (`#108 <https://github.com/ros-perception/opencv_apps/issues/108>`_) | |
7 | ||
8 | * support oepncv4 for face detection launch/test files | |
9 | * convert img_gray every loop, this fixes | |
10 | [ERROR] [1597757072.115502734]: Image processing error: Matrix operand is an empty matrix. checkOperandsExist ../modules/core/src/matrix_expressions.cpp 23 | |
11 | errors | |
12 | * check CV_VERSION_VERSION > 4 | |
13 | * add g++ static to package.xml | |
14 | * use python3 for noetic | |
15 | * .travis.yml : add CHECK_PYTHON3_COMPILE | |
16 | * .travis.yml: add noetic test | |
17 | ||
18 | * fix travis (`#106 <https://github.com/ros-perception/opencv_apps/issues/106>`_) | |
19 | ||
20 | * add more package to CATKIN_DEPENDS | |
21 | * add image_view to run_depends | |
22 | ||
23 | * add hot fix for hydro test (`#98 <https://github.com/ros-perception/opencv_apps/issues/98>`_) | |
24 | ||
25 | * add doublequote arount $TEST | |
26 | * add hot fix for hydro test | |
27 | ||
28 | * Improved variable names and comments (`#95 <https://github.com/ros-perception/opencv_apps/issues/95>`_) | |
29 | ||
30 | * Improved variable names and comments: The comments and variable names were the opposite of what was functionally happening in the code. No functional change to this commit, just better readability and maintainability. | |
31 | ||
32 | * setup EoL repository (`#96 <https://github.com/ros-perception/opencv_apps/issues/96>`_) | |
33 | ||
34 | * Contributors: Gus Crowards, Kei Okada | |
3 | 35 | |
4 | 36 | 2.0.1 (2019-04-22) |
5 | 37 | ------------------ |
114 | 114 | std_msgs |
115 | 115 | ) |
116 | 116 | |
117 | catkin_package(CATKIN_DEPENDS message_runtime sensor_msgs std_msgs | |
117 | catkin_package(CATKIN_DEPENDS dynamic_reconfigure message_runtime nodelet roscpp sensor_msgs std_msgs std_srvs | |
118 | 118 | # DEPENDS OpenCV |
119 | 119 | INCLUDE_DIRS include |
120 | 120 | LIBRARIES ${PROJECT_NAME} |
3 | 3 | <arg name="use_opencv3_1" default="false" /> |
4 | 4 | <arg name="use_opencv3_2" default="false" /> |
5 | 5 | <arg name="use_opencv3_3" default="$(arg use_opencv3)" /> |
6 | <arg name="use_opencv4" default="false" /> | |
6 | 7 | |
7 | 8 | <arg name="image" default="image" doc="The image topic. Should be remapped to the name of the real image topic." /> |
8 | 9 | |
22 | 23 | name="face_cascade_name" default="$(find opencv3)/../OpenCV-3.3.1-dev/haarcascades/haarcascade_frontalface_alt.xml" doc="Face dtection cascade Filename" /> |
23 | 24 | <arg if="$(arg use_opencv3_3)" |
24 | 25 | name="eyes_cascade_name" default="$(find opencv3)/../OpenCV-3.3.1-dev/haarcascades/haarcascade_eye_tree_eyeglasses.xml" doc="Eye dtection cascade Filename" /> |
26 | <arg if="$(arg use_opencv4)" | |
27 | name="face_cascade_name" default="/usr/share/opencv4/haarcascades/haarcascade_frontalface_alt.xml" doc="Face dtection cascade Filename" /> | |
28 | <arg if="$(arg use_opencv4)" | |
29 | name="eyes_cascade_name" default="/usr/share/opencv4/haarcascades/haarcascade_eye_tree_eyeglasses.xml" doc="Eye dtection cascade Filename" /> | |
30 | ||
25 | 31 | <arg unless="$(arg use_opencv3)" |
26 | 32 | name="face_cascade_name" default="/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" doc="Face dtection cascade Filename" /> |
27 | 33 | <arg unless="$(arg use_opencv3)" |
5 | 5 | <arg name="use_opencv3_1" default="false" /> |
6 | 6 | <arg name="use_opencv3_2" default="false" /> |
7 | 7 | <arg name="use_opencv3_3" default="false" /> |
8 | <arg name="use_opencv4" default="false" /> | |
8 | 9 | <arg name="debug_view" default="true" /> |
9 | 10 | <arg name="queue_size" default="100" doc="Specigy queue_size of input image subscribers" /> |
10 | 11 | |
20 | 21 | <arg name="use_opencv3_1" value="$(arg use_opencv3_1)" /> |
21 | 22 | <arg name="use_opencv3_2" value="$(arg use_opencv3_2)" /> |
22 | 23 | <arg name="use_opencv3_3" value="$(arg use_opencv3_3)" /> |
24 | <arg name="use_opencv4" value="$(arg use_opencv4)" /> | |
23 | 25 | </include> |
24 | 26 | |
25 | 27 | <node name="face_recognition" pkg="opencv_apps" type="face_recognition" |
0 | 0 | <?xml version="1.0"?> |
1 | 1 | <package> |
2 | 2 | <name>opencv_apps</name> |
3 | <version>2.0.1</version> | |
3 | <version>2.0.2</version> | |
4 | 4 | <description> |
5 | 5 | <p>opencv_apps provides various nodes that run internally OpenCV's functionalities and publish the result as ROS topics. With opencv_apps, you can skip writing OpenCV application codes for a lot of its functionalities by simply running a launch file that corresponds to OpenCV's functionality you want.</p> |
6 | 6 | <ul> |
19 | 19 | |
20 | 20 | <build_depend>cv_bridge</build_depend> |
21 | 21 | <build_depend>dynamic_reconfigure</build_depend> |
22 | <build_depend>g++-static</build_depend> | |
22 | 23 | <build_depend>image_transport</build_depend> |
23 | 24 | <build_depend>message_generation</build_depend> |
24 | 25 | <build_depend>nodelet</build_depend> |
30 | 31 | <run_depend>cv_bridge</run_depend> |
31 | 32 | <run_depend>dynamic_reconfigure</run_depend> |
32 | 33 | <run_depend>image_transport</run_depend> |
34 | <run_depend>image_view</run_depend> | |
33 | 35 | <run_depend>message_runtime</run_depend> |
34 | 36 | <run_depend>nodelet</run_depend> |
35 | 37 | <run_depend>roscpp</run_depend> |
43 | 45 | <test_depend>rosservice</test_depend> |
44 | 46 | <test_depend>rostopic</test_depend> |
45 | 47 | <test_depend>image_proc</test_depend> |
46 | <test_depend>image_view</test_depend> | |
47 | 48 | <test_depend>topic_tools</test_depend> |
48 | 49 | <test_depend>compressed_image_transport</test_depend> |
49 | 50 |
73 | 73 | namespace face = cv; |
74 | 74 | #endif |
75 | 75 | |
76 | #if CV_MAJOR_VERSION >= 4 | |
77 | #include <opencv2/imgcodecs/legacy/constants_c.h> // include CV_LOAD_IMAGE_COLOR | |
78 | #include <opencv2/imgproc/imgproc_c.h> // include CV_AA | |
79 | #endif | |
80 | ||
76 | 81 | // utility for resolving path |
77 | 82 | namespace boost |
78 | 83 | { |
547 | 552 | if (config.model_method == "eigen") |
548 | 553 | { |
549 | 554 | // https://docs.opencv.org/3.3.1/da/d60/tutorial_face_main.html |
550 | #if CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3 | |
555 | #if (CV_MAJOR_VERSION >= 4) || (CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3) | |
551 | 556 | model_ = face::EigenFaceRecognizer::create(config.model_num_components, config.model_threshold); |
552 | 557 | #else |
553 | 558 | model_ = face::createEigenFaceRecognizer(config.model_num_components, config.model_threshold); |
555 | 560 | } |
556 | 561 | else if (config.model_method == "fisher") |
557 | 562 | { |
558 | #if CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3 | |
563 | #if (CV_MAJOR_VERSION >= 4) || (CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3) | |
559 | 564 | model_ = face::FisherFaceRecognizer::create(config.model_num_components, config.model_threshold); |
560 | 565 | #else |
561 | 566 | model_ = face::createFisherFaceRecognizer(config.model_num_components, config.model_threshold); |
563 | 568 | } |
564 | 569 | else if (config.model_method == "LBPH") |
565 | 570 | { |
566 | #if CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3 | |
571 | #if (CV_MAJOR_VERSION >= 4) || (CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3) | |
567 | 572 | model_ = face::LBPHFaceRecognizer::create(config.lbph_radius, config.lbph_neighbors, config.lbph_grid_x, |
568 | 573 | config.lbph_grid_y); |
569 | 574 | #else |
45 | 45 | #include <opencv2/highgui/highgui.hpp> |
46 | 46 | #include <opencv2/imgproc/imgproc.hpp> |
47 | 47 | #include <opencv2/video/background_segm.hpp> |
48 | #if CV_MAJOR_VERSION >= 4 | |
49 | #include <opencv2/imgproc/imgproc_c.h> // incldue CV_FILLED | |
50 | #endif | |
48 | 51 | |
49 | 52 | #include <dynamic_reconfigure/server.h> |
50 | 53 | #include "opencv_apps/SegmentObjectsConfig.h" |
45 | 45 | #include <opencv2/highgui/highgui.hpp> |
46 | 46 | #include <opencv2/imgproc/imgproc.hpp> |
47 | 47 | #include <opencv2/video/tracking.hpp> |
48 | #if CV_MAJOR_VERSION == 3 | |
48 | #if CV_MAJOR_VERSION >= 3 | |
49 | 49 | #include <opencv2/optflow.hpp> |
50 | 50 | #endif |
51 | 51 | |
78 | 78 | static bool need_config_update_; |
79 | 79 | int scale_; |
80 | 80 | |
81 | cv::Mat gray, prevGray; | |
81 | cv::Mat color, prevColor; | |
82 | 82 | |
83 | 83 | void reconfigureCallback(Config& new_config, uint32_t level) |
84 | 84 | { |
116 | 116 | // Convert the image into something opencv can handle. |
117 | 117 | cv::Mat frame_src = cv_bridge::toCvShare(msg, sensor_msgs::image_encodings::BGR8)->image; |
118 | 118 | |
119 | /// Convert it to gray | |
119 | /// Convert it to 3 channel | |
120 | 120 | cv::Mat frame; |
121 | 121 | if (frame_src.channels() > 1) |
122 | 122 | { |
127 | 127 | cv::cvtColor(frame_src, frame, cv::COLOR_GRAY2BGR); |
128 | 128 | } |
129 | 129 | |
130 | cv::resize(frame, gray, cv::Size(frame.cols / (double)MAX(1, scale_), frame.rows / (double)MAX(1, scale_)), 0, 0, | |
130 | cv::resize(frame, color, cv::Size(frame.cols / (double)MAX(1, scale_), frame.rows / (double)MAX(1, scale_)), 0, 0, | |
131 | 131 | CV_INTER_AREA); |
132 | if (prevGray.empty()) | |
133 | gray.copyTo(prevGray); | |
134 | ||
135 | if (gray.rows != prevGray.rows && gray.cols != prevGray.cols) | |
132 | if (prevColor.empty()) | |
133 | color.copyTo(prevColor); | |
134 | ||
135 | if (color.rows != prevColor.rows && color.cols != prevColor.cols) | |
136 | 136 | { |
137 | 137 | NODELET_WARN("Images should be of equal sizes"); |
138 | gray.copyTo(prevGray); | |
139 | } | |
140 | ||
141 | if (frame.type() != 16) | |
138 | color.copyTo(prevColor); | |
139 | } | |
140 | ||
141 | if (frame.type() != CV_8UC3) | |
142 | 142 | { |
143 | 143 | NODELET_ERROR("Images should be of equal type CV_8UC3"); |
144 | 144 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | float start = (float)cv::getTickCount(); |
165 | #if CV_MAJOR_VERSION == 3 | |
166 | cv::optflow::calcOpticalFlowSF(gray, prevGray, | |
165 | #if CV_MAJOR_VERSION >= 3 | |
166 | cv::optflow::calcOpticalFlowSF(color, prevColor, | |
167 | 167 | #else |
168 | cv::calcOpticalFlowSF(gray, prevGray, | |
168 | cv::calcOpticalFlowSF(color, prevColor, | |
169 | 169 | #endif |
170 | 170 | flow, 3, 2, 4, 4.1, 25.5, 18, 55.0, 25.5, 0.35, 18, 55.0, 25.5, 10); |
171 | 171 | NODELET_INFO("calcOpticalFlowSF : %lf sec", (cv::getTickCount() - start) / cv::getTickFrequency()); |
209 | 209 | int c = cv::waitKey(1); |
210 | 210 | } |
211 | 211 | |
212 | cv::swap(prevGray, gray); | |
212 | cv::swap(prevColor, color); | |
213 | 213 | // Publish the image. |
214 | 214 | sensor_msgs::Image::Ptr out_img = cv_bridge::CvImage(msg->header, "bgr8", frame).toImageMsg(); |
215 | 215 | img_pub_.publish(out_img); |
81 | 81 | static int on_mouse_y_; |
82 | 82 | static int on_mouse_flags_; |
83 | 83 | |
84 | cv::Mat markerMask; | |
84 | cv::Mat markerMask, img_gray; | |
85 | 85 | cv::Point prevPt; |
86 | 86 | |
87 | 87 | static void onMouse(int event, int x, int y, int flags, void* /*unused*/) |
134 | 134 | |
135 | 135 | // Do the work |
136 | 136 | // std::vector<cv::Rect> faces; |
137 | cv::Mat img_gray; | |
138 | 137 | |
139 | 138 | /// Initialize |
140 | 139 | if (markerMask.empty()) |
141 | 140 | { |
142 | 141 | cv::cvtColor(frame, markerMask, cv::COLOR_BGR2GRAY); |
143 | cv::cvtColor(markerMask, img_gray, cv::COLOR_GRAY2BGR); | |
144 | 142 | markerMask = cv::Scalar::all(0); |
145 | 143 | } |
144 | cv::Mat tmp; | |
145 | cv::cvtColor(frame, tmp, cv::COLOR_BGR2GRAY); | |
146 | cv::cvtColor(tmp, img_gray, cv::COLOR_GRAY2BGR); | |
146 | 147 | |
147 | 148 | if (debug_view_) |
148 | 149 | { |
40 | 40 | add_rostest(test-general_contours.test ARGS gui:=false) |
41 | 41 | add_rostest(test-contour_moments.test ARGS gui:=false) |
42 | 42 | if(cv_bridge_VERSION VERSION_LESS "1.11.9") # hydro skip face_detection.test |
43 | elseif("$ENV{ROS_DISTRO}" STREQUAL "noetic") # noetic uses opencv4 (need to use_opencv3 for some reason...) | |
44 | add_rostest(test-face_detection.test ARGS gui:=false use_opencv3:=true use_opencv4:=true) | |
45 | add_rostest(test-face_recognition.test ARGS gui:=false use_opencv3:=true use_opencv4:=true) | |
43 | 46 | elseif("$ENV{ROS_DISTRO}" STREQUAL "melodic") # melodic uses opencv3 |
44 | 47 | add_rostest(test-face_detection.test ARGS gui:=false) |
45 | 48 | add_rostest(test-face_recognition.test ARGS gui:=false) |
3 | 3 | <arg name="use_opencv3_1" default="false" /> |
4 | 4 | <arg name="use_opencv3_2" default="false" /> |
5 | 5 | <arg name="use_opencv3_3" default="false" /> |
6 | <arg name="use_opencv4" default="false" /> | |
6 | 7 | <node name="play_face_bag" pkg="rosbag" type="play" args="-l $(find opencv_apps)/test/face_detector_withface_test_diamondback.bag" /> |
7 | 8 | |
8 | 9 | <group ns="wide_stereo/left" > |
17 | 18 | <arg name="use_opencv3_1" value="$(arg use_opencv3_1)" /> |
18 | 19 | <arg name="use_opencv3_2" value="$(arg use_opencv3_2)" /> |
19 | 20 | <arg name="use_opencv3_3" value="$(arg use_opencv3_3)" /> |
21 | <arg name="use_opencv4" value="$(arg use_opencv4)" /> | |
20 | 22 | </include> |
21 | 23 | |
22 | 24 | <node name="face_image_viewer" pkg="image_view" type="image_view"> |
3 | 3 | <arg name="use_opencv3_1" default="false" /> |
4 | 4 | <arg name="use_opencv3_2" default="false" /> |
5 | 5 | <arg name="use_opencv3_3" default="false" /> |
6 | <arg name="use_opencv4" default="false" /> | |
6 | 7 | <node name="play_face_bag" pkg="rosbag" type="play" args="-l $(find opencv_apps)/test/face_detector_withface_test_diamondback.bag" /> |
7 | 8 | |
8 | 9 | <group ns="wide_stereo/left" > |
19 | 20 | <arg name="use_opencv3_1" value="$(arg use_opencv3_1)" /> |
20 | 21 | <arg name="use_opencv3_2" value="$(arg use_opencv3_2)" /> |
21 | 22 | <arg name="use_opencv3_3" value="$(arg use_opencv3_3)" /> |
23 | <arg name="use_opencv4" value="$(arg use_opencv4)" /> | |
22 | 24 | <arg name="data_dir" value="$(find opencv_apps)/test/face_data" /> |
23 | 25 | </include> |
24 | 26 |