From 2f420c1cde229517515a0452a170732a87ff1b77 Mon Sep 17 00:00:00 2001 From: Matteo Bernardini Date: Mon, 7 Sep 2015 15:52:27 +0200 Subject: libraries/frei0r: Fix building against the newer opencv. Thanks to fedora for the patch Signed-off-by: Matteo Bernardini --- .../frei0r/fix_building_against_opencv_3.0.patch | 52 ++++++++++++++++++++++ libraries/frei0r/frei0r.SlackBuild | 7 ++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 libraries/frei0r/fix_building_against_opencv_3.0.patch diff --git a/libraries/frei0r/fix_building_against_opencv_3.0.patch b/libraries/frei0r/fix_building_against_opencv_3.0.patch new file mode 100644 index 0000000000..b9dd1352f4 --- /dev/null +++ b/libraries/frei0r/fix_building_against_opencv_3.0.patch @@ -0,0 +1,52 @@ +diff -up ./frei0r-plugins-1.4/src/filter/facedetect/facedetect.c.opencv3 ./frei0r-plugins-1.4/src/filter/facedetect/facedetect.c +--- ./frei0r-plugins-1.4/src/filter/facedetect/facedetect.c.opencv3 2013-02-24 14:43:22.000000000 +0100 ++++ ./frei0r-plugins-1.4/src/filter/facedetect/facedetect.c 2015-07-08 12:44:30.987056878 +0200 +@@ -211,8 +211,8 @@ CvSeq* detect_and_draw( IplImage* img, C + + double scale = 1.3; + IplImage* gray = cvCreateImage( cvSize(img->width,img->height), 8, 1 ); +- IplImage* small_img = cvCreateImage( cvSize( cvRound (img->width/scale), +- cvRound (img->height/scale)), ++ IplImage* small_img = cvCreateImage( cvSize( cvRound ((double)img->width/scale), ++ cvRound ((double)img->height/scale)), + 8, 1 ); + int i; + +diff -up ./frei0r-plugins-1.4/src/filter/facedetect/facedetect.cpp.opencv3 ./frei0r-plugins-1.4/src/filter/facedetect/facedetect.cpp +--- ./frei0r-plugins-1.4/src/filter/facedetect/facedetect.cpp.opencv3 2013-02-24 14:43:22.000000000 +0100 ++++ ./frei0r-plugins-1.4/src/filter/facedetect/facedetect.cpp 2015-07-08 12:48:32.754615885 +0200 +@@ -259,11 +259,11 @@ private: + { + double scale = this->scale == 0? 1.0 : this->scale; + CvScalar colors[5] = { +- {{cvRound(color[0].r * 255), cvRound(color[0].g * 255), cvRound(color[0].b * 255), cvRound(alpha * 255)}}, +- {{cvRound(color[1].r * 255), cvRound(color[1].g * 255), cvRound(color[1].b * 255), cvRound(alpha * 255)}}, +- {{cvRound(color[2].r * 255), cvRound(color[2].g * 255), cvRound(color[2].b * 255), cvRound(alpha * 255)}}, +- {{cvRound(color[3].r * 255), cvRound(color[3].g * 255), cvRound(color[3].b * 255), cvRound(alpha * 255)}}, +- {{cvRound(color[4].r * 255), cvRound(color[4].g * 255), cvRound(color[4].b * 255), cvRound(alpha * 255)}}, ++ CvScalar(cvRound(color[0].r * 255), cvRound(color[0].g * 255), cvRound(color[0].b * 255), cvRound(alpha * 255)), ++ CvScalar(cvRound(color[1].r * 255), cvRound(color[1].g * 255), cvRound(color[1].b * 255), cvRound(alpha * 255)), ++ CvScalar(cvRound(color[2].r * 255), cvRound(color[2].g * 255), cvRound(color[2].b * 255), cvRound(alpha * 255)), ++ CvScalar(cvRound(color[3].r * 255), cvRound(color[3].g * 255), cvRound(color[3].b * 255), cvRound(alpha * 255)), ++ CvScalar(cvRound(color[4].r * 255), cvRound(color[4].g * 255), cvRound(color[4].b * 255), cvRound(alpha * 255)), + }; + + for (int i = 0; i < (objects ? objects->total : 0); i++) +@@ -287,14 +287,14 @@ private: + } + case 1: + { +- CvBox2D box = {{center.x, center.y}, {r->width / scale, (r->height / scale) * 1.2}, 90}; ++ CvBox2D box = CvBox2D(CvPoint2D32f(center.x, center.y), CvSize2D32f(r->width / scale, (r->height / scale) * 1.2), 90); + cvEllipseBox(image, box, colors[i % 5], thickness, linetype); + break; + } + case 2: + { +- CvPoint pt1 = {r->x / scale, r->y / scale}; +- CvPoint pt2 = {(r->x + r->width) / scale, (r->y + r->height) / scale}; ++ CvPoint pt1 = CvPoint(r->x / scale, r->y / scale); ++ CvPoint pt2 = CvPoint((r->x + r->width) / scale, (r->y + r->height) / scale); + cvRectangle(image, pt1, pt2, colors[i % 5], thickness, linetype); + break; + } diff --git a/libraries/frei0r/frei0r.SlackBuild b/libraries/frei0r/frei0r.SlackBuild index 83095f7977..93690fd000 100644 --- a/libraries/frei0r/frei0r.SlackBuild +++ b/libraries/frei0r/frei0r.SlackBuild @@ -2,6 +2,7 @@ # Copyright 2009, Jonathan Larsen (agentc0re), SLC, UT # Contact Info: agentc0re 'AT' learnix 'DOT' net +# Copyright 2012-2015 Matteo Bernardini , Pisa, Italy # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -28,10 +29,12 @@ # *compatibility and removed the man page section # Mar 12th, 2013 # *Updated for 1.4 +# Sep 7th, 2015 +# *Patch for opencv-3.0 PRGNAM=frei0r VERSION=${VERSION:-1.4} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -76,6 +79,8 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; +patch -p2 < $CWD/fix_building_against_opencv_3.0.patch + CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ -- cgit v1.2.3