diff options
author | Amy Winston <amynka@gentoo.org> | 2016-03-02 13:10:06 +0100 |
---|---|---|
committer | Amy Winston <amynka@gentoo.org> | 2016-03-02 13:10:06 +0100 |
commit | 5dfc738e3025c2559923c8bb72d7c4399aaec89b (patch) | |
tree | ea9163c9bfdcd07a92e89dbfff5cc7899bff0982 /media-libs/opencv | |
parent | dev-python/xlutils: Bump (diff) | |
download | gentoo-5dfc738e3025c2559923c8bb72d7c4399aaec89b.tar.gz gentoo-5dfc738e3025c2559923c8bb72d7c4399aaec89b.tar.bz2 gentoo-5dfc738e3025c2559923c8bb72d7c4399aaec89b.zip |
media-libs/opencv: revert drop old 3.1.0-r1 and patches
This reverts commit 48656e3b700cf6d771db428bc6dde322753839d3.
Diffstat (limited to 'media-libs/opencv')
4 files changed, 632 insertions, 0 deletions
diff --git a/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch b/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch new file mode 100644 index 000000000000..dd77571a60cf --- /dev/null +++ b/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch @@ -0,0 +1,91 @@ +From f529a1df2b17bcada1179ddcaf1352e3a5ba97b8 Mon Sep 17 00:00:00 2001 +From: Maksim Shabunin <maksim.shabunin@itseez.com> +Date: Tue, 15 Dec 2015 17:51:08 +0300 +Subject: [PATCH] Fixed HAL headers location + +diff --git opencv_contrib-master/modules/xfeatures2d/src/sift.cpp opencv_contrib-master/modules/xfeatures2d/src/sift.cpp +index fc67c4d..9634fbb 100644 +--- opencv_contrib-master/modules/xfeatures2d/src/sift.cpp ++++ opencv_contrib-master/modules/xfeatures2d/src/sift.cpp +@@ -105,6 +105,7 @@ + #include "precomp.hpp" + #include <iostream> + #include <stdarg.h> ++#include <opencv2/core/hal/hal.hpp> + + namespace cv + { +@@ -337,9 +338,9 @@ static float calcOrientationHist( const Mat& img, Point pt, int radius, + len = k; + + // compute gradient values, orientations and the weights over the pixel neighborhood +- hal::exp(W, W, len); +- hal::fastAtan2(Y, X, Ori, len, true); +- hal::magnitude(X, Y, Mag, len); ++ cv::hal::exp32f(W, W, len); ++ cv::hal::fastAtan2(Y, X, Ori, len, true); ++ cv::hal::magnitude32f(X, Y, Mag, len); + + for( k = 0; k < len; k++ ) + { +@@ -620,9 +621,9 @@ static void calcSIFTDescriptor( const Mat& img, Point2f ptf, float ori, float sc + } + + len = k; +- hal::fastAtan2(Y, X, Ori, len, true); +- hal::magnitude(X, Y, Mag, len); +- hal::exp(W, W, len); ++ cv::hal::fastAtan2(Y, X, Ori, len, true); ++ cv::hal::magnitude32f(X, Y, Mag, len); ++ cv::hal::exp32f(W, W, len); + + for( k = 0; k < len; k++ ) + { + +diff --git opencv_contrib-master/modules/optflow/src/motempl.cpp opencv_contrib-master/modules/optflow/src/motempl.cpp +index ec18013..452ad63 100644 +--- opencv_contrib-master/modules/optflow/src/motempl.cpp ++++ opencv_contrib-master/modules/optflow/src/motempl.cpp +@@ -41,6 +41,7 @@ + + #include "precomp.hpp" + #include "opencv2/core/utility.hpp" ++#include "opencv2/core/hal/hal.hpp" + #include "opencl_kernels_optflow.hpp" + + namespace cv { +@@ -212,7 +213,7 @@ void calcMotionGradient( InputArray _mhi, OutputArray _mask, + float* orient_row = orient.ptr<float>(y); + uchar* mask_row = mask.ptr<uchar>(y); + +- hal::fastAtan2(dY_max_row, dX_min_row, orient_row, size.width, true); ++ cv::hal::fastAtan2(dY_max_row, dX_min_row, orient_row, size.width, true); + + // make orientation zero where the gradient is very small + for( x = 0; x < size.width; x++ ) +diff --git opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp +index e89eb8f..39307e5 100644 +--- opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp ++++ opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp +@@ -35,7 +35,7 @@ + */ + + #include "precomp.hpp" +-#include "opencv2/hal/intrin.hpp" ++#include "opencv2/core/hal/intrin.hpp" + #include <vector> + + namespace cv { +diff --git opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp +index 4780497..15530d3 100644 +--- opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp ++++ opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp +@@ -40,7 +40,7 @@ + #include "opencv2/xphoto.hpp" + + #include "opencv2/core.hpp" +-#include "opencv2/hal/intrin.hpp" ++#include "opencv2/core/hal/intrin.hpp" + + namespace cv { namespace xphoto { + diff --git a/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch b/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch new file mode 100644 index 000000000000..e9a190c66324 --- /dev/null +++ b/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch @@ -0,0 +1,214 @@ +From ac8dd366e4a1877e0af16961a4094496bed955f7 Mon Sep 17 00:00:00 2001 +From: Alexander Alekhin <alexander.alekhin@itseez.com> +Date: Sun, 13 Sep 2015 21:18:47 +0300 +Subject: [PATCH] ocl: fix "off" mode + +diff --git opencv_contrib-master/modules/tracking/src/tldDetector.cpp opencv_contrib-master/modules/tracking/src/tldDetector.cpp +index cbb783e..d61444b 100644 +--- opencv_contrib-master/modules/tracking/src/tldDetector.cpp ++++ opencv_contrib-master/modules/tracking/src/tldDetector.cpp +@@ -104,6 +104,7 @@ namespace cv + return splus / (sminus + splus); + } + ++#ifdef HAVE_OPENCL + double TLDDetector::ocl_Sr(const Mat_<uchar>& patch) + { + //int64 e1, e2, e3, e4; +@@ -283,6 +284,7 @@ namespace cv + //t = (e2 - e1) / getTickFrequency()*1000.0; + //printf("Sr GPU: %f\n\n", t); + } ++#endif + + // Calculate Conservative similarity of the patch (NN-Model) + double TLDDetector::Sc(const Mat_<uchar>& patch) +@@ -337,6 +339,7 @@ namespace cv + return splus / (sminus + splus); + } + ++#ifdef HAVE_OPENCL + double TLDDetector::ocl_Sc(const Mat_<uchar>& patch) + { + //int64 e1, e2, e3, e4; +@@ -415,6 +418,7 @@ namespace cv + return 0.0; + return splus / (sminus + splus); + } ++#endif // HAVE_OPENCL + + // Generate Search Windows for detector from aspect ratio of initial BBs + void TLDDetector::generateScanGrid(int rows, int cols, Size initBox, std::vector<Rect2d>& res, bool withScaling) +@@ -565,6 +569,7 @@ namespace cv + return true; + } + ++#ifdef HAVE_OPENCL + bool TLDDetector::ocl_detect(const Mat& img, const Mat& imgBlurred, Rect2d& res, std::vector<LabeledPatch>& patches, Size initSize) + { + patches.clear(); +@@ -696,6 +701,7 @@ namespace cv + res = maxScRect; + return true; + } ++#endif // HAVE_OPENCL + + // Computes the variance of subimage given by box, with the help of two integral + // images intImgP and intImgP2 (sum of squares), which should be also provided. +diff --git opencv_contrib-master/modules/tracking/src/tldDetector.hpp opencv_contrib-master/modules/tracking/src/tldDetector.hpp +index 3e11895..1caff57 100644 +--- opencv_contrib-master/modules/tracking/src/tldDetector.hpp ++++ opencv_contrib-master/modules/tracking/src/tldDetector.hpp +@@ -74,10 +74,12 @@ namespace cv + inline double ensembleClassifierNum(const uchar* data); + inline void prepareClassifiers(int rowstep); + double Sr(const Mat_<uchar>& patch); +- double ocl_Sr(const Mat_<uchar>& patch); + double Sc(const Mat_<uchar>& patch); ++#ifdef HAVE_OPENCL ++ double ocl_Sr(const Mat_<uchar>& patch); + double ocl_Sc(const Mat_<uchar>& patch); + void ocl_batchSrSc(const Mat_<uchar>& patches, double *resultSr, double *resultSc, int numOfPatches); ++#endif + + std::vector<TLDEnsembleClassifier> classifiers; + Mat *posExp, *negExp; +diff --git opencv_contrib-master/modules/tracking/src/tldModel.cpp opencv_contrib-master/modules/tracking/src/tldModel.cpp +index 0854022..47fc32a 100644 +--- opencv_contrib-master/modules/tracking/src/tldModel.cpp ++++ opencv_contrib-master/modules/tracking/src/tldModel.cpp +@@ -246,6 +246,7 @@ namespace cv + dfprintf((stdout, "\n"));*/ + } + ++#ifdef HAVE_OPENCL + void TrackerTLDModel::ocl_integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive) + { + int positiveIntoModel = 0, negativeIntoModel = 0, positiveIntoEnsemble = 0, negativeIntoEnsemble = 0; +@@ -315,6 +316,7 @@ namespace cv + dfprintf((stdout, "positiveIntoEnsemble = %d ", positiveIntoEnsemble)); + dfprintf((stdout, "\n"));*/ + } ++#endif // HAVE_OPENCL + + //Push the patch to the model + void TrackerTLDModel::pushIntoModel(const Mat_<uchar>& example, bool positive) +diff --git opencv_contrib-master/modules/tracking/src/tldModel.hpp opencv_contrib-master/modules/tracking/src/tldModel.hpp +index be9141a..ba7c926 100644 +--- opencv_contrib-master/modules/tracking/src/tldModel.hpp ++++ opencv_contrib-master/modules/tracking/src/tldModel.hpp +@@ -58,7 +58,9 @@ namespace cv + void setBoudingBox(Rect2d boundingBox){ boundingBox_ = boundingBox; } + void integrateRelabeled(Mat& img, Mat& imgBlurred, const std::vector<TLDDetector::LabeledPatch>& patches); + void integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive); ++#ifdef HAVE_OPENCL + void ocl_integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive); ++#endif + Size getMinSize(){ return minSize_; } + void printme(FILE* port = stdout); + Ptr<TLDDetector> detector; +diff --git opencv_contrib-master/modules/tracking/src/tldTracker.cpp opencv_contrib-master/modules/tracking/src/tldTracker.cpp +index 0f1e2f7..a5190f5 100644 +--- opencv_contrib-master/modules/tracking/src/tldTracker.cpp ++++ opencv_contrib-master/modules/tracking/src/tldTracker.cpp +@@ -123,9 +123,11 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox) + + if (i == 1) + { ++#ifdef HAVE_OPENCL + if (ocl::haveOpenCL()) + DETECT_FLG = tldModel->detector->ocl_detect(imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize()); + else ++#endif + DETECT_FLG = tldModel->detector->detect(imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize()); + } + +@@ -211,17 +213,21 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox) + tldModel->integrateRelabeled(imageForDetector, image_blurred, detectorResults); + //dprintf(("%d relabeled by nExpert\n", negRelabeled)); + pExpert.additionalExamples(examplesForModel, examplesForEnsemble); +- if (ocl::haveOpenCL()) +- tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, true); +- else +- tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, true); ++#ifdef HAVE_OPENCL ++ if (ocl::haveOpenCL()) ++ tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, true); ++ else ++#endif ++ tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, true); + examplesForModel.clear(); examplesForEnsemble.clear(); + nExpert.additionalExamples(examplesForModel, examplesForEnsemble); + +- if (ocl::haveOpenCL()) +- tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, false); +- else +- tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, false); ++#ifdef HAVE_OPENCL ++ if (ocl::haveOpenCL()) ++ tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, false); ++ else ++#endif ++ tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, false); + } + else + { +diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.cpp opencv_contrib-master/modules/xfeatures2d/src/surf.cpp +index 673817e..af5ceaf6 100644 +--- opencv_contrib-master/modules/xfeatures2d/src/surf.cpp ++++ opencv_contrib-master/modules/xfeatures2d/src/surf.cpp +@@ -892,6 +892,7 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask, + CV_Assert(!_img.empty() && CV_MAT_DEPTH(imgtype) == CV_8U && (imgcn == 1 || imgcn == 3 || imgcn == 4)); + CV_Assert(_descriptors.needed() || !useProvidedKeypoints); + ++#ifdef HAVE_OPENCL + if( ocl::useOpenCL() ) + { + SURF_OCL ocl_surf; +@@ -918,6 +919,7 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask, + return; + } + } ++#endif // HAVE_OPENCL + + Mat img = _img.getMat(), mask = _mask.getMat(), mask1, sum, msum; + +diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.hpp opencv_contrib-master/modules/xfeatures2d/src/surf.hpp +index 2c4e271..cf3fda1 100644 +--- opencv_contrib-master/modules/xfeatures2d/src/surf.hpp ++++ opencv_contrib-master/modules/xfeatures2d/src/surf.hpp +@@ -64,6 +64,7 @@ class SURF_Impl : public SURF + bool upright; + }; + ++#ifdef HAVE_OPENCL + class SURF_OCL + { + public: +@@ -145,6 +146,7 @@ class SURF_OCL + + int status; + }; ++#endif // HAVE_OPENCL + + /* + template<typename _Tp> void copyVectorToUMat(const std::vector<_Tp>& v, UMat& um) +diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp +index b12ebd3..3d9845d 100644 +--- opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp ++++ opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp +@@ -43,6 +43,9 @@ + // + //M*/ + #include "precomp.hpp" ++ ++#ifdef HAVE_OPENCL ++ + #include "surf.hpp" + + #include <cstdio> +@@ -461,3 +464,4 @@ bool SURF_OCL::calcOrientation(UMat &keypoints) + } + } + ++#endif // HAVE_OPENCL diff --git a/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch b/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch new file mode 100644 index 000000000000..c9f85a758583 --- /dev/null +++ b/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch @@ -0,0 +1,75 @@ +From 9862a8bac536981c1c1a74710741fb40db4beac7 Mon Sep 17 00:00:00 2001 +From: Alexander Alekhin <alexander.alekhin@itseez.com> +Date: Wed, 23 Sep 2015 12:44:26 +0300 +Subject: [PATCH] fix invalid String usage + +--- + modules/tracking/src/tldDetector.cpp | 6 +++--- + modules/ximgproc/samples/live_demo.cpp | 12 ++++++------ + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git opencv_contrib-master/modules/tracking/src/tldDetector.cpp opencv_contrib-master/modules/tracking/src/tldDetector.cpp +index cbb783e..0916092 100644 +--- opencv_contrib-master/modules/tracking/src/tldDetector.cpp ++++ opencv_contrib-master/modules/tracking/src/tldDetector.cpp +@@ -122,7 +122,7 @@ namespace cv + ocl::Kernel k; + ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc; + String error; +- ocl::Program prog(src, NULL, error); ++ ocl::Program prog(src, String(), error); + k.create("NCC", prog); + if (k.empty()) + printf("Kernel create failed!!!\n"); +@@ -198,7 +198,7 @@ namespace cv + ocl::Kernel k; + ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc; + String error; +- ocl::Program prog(src, NULL, error); ++ ocl::Program prog(src, String(), error); + k.create("batchNCC", prog); + if (k.empty()) + printf("Kernel create failed!!!\n"); +@@ -355,7 +355,7 @@ namespace cv + ocl::Kernel k; + ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc; + String error; +- ocl::Program prog(src, NULL, error); ++ ocl::Program prog(src, String(), error); + k.create("NCC", prog); + if (k.empty()) + printf("Kernel create failed!!!\n"); +diff --git opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp +index dd5dc1b..8e16de3 100644 +--- opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp ++++ opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp +@@ -189,7 +189,7 @@ int main() + + //Thread trackbar + cv::setNumThreads(g_numberOfCPUs); //speedup filtering +- createTrackbar("Threads", NULL, &g_numberOfCPUs, cv::getNumberOfCPUs(), changeNumberOfCpuCallback); ++ createTrackbar("Threads", String(), &g_numberOfCPUs, cv::getNumberOfCPUs(), changeNumberOfCpuCallback); + + //Buttons to choose different modes + createButton("Mode Details Enhancement", changeModeCallback, (void*)filterDetailEnhancement, QT_RADIOBOX, true); +@@ -199,15 +199,15 @@ int main() + + //sliders for Details Enhancement mode + g_filterOp = filterDetailEnhancement; //set Details Enhancement as default filter +- createTrackbar("Detail contrast", NULL, &g_contrastBase, 200); +- createTrackbar("Detail level" , NULL, &g_detailsLevel, 200); ++ createTrackbar("Detail contrast", String(), &g_contrastBase, 200); ++ createTrackbar("Detail level" , String(), &g_detailsLevel, 200); + + //sliders for Stylizing mode +- createTrackbar("Style gamma", NULL, &g_edgesGamma, 300); ++ createTrackbar("Style gamma", String(), &g_edgesGamma, 300); + + //sliders for every mode +- createTrackbar("Sigma Spatial", NULL, &g_sigmaSpatial, 200); +- createTrackbar("Sigma Color" , NULL, &g_sigmaColor, 200); ++ createTrackbar("Sigma Spatial", String(), &g_sigmaSpatial, 200); ++ createTrackbar("Sigma Color" , String(), &g_sigmaColor, 200); + + Mat rawFrame, outputFrame; + Mat srcFrame, processedFrame; diff --git a/media-libs/opencv/opencv-3.1.0-r1.ebuild b/media-libs/opencv/opencv-3.1.0-r1.ebuild new file mode 100644 index 000000000000..bbbcde9fdec0 --- /dev/null +++ b/media-libs/opencv/opencv-3.1.0-r1.ebuild @@ -0,0 +1,252 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 +PYTHON_COMPAT=( python{2_7,3_2,3_3,3_4,3_5} ) + +inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2 + +DESCRIPTION="A collection of algorithms and sample code for various computer vision problems" +HOMEPAGE="http://opencv.org" + +SRC_URI=" + mirror://sourceforge/opencvlibrary/opencv-unix/${PV}/${P}.zip + https://github.com/Itseez/${PN}/archive/${PV}.zip -> ${P}.zip + contrib? ( https://github.com/Itseez/${PN}_contrib/archive/${PV}.zip -> ${PN}_contrib.zip )" + +LICENSE="BSD" +SLOT="0/3.1" # subslot = libopencv* soname version +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux" +IUSE="contrib cuda doc +eigen examples ffmpeg gdal gphoto2 gstreamer gtk ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png +python qt4 qt5 testprograms threads tiff vaapi v4l vtk webp xine" +REQUIRED_USE=" + python? ( ${PYTHON_REQUIRED_USE} ) + ?? ( qt4 qt5 ) +" + +# The following logic is intrinsic in the build system, but we do not enforce +# it on the useflags since this just blocks emerging pointlessly: +# gtk? ( !qt4 ) +# opengl? ( || ( gtk qt4 ) ) +# openmp? ( !threads ) + +RDEPEND=" + app-arch/bzip2 + sys-libs/zlib + cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 ) + ffmpeg? ( + libav? ( media-video/libav:0= ) + !libav? ( media-video/ffmpeg:0= ) + ) + gdal? ( sci-libs/gdal ) + gphoto2? ( media-libs/libgphoto2 ) + gstreamer? ( + media-libs/gstreamer:1.0 + media-libs/gst-plugins-base:1.0 + ) + gtk? ( + dev-libs/glib:2 + x11-libs/gtk+:2 + opengl? ( x11-libs/gtkglext ) + ) + java? ( >=virtual/jre-1.6:* ) + jpeg? ( virtual/jpeg:0 ) + jpeg2k? ( media-libs/jasper ) + ieee1394? ( + media-libs/libdc1394 + sys-libs/libraw1394 + ) + ipp? ( sci-libs/ipp ) + opencl? ( virtual/opencl ) + openexr? ( media-libs/openexr ) + opengl? ( virtual/opengl virtual/glu ) + png? ( media-libs/libpng:0= ) + python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] ) + qt4? ( + dev-qt/qtgui:4 + dev-qt/qttest:4 + opengl? ( dev-qt/qtopengl:4 ) + ) + qt5? ( + dev-qt/qtgui:5 + dev-qt/qttest:5 + dev-qt/qtconcurrent:5 + opengl? ( dev-qt/qtopengl:5 ) + ) + threads? ( dev-cpp/tbb ) + tiff? ( media-libs/tiff:0 ) + v4l? ( >=media-libs/libv4l-0.8.3 ) + vtk? ( sci-libs/vtk[rendering] ) + webp? ( media-libs/libwebp ) + xine? ( media-libs/xine-lib ) +" +DEPEND="${RDEPEND} + virtual/pkgconfig + eigen? ( dev-cpp/eigen:3 ) + java? ( >=virtual/jdk-1.6 ) +" + +pkg_setup() { + use python && python-single-r1_pkg_setup + java-pkg-opt-2_pkg_setup +} + +src_prepare() { + + epatch "${FILESDIR}/${PN}-3.0.0-gles.patch" \ + "${FILESDIR}/${PN}-3.1.0-cmake-no-opengl.patch" + + # remove bundled stuff + rm -rf 3rdparty + sed -i \ + -e '/add_subdirectory(.*3rdparty.*)/ d' \ + CMakeLists.txt cmake/*cmake || die + + if use contrib; then + + cd "${WORKDIR}" + epatch "${FILESDIR}/${PN}-3.1.0-fix-hal-headers.patch" \ + "${FILESDIR}/${PN}-3.1.0-fix-ocl-declaration.patch" \ + "${FILESDIR}/${PN}-3.1.0-invalid-string-usage.patch" + fi + + java-pkg-opt-2_src_prepare +} + +src_configure() { + if use openmp; then + tc-has-openmp || die "Please switch to an openmp compatible compiler" + fi + + JAVA_ANT_ENCODING="iso-8859-1" + # set encoding so even this cmake build will pick it up. + export ANT_OPTS+=" -Dfile.encoding=iso-8859-1" + java-ant-2_src_configure + + # please dont sort here, order is the same as in CMakeLists.txt + local mycmakeargs=( + # the optinal dependency libraries + $(cmake-utils_use_with ieee1394 1394) + -DWITH_AVFOUNDATION=OFF # IOS + -DWITH_CARBON=OFF # APPLE + $(cmake-utils_use_with eigen) + $(cmake-utils_use_with ffmpeg) + -DWITH_VFW=OFF # video windows support + $(cmake-utils_use_with gstreamer) + -DWITH_GSTREAMER_0_10=OFF + $(cmake-utils_use_with gtk) + -DWITH_GTK_2_X=OFF + $(cmake-utils_use_with ipp) + $(cmake-utils_use_with java) + $(cmake-utils_use_with jpeg2k JASPER) + $(cmake-utils_use_with jpeg) + $(cmake-utils_use_with webp) + $(cmake-utils_use_with opencl) + $(cmake-utils_use_with gphoto2) + $(cmake-utils_use_with openexr) + $(cmake-utils_use_with opengl) + $(cmake-utils_use_with openmp) + -DWITH_OPENNI=OFF #not packaged + -DWITH_OPENNI2=OFF #not packaged + $(cmake-utils_use_with png) + $(cmake-utils_use_build python opencv_python) + -DWITH_PVAPI=OFF # not packaged + -DWITH_GIGEAPI=OFF + -DWITH_QUICKTIME=OFF + -DWITH_WIN32UI=OFF + $(cmake-utils_use_with threads TBB) + -DWITH_CSTRIPES=OFF + -DWITH_PTHREADS_PF=ON + $(cmake-utils_use_with tiff) + -DWITH_UNICAP=OFF # not packaged + $(cmake-utils_use_with v4l V4L) + $(cmake-utils_use_with vtk VTK) + -DWITH_LIBV4L=ON + -DWITH_DSHOW=ON # direct show supp + -DWITH_MSMF=OFF + -DWITH_VIDEOINPUT=OFF # windows only + -DWITH_XIMEA=OFF # windows only + $(cmake-utils_use_with xine) + -DWITH_CLP=OFF + $(cmake-utils_use_with opencl) + -DWITH_OPENCL_SVM=OFF + $(cmake-utils_use_with opencl OPENCLAMDFFT) + $(cmake-utils_use_with opencl OPENCLAMDBLAS) + -DWITH_DIRECTX=OFF + -DWITH_INTELPERC=OFF + -DWITH_IPP_A=OFF + -DWITH_MATLAB=ON #default + $(cmake-utils_use_with vaapi VA) + $(cmake-utils_use_with vaapi VA_INTEL) + $(cmake-utils_use_with gdal gdal) + # + # OpenCV build components + -DBUILD_SHARED_LIBS=ON + -DBUILD_ANDROID_EXAMPLES=OFF + $(cmake-utils_use_build doc DOCS) + $(cmake-utils_use_build examples) + $(cmake-utils_use_build java opencv_java) #for -java bug #555650 + -DBUILD_PERF_TESTS=OFF + $(cmake-utils_use_build testprograms TESTS) + # install examples, tests etc + $(cmake-utils_use examples INSTALL_C_EXAMPLES) + $(cmake-utils_use testprograms INSTALL_TESTS) + # build options + $(cmake-utils_use_enable pch PRECOMPILED_HEADERS) + -DOPENCV_EXTRA_FLAGS_RELEASE="" # black magic + ) + + if use qt4; then + mycmakeargs+=( "-DWITH_QT=4" ) + elif use qt5; then + mycmakeargs+=( "-DWITH_QT=5" ) + else + mycmakeargs+=( "-DWITH_QT=OFF" ) + fi + + if use contrib; then + mycmakeargs+=( "-DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-master/modules" ) + fi + + if use cuda; then + mycmakeargs+=( "-DWITH_CUDA=ON" ) + mycmakeargs+=( "-DWITH_CUBLAS=ON" ) + mycmakeargs+=( "-DWITH_CUFFT=ON" ) + mycmakeargs+=( "-DWITH_NVCUVID=ON" ) #Nvidia video decoding library supp + else + mycmakeargs+=( "-DWITH_CUDA=OFF" ) + mycmakeargs+=( "-DWITH_CUBLAS=OFF" ) + mycmakeargs+=( "-DWITH_CUFFT=OFF" ) + mycmakeargs+=( "-DWITH_NVCUVID=OFF" ) + fi + + if use examples && use python; then + mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=ON" ) + else + mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=OFF" ) + fi + + # things we want to be hard off or not yet figured out + mycmakeargs+=( + "-DOPENCV_BUILD_3RDPARTY_LIBS=OFF" + "-DBUILD_LATEX_DOCS=OFF" + "-DBUILD_PACKAGE=OFF" + "-DENABLE_PROFILING=OFF" + ) + + # things we want to be hard enabled not worth useflag + mycmakeargs+=( + "-DCMAKE_SKIP_RPATH=ON" + "-DOPENCV_DOC_INSTALL_PATH=${EPREFIX}/usr/share/doc/${PF}" + ) + + # hardcode cuda paths + mycmakeargs+=( + "-DCUDA_NPP_LIBRARY_ROOT_DIR=/opt/cuda" + ) + + # workaround for bug 413429 + tc-export CC CXX + + cmake-utils_src_configure +} |