Codebase list ros-opencv-apps / 67126f1
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
14 changed file(s) with 107 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
2727 # Install ROS
2828 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"
2929 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
3035 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 ###
3142 # 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
3349 source /opt/ros/$ROS_DISTRO/setup.bash
3450 # Setup for rosdep
3551 sudo rosdep init
36 rosdep update
52 rosdep update --include-eol-distros
3753 travis_time_end
3854
3955 travis_time_start setup.install
102118 echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
103119 travis_time_end
104120
105 if [ $TEST == "catkin_lint" ]; then
121 if [ "$TEST" == "catkin_lint" ]; then
106122
107123 travis_time_start catkin_lint.script
108124 apt-get install -y -q python-pip
113129 ROS_DISTRO=melodic catkin_lint --resolve-env --strict $CI_SOURCE_PATH
114130
115131
116 elif [ $TEST == "clang-format" ]; then
132 elif [ "$TEST" == "clang-format" ]; then
117133
118134 travis_time_start clang_format.script
119135 apt-get install -y -q clang-format-3.9 git
122138 git -C $CI_SOURCE_PATH --no-pager diff
123139 git -C $CI_SOURCE_PATH diff-index --quiet HEAD -- .
124140
125 elif [ $TEST == "clang-tidy" ]; then
141 elif [ "$TEST" == "clang-tidy" ]; then
126142
127143 setup
128144
00 sudo: required
1 dist: trusty
1 dist: bionic
22 language: generic
33 env:
4 - CHECK_PYTHON3_COMPILE=true
45 - TEST=catkin_lint DOCKER_IMAGE=ubuntu:bionic
56 - TEST=clang-format DOCKER_IMAGE=ubuntu:bionic
67 - TEST=clang-tidy ROS_DISTRO=melodic DOCKER_IMAGE=ubuntu:bionic
910 - OPENCV_VERSION=3 ROS_DISTRO=indigo DOCKER_IMAGE=ubuntu:trusty
1011 - ROS_DISTRO=kinetic DOCKER_IMAGE=ubuntu:xenial
1112 - ROS_DISTRO=melodic DOCKER_IMAGE=ubuntu:bionic
13 - ROS_DISTRO=noetic DOCKER_IMAGE=ubuntu:focal
1214 # Install system dependencies, namely ROS.
1315 script:
16 - if [ "${CHECK_PYTHON3_COMPILE}" == "true" ]; then python3 -m compileall .; exit $?; fi
1417 - export CI_SOURCE_PATH=$(pwd)
1518 - export REPOSITORY_NAME=${PWD##*/}
1619 - echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME"
00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 Changelog for package opencv_apps
22 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
335
436 2.0.1 (2019-04-22)
537 ------------------
114114 std_msgs
115115 )
116116
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
118118 # DEPENDS OpenCV
119119 INCLUDE_DIRS include
120120 LIBRARIES ${PROJECT_NAME}
33 <arg name="use_opencv3_1" default="false" />
44 <arg name="use_opencv3_2" default="false" />
55 <arg name="use_opencv3_3" default="$(arg use_opencv3)" />
6 <arg name="use_opencv4" default="false" />
67
78 <arg name="image" default="image" doc="The image topic. Should be remapped to the name of the real image topic." />
89
2223 name="face_cascade_name" default="$(find opencv3)/../OpenCV-3.3.1-dev/haarcascades/haarcascade_frontalface_alt.xml" doc="Face dtection cascade Filename" />
2324 <arg if="$(arg use_opencv3_3)"
2425 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
2531 <arg unless="$(arg use_opencv3)"
2632 name="face_cascade_name" default="/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" doc="Face dtection cascade Filename" />
2733 <arg unless="$(arg use_opencv3)"
55 <arg name="use_opencv3_1" default="false" />
66 <arg name="use_opencv3_2" default="false" />
77 <arg name="use_opencv3_3" default="false" />
8 <arg name="use_opencv4" default="false" />
89 <arg name="debug_view" default="true" />
910 <arg name="queue_size" default="100" doc="Specigy queue_size of input image subscribers" />
1011
2021 <arg name="use_opencv3_1" value="$(arg use_opencv3_1)" />
2122 <arg name="use_opencv3_2" value="$(arg use_opencv3_2)" />
2223 <arg name="use_opencv3_3" value="$(arg use_opencv3_3)" />
24 <arg name="use_opencv4" value="$(arg use_opencv4)" />
2325 </include>
2426
2527 <node name="face_recognition" pkg="opencv_apps" type="face_recognition"
00 <?xml version="1.0"?>
11 <package>
22 <name>opencv_apps</name>
3 <version>2.0.1</version>
3 <version>2.0.2</version>
44 <description>
55 <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>
66 <ul>
1919
2020 <build_depend>cv_bridge</build_depend>
2121 <build_depend>dynamic_reconfigure</build_depend>
22 <build_depend>g++-static</build_depend>
2223 <build_depend>image_transport</build_depend>
2324 <build_depend>message_generation</build_depend>
2425 <build_depend>nodelet</build_depend>
3031 <run_depend>cv_bridge</run_depend>
3132 <run_depend>dynamic_reconfigure</run_depend>
3233 <run_depend>image_transport</run_depend>
34 <run_depend>image_view</run_depend>
3335 <run_depend>message_runtime</run_depend>
3436 <run_depend>nodelet</run_depend>
3537 <run_depend>roscpp</run_depend>
4345 <test_depend>rosservice</test_depend>
4446 <test_depend>rostopic</test_depend>
4547 <test_depend>image_proc</test_depend>
46 <test_depend>image_view</test_depend>
4748 <test_depend>topic_tools</test_depend>
4849 <test_depend>compressed_image_transport</test_depend>
4950
7373 namespace face = cv;
7474 #endif
7575
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
7681 // utility for resolving path
7782 namespace boost
7883 {
547552 if (config.model_method == "eigen")
548553 {
549554 // 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)
551556 model_ = face::EigenFaceRecognizer::create(config.model_num_components, config.model_threshold);
552557 #else
553558 model_ = face::createEigenFaceRecognizer(config.model_num_components, config.model_threshold);
555560 }
556561 else if (config.model_method == "fisher")
557562 {
558 #if CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3
563 #if (CV_MAJOR_VERSION >= 4) || (CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3)
559564 model_ = face::FisherFaceRecognizer::create(config.model_num_components, config.model_threshold);
560565 #else
561566 model_ = face::createFisherFaceRecognizer(config.model_num_components, config.model_threshold);
563568 }
564569 else if (config.model_method == "LBPH")
565570 {
566 #if CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3
571 #if (CV_MAJOR_VERSION >= 4) || (CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3)
567572 model_ = face::LBPHFaceRecognizer::create(config.lbph_radius, config.lbph_neighbors, config.lbph_grid_x,
568573 config.lbph_grid_y);
569574 #else
4545 #include <opencv2/highgui/highgui.hpp>
4646 #include <opencv2/imgproc/imgproc.hpp>
4747 #include <opencv2/video/background_segm.hpp>
48 #if CV_MAJOR_VERSION >= 4
49 #include <opencv2/imgproc/imgproc_c.h> // incldue CV_FILLED
50 #endif
4851
4952 #include <dynamic_reconfigure/server.h>
5053 #include "opencv_apps/SegmentObjectsConfig.h"
4545 #include <opencv2/highgui/highgui.hpp>
4646 #include <opencv2/imgproc/imgproc.hpp>
4747 #include <opencv2/video/tracking.hpp>
48 #if CV_MAJOR_VERSION == 3
48 #if CV_MAJOR_VERSION >= 3
4949 #include <opencv2/optflow.hpp>
5050 #endif
5151
7878 static bool need_config_update_;
7979 int scale_;
8080
81 cv::Mat gray, prevGray;
81 cv::Mat color, prevColor;
8282
8383 void reconfigureCallback(Config& new_config, uint32_t level)
8484 {
116116 // Convert the image into something opencv can handle.
117117 cv::Mat frame_src = cv_bridge::toCvShare(msg, sensor_msgs::image_encodings::BGR8)->image;
118118
119 /// Convert it to gray
119 /// Convert it to 3 channel
120120 cv::Mat frame;
121121 if (frame_src.channels() > 1)
122122 {
127127 cv::cvtColor(frame_src, frame, cv::COLOR_GRAY2BGR);
128128 }
129129
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,
131131 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)
136136 {
137137 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)
142142 {
143143 NODELET_ERROR("Images should be of equal type CV_8UC3");
144144 }
162162 }
163163
164164 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,
167167 #else
168 cv::calcOpticalFlowSF(gray, prevGray,
168 cv::calcOpticalFlowSF(color, prevColor,
169169 #endif
170170 flow, 3, 2, 4, 4.1, 25.5, 18, 55.0, 25.5, 0.35, 18, 55.0, 25.5, 10);
171171 NODELET_INFO("calcOpticalFlowSF : %lf sec", (cv::getTickCount() - start) / cv::getTickFrequency());
209209 int c = cv::waitKey(1);
210210 }
211211
212 cv::swap(prevGray, gray);
212 cv::swap(prevColor, color);
213213 // Publish the image.
214214 sensor_msgs::Image::Ptr out_img = cv_bridge::CvImage(msg->header, "bgr8", frame).toImageMsg();
215215 img_pub_.publish(out_img);
8181 static int on_mouse_y_;
8282 static int on_mouse_flags_;
8383
84 cv::Mat markerMask;
84 cv::Mat markerMask, img_gray;
8585 cv::Point prevPt;
8686
8787 static void onMouse(int event, int x, int y, int flags, void* /*unused*/)
134134
135135 // Do the work
136136 // std::vector<cv::Rect> faces;
137 cv::Mat img_gray;
138137
139138 /// Initialize
140139 if (markerMask.empty())
141140 {
142141 cv::cvtColor(frame, markerMask, cv::COLOR_BGR2GRAY);
143 cv::cvtColor(markerMask, img_gray, cv::COLOR_GRAY2BGR);
144142 markerMask = cv::Scalar::all(0);
145143 }
144 cv::Mat tmp;
145 cv::cvtColor(frame, tmp, cv::COLOR_BGR2GRAY);
146 cv::cvtColor(tmp, img_gray, cv::COLOR_GRAY2BGR);
146147
147148 if (debug_view_)
148149 {
4040 add_rostest(test-general_contours.test ARGS gui:=false)
4141 add_rostest(test-contour_moments.test ARGS gui:=false)
4242 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)
4346 elseif("$ENV{ROS_DISTRO}" STREQUAL "melodic") # melodic uses opencv3
4447 add_rostest(test-face_detection.test ARGS gui:=false)
4548 add_rostest(test-face_recognition.test ARGS gui:=false)
33 <arg name="use_opencv3_1" default="false" />
44 <arg name="use_opencv3_2" default="false" />
55 <arg name="use_opencv3_3" default="false" />
6 <arg name="use_opencv4" default="false" />
67 <node name="play_face_bag" pkg="rosbag" type="play" args="-l $(find opencv_apps)/test/face_detector_withface_test_diamondback.bag" />
78
89 <group ns="wide_stereo/left" >
1718 <arg name="use_opencv3_1" value="$(arg use_opencv3_1)" />
1819 <arg name="use_opencv3_2" value="$(arg use_opencv3_2)" />
1920 <arg name="use_opencv3_3" value="$(arg use_opencv3_3)" />
21 <arg name="use_opencv4" value="$(arg use_opencv4)" />
2022 </include>
2123
2224 <node name="face_image_viewer" pkg="image_view" type="image_view">
33 <arg name="use_opencv3_1" default="false" />
44 <arg name="use_opencv3_2" default="false" />
55 <arg name="use_opencv3_3" default="false" />
6 <arg name="use_opencv4" default="false" />
67 <node name="play_face_bag" pkg="rosbag" type="play" args="-l $(find opencv_apps)/test/face_detector_withface_test_diamondback.bag" />
78
89 <group ns="wide_stereo/left" >
1920 <arg name="use_opencv3_1" value="$(arg use_opencv3_1)" />
2021 <arg name="use_opencv3_2" value="$(arg use_opencv3_2)" />
2122 <arg name="use_opencv3_3" value="$(arg use_opencv3_3)" />
23 <arg name="use_opencv4" value="$(arg use_opencv4)" />
2224 <arg name="data_dir" value="$(find opencv_apps)/test/face_data" />
2325 </include>
2426