forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
media-libs/opencv: revert drop old 3.1.0-r1 and patches
This reverts commit 48656e3.
- Loading branch information
Showing
4 changed files
with
632 additions
and
0 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
From f529a1df2b17bcada1179ddcaf1352e3a5ba97b8 Mon Sep 17 00:00:00 2001 | ||
From: Maksim Shabunin <[email protected]> | ||
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 { | ||
|
214 changes: 214 additions & 0 deletions
214
media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
From ac8dd366e4a1877e0af16961a4094496bed955f7 Mon Sep 17 00:00:00 2001 | ||
From: Alexander Alekhin <[email protected]> | ||
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 |
75 changes: 75 additions & 0 deletions
75
media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
From 9862a8bac536981c1c1a74710741fb40db4beac7 Mon Sep 17 00:00:00 2001 | ||
From: Alexander Alekhin <[email protected]> | ||
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; |
Oops, something went wrong.