Update patches

This commit is contained in:
Nicolas Chauvet 2020-05-25 09:59:53 +02:00
parent 9a287c25aa
commit 8bc64ac6f3
5 changed files with 193 additions and 8 deletions

View File

@ -0,0 +1,44 @@
From fa445192a9e3091b837ad93fccca86075dab80b2 Mon Sep 17 00:00:00 2001
From: Nicolas Chauvet <kwizart@gmail.com>
Date: Mon, 25 May 2020 09:56:59 +0200
Subject: [PATCH 4/4] Bump opencv to 2.3 (c++ API)
---
configure.ac | 2 +-
src/Makefile.am | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 42dd629..bd8b1cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,7 +94,7 @@ AC_FUNC_MALLOC
AC_CHECK_FUNCS([floor memset pow sqrt])
HAVE_OPENCV=false
-PKG_CHECK_MODULES(OPENCV, opencv >= 1.0.0, [HAVE_OPENCV=true], [true])
+PKG_CHECK_MODULES(OPENCV, opencv >= 2.3, [HAVE_OPENCV=true], [true])
AM_CONDITIONAL([HAVE_OPENCV], [test x$HAVE_OPENCV = xtrue])
if test x$HAVE_OPENCV = xtrue; then
# OPENCV_CFLAGS="$OPENCV_CFLAGS -DOPENCV_PREFIX=`pkg-config opencv --variable=prefix`"
diff --git a/src/Makefile.am b/src/Makefile.am
index 9e8a9c4..c778312 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -156,11 +156,11 @@ endif
if HAVE_OPENCV
plugin_LTLIBRARIES += facebl0r.la
facebl0r_la_SOURCES = filter/facebl0r/facebl0r.cpp
-facebl0r_la_CFLAGS = @OPENCV_CFLAGS@ @CFLAGS@
+facebl0r_la_CFLAGS = @OPENCV_CXXFLAGS@ @CFLAGS@
facebl0r_la_LIBADD = @OPENCV_LIBS@
plugin_LTLIBRARIES += facedetect.la
facedetect_la_SOURCES = filter/facedetect/facedetect.cpp
-facedetect_la_CFLAGS = @OPENCV_CFLAGS@ @CFLAGS@
+facedetect_la_CFLAGS = @OPENCV_CXXFLAGS@ @CFLAGS@
facedetect_la_LIBADD = @OPENCV_LIBS@
endif
--
2.25.4

View File

