diff options
author | Alexis Ballier <aballier@gentoo.org> | 2019-12-10 15:26:30 +0100 |
---|---|---|
committer | Alexis Ballier <aballier@gentoo.org> | 2019-12-10 18:34:45 +0100 |
commit | fa56e57dbb93d7a60683422651fd6fee528bfb76 (patch) | |
tree | c5e82c11d7b9e7b3ebbbbb1fa76290db3afd47c6 /dev-ros/opencv_apps | |
parent | sci-libs/ViSP: Fix build with coin4. (diff) | |
download | gentoo-fa56e57dbb93d7a60683422651fd6fee528bfb76.tar.gz gentoo-fa56e57dbb93d7a60683422651fd6fee528bfb76.tar.bz2 gentoo-fa56e57dbb93d7a60683422651fd6fee528bfb76.zip |
dev-ros/opencv_apps: bump to 2.0.1 and fix build with ocv4
Package-Manager: Portage-2.3.81, Repoman-2.3.20
Signed-off-by: Alexis Ballier <aballier@gentoo.org>
Diffstat (limited to 'dev-ros/opencv_apps')
-rw-r--r-- | dev-ros/opencv_apps/Manifest | 2 | ||||
-rw-r--r-- | dev-ros/opencv_apps/files/ocv4.patch | 118 | ||||
-rw-r--r-- | dev-ros/opencv_apps/opencv_apps-2.0.1.ebuild (renamed from dev-ros/opencv_apps/opencv_apps-2.0.0-r1.ebuild) | 3 |
3 files changed, 121 insertions, 2 deletions
diff --git a/dev-ros/opencv_apps/Manifest b/dev-ros/opencv_apps/Manifest index b3398e3d2b10..067fff86f30c 100644 --- a/dev-ros/opencv_apps/Manifest +++ b/dev-ros/opencv_apps/Manifest @@ -1 +1 @@ -DIST opencv_apps-2.0.0.tar.gz 81204 BLAKE2B cd8fbcbde0213b6f5aca61dc1e9aa9740cc9d726c9d139e2888cc42d777e13f5923b4e19d2efd732797cadeb352ea26edbddab58e5d09cd7ba4571fe60649d73 SHA512 5b89ced226bfcd186de94a4bf3a9cf94d80b117a726609f58bf7331b0b3ba62ad9d4b72c4d6f0d1332000665e9aacc0e7f6dd26defda6914fa8696b586996798 +DIST opencv_apps-2.0.1.tar.gz 83497 BLAKE2B 31d0447696716ba623e64e69dc269491c4a943125c90c33ac2e495ce2a64f417758e0a142f36c5dde9032475abee516fecf9e227bbe977706f1a89ea02a3daad SHA512 db263bb49f1b083cfd84f325911da804c3a2c8b3db7f3a2ce697a4fe2dde2b692a2b1921bd32aecb19d67c93f7bf6809340c418b6bf4619ebd7beed1469838da diff --git a/dev-ros/opencv_apps/files/ocv4.patch b/dev-ros/opencv_apps/files/ocv4.patch new file mode 100644 index 000000000000..48954535e0a0 --- /dev/null +++ b/dev-ros/opencv_apps/files/ocv4.patch @@ -0,0 +1,118 @@ +From 357fc3f20d0a2252b6a0a6cab8a6ae6cf79b8565 Mon Sep 17 00:00:00 2001 +From: Jochen Sprickerhof <git@jochen.sprickerhof.de> +Date: Wed, 23 Oct 2019 22:15:57 +0200 +Subject: [PATCH] Support OpenCV 4 + +--- + src/nodelet/face_recognition_nodelet.cpp | 18 +++++++++++++++--- + src/nodelet/segment_objects_nodelet.cpp | 4 ++++ + src/nodelet/simple_flow_nodelet.cpp | 4 ++-- + 3 files changed, 21 insertions(+), 5 deletions(-) + +Index: opencv_apps-2.0.1/src/nodelet/face_recognition_nodelet.cpp +=================================================================== +--- opencv_apps-2.0.1.orig/src/nodelet/face_recognition_nodelet.cpp ++++ opencv_apps-2.0.1/src/nodelet/face_recognition_nodelet.cpp +@@ -229,7 +229,11 @@ public: + fs::path file_path = cit->path(); + try + { ++#if CV_MAJOR_VERSION > 3 ++ cv::Mat img = cv::imread(file_path.string(), cv::IMREAD_COLOR); ++#else + cv::Mat img = cv::imread(file_path.string(), CV_LOAD_IMAGE_COLOR); ++#endif + labels.push_back(label); + images.push_back(img); + } +@@ -327,7 +331,11 @@ class FaceRecognitionNodelet : public op + int(face.face.height + face.face.height * face_padding_)); + cv::Scalar color(0.0, 0.0, 255.0); + int boldness = 2; ++#if CV_MAJOR_VERSION > 3 ++ cv::rectangle(img, r.tl(), r.br(), color, boldness, cv::LINE_AA); ++#else + cv::rectangle(img, r.tl(), r.br(), color, boldness, CV_AA); ++#endif + + double font_scale = 1.5; + int text_height = 20; +@@ -338,7 +346,11 @@ class FaceRecognitionNodelet : public op + text_bl = r.br() + cv::Point(-r.width, text_height); + std::stringstream ss; + ss << face.label << " (" << std::fixed << std::setprecision(2) << face.confidence << ")"; ++#if CV_MAJOR_VERSION > 3 ++ cv::putText(img, ss.str(), text_bl, cv::FONT_HERSHEY_PLAIN, font_scale, color, boldness, cv::LINE_AA); ++#else + cv::putText(img, ss.str(), text_bl, cv::FONT_HERSHEY_PLAIN, font_scale, color, boldness, CV_AA); ++#endif + } + + void extractImage(const cv::Mat& img, const opencv_apps::Rect& rect, cv::Mat& ret, double padding = 0.0) +@@ -548,7 +560,7 @@ class FaceRecognitionNodelet : public op + if (config.model_method == "eigen") + { + // https://docs.opencv.org/3.3.1/da/d60/tutorial_face_main.html +-#if CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3 ++#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3) + model_ = face::EigenFaceRecognizer::create(config.model_num_components, config.model_threshold); + #else + model_ = face::createEigenFaceRecognizer(config.model_num_components, config.model_threshold); +@@ -556,7 +568,7 @@ class FaceRecognitionNodelet : public op + } + else if (config.model_method == "fisher") + { +-#if CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3 ++#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3) + model_ = face::FisherFaceRecognizer::create(config.model_num_components, config.model_threshold); + #else + model_ = face::createFisherFaceRecognizer(config.model_num_components, config.model_threshold); +@@ -564,7 +576,7 @@ class FaceRecognitionNodelet : public op + } + else if (config.model_method == "LBPH") + { +-#if CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3 ++#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION >= 3 && CV_MINOR_VERSION >= 3) + model_ = face::LBPHFaceRecognizer::create(config.lbph_radius, config.lbph_neighbors, config.lbph_grid_x, + config.lbph_grid_y); + #else +Index: opencv_apps-2.0.1/src/nodelet/segment_objects_nodelet.cpp +=================================================================== +--- opencv_apps-2.0.1.orig/src/nodelet/segment_objects_nodelet.cpp ++++ opencv_apps-2.0.1/src/nodelet/segment_objects_nodelet.cpp +@@ -179,7 +179,11 @@ class SegmentObjectsNodelet : public ope + } + } + cv::Scalar color(0, 0, 255); ++#if CV_MAJOR_VERSION > 3 ++ cv::drawContours(out_frame, contours, largest_comp, color, cv::FILLED, 8, hierarchy); ++#else + cv::drawContours(out_frame, contours, largest_comp, color, CV_FILLED, 8, hierarchy); ++#endif + + std_msgs::Float64 area_msg; + area_msg.data = max_area; +Index: opencv_apps-2.0.1/src/nodelet/simple_flow_nodelet.cpp +=================================================================== +--- opencv_apps-2.0.1.orig/src/nodelet/simple_flow_nodelet.cpp ++++ opencv_apps-2.0.1/src/nodelet/simple_flow_nodelet.cpp +@@ -46,7 +46,7 @@ + #include <opencv2/highgui/highgui.hpp> + #include <opencv2/imgproc/imgproc.hpp> + #include <opencv2/video/tracking.hpp> +-#if CV_MAJOR_VERSION == 3 ++#if CV_MAJOR_VERSION >= 3 + #include <opencv2/optflow.hpp> + #endif + +@@ -163,8 +163,8 @@ class SimpleFlowNodelet : public opencv_ + } + + float start = (float)cv::getTickCount(); +-#if CV_MAJOR_VERSION == 3 +- cv::optflow::calcOpticalFlowSF(gray, prevGray, ++#if CV_MAJOR_VERSION >= 3 ++ cv::optflow::calcOpticalFlowSF(gray, prevGray, + #else + cv::calcOpticalFlowSF(gray, prevGray, + #endif diff --git a/dev-ros/opencv_apps/opencv_apps-2.0.0-r1.ebuild b/dev-ros/opencv_apps/opencv_apps-2.0.1.ebuild index ddf09bbd814e..74105169c2d5 100644 --- a/dev-ros/opencv_apps/opencv_apps-2.0.0-r1.ebuild +++ b/dev-ros/opencv_apps/opencv_apps-2.0.1.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2017 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=5 @@ -27,3 +27,4 @@ RDEPEND=" dev-libs/boost:= " DEPEND="${RDEPEND}" +PATCHES=( "${FILESDIR}/ocv4.patch" ) |