@ -0,0 +1,46 @@
From 796d122587207afbf0c35c75edf6e9588edc0b99 Mon Sep 17 00:00:00 2001
From: Nicolas Chauvet <kwizart@gmail.com>
Date: Mon, 25 May 2020 09:51:16 +0200
Subject: [PATCH 3/4] Switch to OpenCV4 enums
Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
---
src/filter/facebl0r/facebl0r.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/filter/facebl0r/facebl0r.cpp b/src/filter/facebl0r/facebl0r.cpp
index 96222d8..fa21a35 100644
--- a/src/filter/facebl0r/facebl0r.cpp
+++ b/src/filter/facebl0r/facebl0r.cpp
@@ -209,7 +209,7 @@ std::vector<cv::Rect> FaceBl0r::detect_face()
//use an equalized gray image for better recognition
cv::Mat gray;
- cv::cvtColor(image, gray, CV_BGR2GRAY);
+ cv::cvtColor(image, gray, cv::COLOR_BGR2GRAY);
cv::equalizeHist(gray, gray);
//get a sequence of faces in image
@@ -218,8 +218,8 @@ std::vector<cv::Rect> FaceBl0r::detect_face()
cascade.detectMultiScale(gray, faces,
search_scale * 10.0,
cvRound(neighbors * 100),
- CV_HAAR_FIND_BIGGEST_OBJECT|//since we track only the first, get the biggest
- CV_HAAR_DO_CANNY_PRUNING, //skip regions unlikely to contain a face
+ cv::CASCADE_FIND_BIGGEST_OBJECT|//since we track only the first, get the biggest
+ cv::CASCADE_DO_CANNY_PRUNING, //skip regions unlikely to contain a face
cv::Size(min, min));
return faces;
@@ -259,7 +259,7 @@ void TrackedObj::update_hue_image (const cv::Mat& image) {
int vmin = 65, vmax = 256, smin = 55;
//convert to HSV color model
- cv::cvtColor(image, hsv, CV_BGR2HSV);
+ cv::cvtColor(image, hsv, cv::COLOR_BGR2HSV);
//mask out-of-range values
cv::inRange(hsv, //source
--
2.25.4

View File

@ -0,0 +1,50 @@
From b4562db4ca20fefcce62dbe7b255c2b75951853e Mon Sep 17 00:00:00 2001
From: Raphael Graf <r@undefined.ch>
Date: Thu, 5 Mar 2020 15:39:37 +0100
Subject: [PATCH] facedetect: Support opencv4
---
src/filter/facedetect/facedetect.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/filter/facedetect/facedetect.cpp b/src/filter/facedetect/facedetect.cpp
index 1906962..580b53b 100644
--- a/src/filter/facedetect/facedetect.cpp
+++ b/src/filter/facedetect/facedetect.cpp
@@ -148,13 +148,13 @@ class FaceDetect: public frei0r::filter
count = 1; // reset the recheck counter
if (objects.size() > 0) // reset the list of objects
objects.clear();
- double elapsed = (double) cvGetTickCount();
+ double elapsed = (double) cv::getTickCount();
objects = detect();
// use detection time to throttle frequency of re-detect vs. redraw (automatic recheck)
- elapsed = cvGetTickCount() - elapsed;
- elapsed = elapsed / ((double) cvGetTickFrequency() * 1000.0);
+ elapsed = cv::getTickCount() - elapsed;
+ elapsed = elapsed / ((double) cv::getTickFrequency() * 1000.0);
// Automatic recheck uses an undocumented negative parameter value,
// which is not compliant, but technically feasible.
@@ -188,7 +188,7 @@ class FaceDetect: public frei0r::filter
}
// use an equalized grayscale to improve detection
- cv::cvtColor(image_roi, gray, CV_BGR2GRAY);
+ cv::cvtColor(image_roi, gray, cv::COLOR_BGR2GRAY);
// use a smaller image to improve performance
cv::resize(gray, small, cv::Size(cvRound(gray.cols * scale), cvRound(gray.rows * scale)));
@@ -249,8 +249,8 @@ class FaceDetect: public frei0r::filter
{
cv::Rect* r = (cv::Rect*) &objects[i];
cv::Point center;
- int thickness = stroke <= 0? CV_FILLED : cvRound(stroke * 100);
- int linetype = antialias? CV_AA : 8;
+ int thickness = stroke <= 0? cv::FILLED : cvRound(stroke * 100);
+ int linetype = antialias? cv::LINE_AA : 8;
center.x = cvRound((r->x + r->width * 0.5) / scale);
center.y = cvRound((r->y + r->height * 0.5) / scale);

View File

@ -0,0 +1,46 @@
From b8d4e0595c8134b2b3c7e82ecb8da36c9354f68a Mon Sep 17 00:00:00 2001
From: Dan Dennedy <dan@dennedy.org>
Date: Sat, 11 Apr 2020 11:54:37 -0700
Subject: [PATCH] fix c0rners filter top and left edge artifacts at default
full size
---
src/filter/c0rners/c0rners.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/filter/c0rners/c0rners.c b/src/filter/c0rners/c0rners.c
index e270253..f510926 100644
--- a/src/filter/c0rners/c0rners.c
+++ b/src/filter/c0rners/c0rners.c
@@ -974,6 +974,8 @@ void f0r_get_param_value(f0r_instance_t instance, f0r_param_t param, int param_i
}
}
+#define EPSILON 1e-5f
+#define EQUIVALENT_FLOATS(x, y) (fabsf((x) - (y)) < EPSILON)
//-------------------------------------------------
void f0r_update(f0r_instance_t instance, double time, const uint32_t* inframe, uint32_t* outframe)
@@ -983,6 +985,22 @@ void f0r_update(f0r_instance_t instance, double time, const uint32_t* inframe, u
p=(inst*)instance;
+ if (EQUIVALENT_FLOATS(p->x1, 0.333333f) &&
+ EQUIVALENT_FLOATS(p->y1, 0.333333f) &&
+ EQUIVALENT_FLOATS(p->x2, 0.666666f) &&
+ EQUIVALENT_FLOATS(p->y2, 0.333333f) &&
+ EQUIVALENT_FLOATS(p->x3, 0.666666f) &&
+ EQUIVALENT_FLOATS(p->y3, 0.666666f) &&
+ EQUIVALENT_FLOATS(p->x4, 0.333333f) &&
+ EQUIVALENT_FLOATS(p->y4, 0.666666f) &&
+ (!p->stretchON || (
+ EQUIVALENT_FLOATS(p->stretchx, 0.5f) &&
+ EQUIVALENT_FLOATS(p->stretchy, 0.5f))))
+ {
+ memcpy(outframe, inframe, p->w * p->h * 4);
+ return;
+ }
+
if (p->mapIsDirty) {
tocka2 vog[4];
int nots[4];

View File

@ -1,6 +1,6 @@
Name: frei0r-plugins
Version: 1.7.0
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Frei0r - a minimalist plugin API for video effects
License: GPLv2+
@ -8,6 +8,9 @@ URL: https://frei0r.dyne.org/
Source0: https://github.com/dyne/frei0r/archive/v%{version}/frei0r-plugins-%{version}.tar.gz
Patch0: https://github.com/dyne/frei0r/pull/94/commits/b27f03c8d51c34cd5f79e0399bb0024ca94ea813.patch
Patch1: https://github.com/dyne/frei0r/commit/7482c320b52956713d0b511771b23020fabd07a2.patch
Patch2: https://github.com/dyne/frei0r/commit/b4562db4ca20fefcce62dbe7b255c2b75951853e.patch
Patch3: https://github.com/dyne/frei0r/commit/b8d4e0595c8134b2b3c7e82ecb8da36c9354f68a.patch
Buildrequires: libtool
@ -40,13 +43,6 @@ developing applications that use %{name}.
%prep
%autosetup -n frei0r-%{version} -p1
# few more hacks
sed -i -e 's/CV_HAAR_FIND_BIGGEST_OBJECT/cv::CASCADE_FIND_BIGGEST_OBJECT/' \
-e 's/CV_HAAR_DO_CANNY_PRUNING/cv::CASCADE_DO_CANNY_PRUNING/' \
-e 's/CV_BGR2GRAY/cv::COLOR_BGR2GRAY/' \
-e 's/CV_BGR2HSV/cv::COLOR_BGR2HSV/' \
src/filter/facebl0r/facebl0r.cpp
%build
mkdir -p m4
@ -79,6 +75,9 @@ rm -rf %{buildroot}%{_docdir}/%{name}
%{_libdir}/pkgconfig/frei0r.pc
%changelog
* Mon May 25 2020 Nicolas Chauvet <kwizart@gmail.com> - 1.7.0-7
- Apply patches from PR toward opencv4 support
* Fri Mar 06 2020 Nicolas Chauvet <kwizart@gmail.com> - 1.7.0-6
- Update wip opencv patch