Skip to content

Commit

Permalink
* Add presets for the aruco, bgsegm, img_hash, `phase_unwrappi…
Browse files Browse the repository at this point in the history
…ng`, `plot`, `structured_light`, `tracking`, and `xphoto` modules of OpenCV (issue #319)
  • Loading branch information
saudet committed Mar 10, 2018
1 parent 7e48c5b commit fdc7008
Show file tree
Hide file tree
Showing 24 changed files with 9,240 additions and 51 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Add presets for the `aruco`, `bgsegm`, `img_hash`, `phase_unwrapping`, `plot`, `structured_light`, `tracking`, and `xphoto` modules of OpenCV ([issue #319](https://github.com/bytedeco/javacpp-presets/issues/319))
* Add bindings for `b2DynamicTree::Query` and `RayCast` for LiquidFun ([pull #531](https://github.com/bytedeco/javacpp-presets/pull/531))
* Add support for Windows to presets for LLVM ([pull #530](https://github.com/bytedeco/javacpp-presets/pull/530))
* Add builds for `android-arm64` and `android-x86_64` platforms ([issue #52](https://github.com/bytedeco/javacpp-presets/issues/52))
Expand Down
2 changes: 1 addition & 1 deletion opencv/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if [[ $PLATFORM == ios* ]]; then
' modules/dnn/CMakeLists.txt
fi

BUILD_CONTRIB_X="-DBUILD_opencv_stereo=OFF -DBUILD_opencv_plot=ON -DBUILD_opencv_fuzzy=OFF -DBUILD_opencv_aruco=OFF -DBUILD_opencv_adas=OFF -DBUILD_opencv_bgsegm=OFF -DBUILD_opencv_bioinspired=ON -DBUILD_opencv_ccalib=OFF -DBUILD_opencv_datasets=OFF -DBUILD_opencv_dnn_modern=OFF -DBUILD_opencv_freetype=OFF -DBUILD_opencv_dpm=OFF -DBUILD_opencv_face=ON -DBUILD_opencv_latentsvm=OFF -DBUILD_opencv_line_descriptor=OFF -DBUILD_opencv_matlab=OFF -DBUILD_opencv_optflow=ON -DBUILD_opencv_reg=OFF -DBUILD_opencv_rgbd=OFF -DBUILD_opencv_saliency=OFF -DBUILD_opencv_surface_matching=OFF -DBUILD_opencv_text=ON -DBUILD_opencv_tracking=ON -DBUILD_opencv_xfeatures2d=ON -DBUILD_opencv_ximgproc=ON -DBUILD_opencv_xobjdetect=OFF -DBUILD_opencv_xphoto=OFF -DWITH_LAPACK=OFF"
BUILD_CONTRIB_X="-DBUILD_opencv_stereo=OFF -DBUILD_opencv_plot=ON -DBUILD_opencv_fuzzy=OFF -DBUILD_opencv_aruco=ON -DBUILD_opencv_adas=OFF -DBUILD_opencv_bgsegm=ON -DBUILD_opencv_bioinspired=ON -DBUILD_opencv_ccalib=OFF -DBUILD_opencv_datasets=OFF -DBUILD_opencv_dnn_modern=OFF -DBUILD_opencv_freetype=OFF -DBUILD_opencv_dpm=OFF -DBUILD_opencv_face=ON -DBUILD_opencv_img_hash=ON -DBUILD_opencv_latentsvm=OFF -DBUILD_opencv_line_descriptor=OFF -DBUILD_opencv_matlab=OFF -DBUILD_opencv_optflow=ON -DBUILD_opencv_phase_unwrapping=ON -DBUILD_opencv_plot=ON -DBUILD_opencv_reg=OFF -DBUILD_opencv_rgbd=OFF -DBUILD_opencv_saliency=OFF -DBUILD_opencv_structured_light=ON -DBUILD_opencv_surface_matching=OFF -DBUILD_opencv_text=ON -DBUILD_opencv_tracking=ON -DBUILD_opencv_xfeatures2d=ON -DBUILD_opencv_ximgproc=ON -DBUILD_opencv_xobjdetect=OFF -DBUILD_opencv_xphoto=ON -DWITH_LAPACK=OFF"

GPU_FLAGS="-DWITH_CUDA=OFF -DWITH_OPENCL=ON"
if [[ "$EXTENSION" == *gpu ]]; then
Expand Down
270 changes: 264 additions & 6 deletions opencv/opencv_contrib.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
diff -ruN opencv_contrib-3.4.0/modules/dnn_modern/CMakeLists.txt opencv_contrib-3.4.0-patch/modules/dnn_modern/CMakeLists.txt
--- opencv_contrib-3.4.0/modules/dnn_modern/CMakeLists.txt 2017-12-23 01:15:17.000000000 +0900
+++ opencv_contrib-3.4.0-patch/modules/dnn_modern/CMakeLists.txt 2018-01-25 09:58:43.289152300 +0900
diff -ruN opencv_contrib-3.4.1/modules/bgsegm/src/bgfg_gsoc.cpp opencv_contrib-3.4.1-patch/modules/bgsegm/src/bgfg_gsoc.cpp
--- opencv_contrib-3.4.1/modules/bgsegm/src/bgfg_gsoc.cpp 2018-02-22 22:38:31.000000000 +0900
+++ opencv_contrib-3.4.1-patch/modules/bgsegm/src/bgfg_gsoc.cpp 2018-03-10 14:18:02.591239465 +0900
@@ -264,7 +264,7 @@

class BackgroundModelGSOC : public BackgroundModel<BackgroundSampleGSOC> {
public:
- BackgroundModelGSOC(Size sz, int S) : BackgroundModel(sz, S) {};
+ BackgroundModelGSOC(Size sz, int S) : BackgroundModel<BackgroundSampleGSOC>(sz, S) {};

float findClosest(int i, int j, const Point3f& color, int& indOut) const {
const int end = i * stride + (j + 1) * nSamples;
@@ -315,7 +315,7 @@

class BackgroundModelLSBP : public BackgroundModel<BackgroundSampleLSBP> {
public:
- BackgroundModelLSBP(Size sz, int S) : BackgroundModel(sz, S) {};
+ BackgroundModelLSBP(Size sz, int S) : BackgroundModel<BackgroundSampleLSBP>(sz, S) {};

int countMatches(int i, int j, const Point3f& color, int desc, float threshold, int descThreshold, float& minDist) const {
const int end = i * stride + (j + 1) * nSamples;
diff -ruN opencv_contrib-3.4.1/modules/dnn_modern/CMakeLists.txt opencv_contrib-3.4.1-patch/modules/dnn_modern/CMakeLists.txt
--- opencv_contrib-3.4.1/modules/dnn_modern/CMakeLists.txt 2018-02-22 22:38:31.000000000 +0900
+++ opencv_contrib-3.4.1-patch/modules/dnn_modern/CMakeLists.txt 2018-03-10 14:19:49.845808226 +0900
@@ -15,16 +15,16 @@

set(TINY_DNN_CPP_PATH "${OpenCV_BINARY_DIR}/3rdparty/tinydnn")
Expand Down Expand Up @@ -28,9 +49,9 @@ diff -ruN opencv_contrib-3.4.0/modules/dnn_modern/CMakeLists.txt opencv_contrib-

if(NOT TINY_DNN_DOWNLOAD_SUCCESS)
message(STATUS "Failed to download tiny-dnn sources")
diff -ruN opencv_contrib-3.4.0/modules/face/include/opencv2/face/facemarkLBF.hpp opencv_contrib-3.4.0-patch/modules/face/include/opencv2/face/facemarkLBF.hpp
--- opencv_contrib-3.4.0/modules/face/include/opencv2/face/facemarkLBF.hpp 2017-12-23 01:15:17.000000000 +0900
+++ opencv_contrib-3.4.0-patch/modules/face/include/opencv2/face/facemarkLBF.hpp 2018-01-25 09:59:12.206227300 +0900
diff -ruN opencv_contrib-3.4.1/modules/face/include/opencv2/face/facemarkLBF.hpp opencv_contrib-3.4.1-patch/modules/face/include/opencv2/face/facemarkLBF.hpp
--- opencv_contrib-3.4.1/modules/face/include/opencv2/face/facemarkLBF.hpp 2018-02-22 22:38:31.000000000 +0900
+++ opencv_contrib-3.4.1-patch/modules/face/include/opencv2/face/facemarkLBF.hpp 2018-03-10 14:19:49.846808222 +0900
@@ -93,7 +93,7 @@

};
Expand All @@ -40,3 +61,240 @@ diff -ruN opencv_contrib-3.4.0/modules/face/include/opencv2/face/facemarkLBF.hpp
public:
BBox();
~BBox();
diff -ruN opencv_contrib-3.4.1/modules/tracking/include/opencv2/tracking/feature.hpp opencv_contrib-3.4.1-patch/modules/tracking/include/opencv2/tracking/feature.hpp
--- opencv_contrib-3.4.1/modules/tracking/include/opencv2/tracking/feature.hpp 2018-02-22 22:38:31.000000000 +0900
+++ opencv_contrib-3.4.1-patch/modules/tracking/include/opencv2/tracking/feature.hpp 2018-03-10 14:19:49.846808222 +0900
@@ -100,8 +100,6 @@
(p3) = (rect).x + (rect).width - (rect).height \
+ (step) * ((rect).y + (rect).width + (rect).height);

-float calcNormFactor( const Mat& sum, const Mat& sqSum );
-
template<class Feature>
void _writeFeatures( const std::vector<Feature> features, FileStorage &fs, const Mat& featureMap )
{
@@ -117,7 +115,7 @@
fs << "]";
}

-class CvParams
+class CV_EXPORTS CvParams
{
public:
CvParams();
@@ -134,7 +132,7 @@
std::string name;
};

-class CvFeatureParams : public CvParams
+class CV_EXPORTS CvFeatureParams : public CvParams
{
public:
enum
@@ -153,7 +151,7 @@
int numFeatures;
};

-class CvFeatureEvaluator
+class CV_EXPORTS CvFeatureEvaluator
{
public:
virtual ~CvFeatureEvaluator()
@@ -195,7 +193,7 @@
Mat cls;
};

-class CvHaarFeatureParams : public CvFeatureParams
+class CV_EXPORTS CvHaarFeatureParams : public CvFeatureParams
{
public:

@@ -212,11 +210,11 @@
bool isIntegral;
};

-class CvHaarEvaluator : public CvFeatureEvaluator
+class CV_EXPORTS CvHaarEvaluator : public CvFeatureEvaluator
{
public:

- class FeatureHaar
+ class CV_EXPORTS FeatureHaar
{

public:
@@ -289,12 +287,12 @@
Mat sum; /* sum images (each row represents image) */
};

-struct CvHOGFeatureParams : public CvFeatureParams
+struct CV_EXPORTS CvHOGFeatureParams : public CvFeatureParams
{
CvHOGFeatureParams();
};

-class CvHOGEvaluator : public CvFeatureEvaluator
+class CV_EXPORTS CvHOGEvaluator : public CvFeatureEvaluator
{
public:
virtual ~CvHOGEvaluator()
@@ -355,13 +353,13 @@
return res;
}

-struct CvLBPFeatureParams : CvFeatureParams
+struct CV_EXPORTS CvLBPFeatureParams : CvFeatureParams
{
CvLBPFeatureParams();

};

-class CvLBPEvaluator : public CvFeatureEvaluator
+class CV_EXPORTS CvLBPEvaluator : public CvFeatureEvaluator
{
public:
virtual ~CvLBPEvaluator()
diff -ruN opencv_contrib-3.4.1/modules/tracking/include/opencv2/tracking/onlineBoosting.hpp opencv_contrib-3.4.1-patch/modules/tracking/include/opencv2/tracking/onlineBoosting.hpp
--- opencv_contrib-3.4.1/modules/tracking/include/opencv2/tracking/onlineBoosting.hpp 2018-02-22 22:38:31.000000000 +0900
+++ opencv_contrib-3.4.1-patch/modules/tracking/include/opencv2/tracking/onlineBoosting.hpp 2018-03-10 14:19:49.846808222 +0900
@@ -59,7 +59,7 @@
class ClassifierThreshold;
class Detector;

-class StrongClassifierDirectSelection
+class CV_EXPORTS StrongClassifierDirectSelection
{
public:

@@ -106,7 +106,7 @@
int swappedClassifier;
};

-class BaseClassifier
+class CV_EXPORTS BaseClassifier
{
public:

@@ -148,7 +148,7 @@

};

-class EstimatedGaussDistribution
+class CV_EXPORTS EstimatedGaussDistribution
{
public:

@@ -170,7 +170,7 @@
float m_R_sigma;
};

-class WeakClassifierHaarFeature
+class CV_EXPORTS WeakClassifierHaarFeature
{

public:
@@ -192,7 +192,7 @@

};

-class Detector
+class CV_EXPORTS Detector
{
public:

@@ -260,7 +260,7 @@
cv::Mat_<unsigned char> m_confImageDisplay;
};

-class ClassifierThreshold
+class CV_EXPORTS ClassifierThreshold
{
public:

diff -ruN opencv_contrib-3.4.1/modules/tracking/include/opencv2/tracking/onlineMIL.hpp opencv_contrib-3.4.1-patch/modules/tracking/include/opencv2/tracking/onlineMIL.hpp
--- opencv_contrib-3.4.1/modules/tracking/include/opencv2/tracking/onlineMIL.hpp 2018-02-22 22:38:31.000000000 +0900
+++ opencv_contrib-3.4.1-patch/modules/tracking/include/opencv2/tracking/onlineMIL.hpp 2018-03-10 14:19:49.846808222 +0900
@@ -87,7 +87,7 @@

};

-class ClfOnlineStump
+class CV_EXPORTS ClfOnlineStump
{
public:
float _mu0, _mu1, _sig0, _sig1;
diff -ruN opencv_contrib-3.4.1/modules/tracking/include/opencv2/tracking/tracker.hpp opencv_contrib-3.4.1-patch/modules/tracking/include/opencv2/tracking/tracker.hpp
--- opencv_contrib-3.4.1/modules/tracking/include/opencv2/tracking/tracker.hpp 2018-02-22 22:38:31.000000000 +0900
+++ opencv_contrib-3.4.1-patch/modules/tracking/include/opencv2/tracking/tracker.hpp 2018-03-10 14:19:49.846808222 +0900
@@ -176,7 +176,7 @@
/** @overload
@param feature The TrackerFeature class
*/
- bool addTrackerFeature( Ptr<TrackerFeature>& feature );
+ bool addTrackerFeature( Ptr<TrackerFeature> feature );

/** @brief Get the TrackerFeature collection (TrackerFeature name, TrackerFeature pointer)
*/
@@ -309,7 +309,7 @@
/** @overload
@param sampler The TrackerSamplerAlgorithm
*/
- bool addTrackerSamplerAlgorithm( Ptr<TrackerSamplerAlgorithm>& sampler );
+ bool addTrackerSamplerAlgorithm( Ptr<TrackerSamplerAlgorithm> sampler );

private:
std::vector<std::pair<String, Ptr<TrackerSamplerAlgorithm> > > samplers;
@@ -573,7 +573,7 @@
/**
* Implementation of the target state for TrackerStateEstimatorMILBoosting
*/
- class TrackerMILTargetState : public TrackerTargetState
+ class CV_EXPORTS TrackerMILTargetState : public TrackerTargetState
{

public:
@@ -648,7 +648,7 @@
public:
/** @brief Implementation of the target state for TrackerAdaBoostingTargetState
*/
- class TrackerAdaBoostingTargetState : public TrackerTargetState
+ class CV_EXPORTS TrackerAdaBoostingTargetState : public TrackerTargetState
{

public:
diff -ruN opencv_contrib-3.4.1/modules/tracking/src/onlineMIL.cpp opencv_contrib-3.4.1-patch/modules/tracking/src/onlineMIL.cpp
--- opencv_contrib-3.4.1/modules/tracking/src/onlineMIL.cpp 2018-02-22 22:38:31.000000000 +0900
+++ opencv_contrib-3.4.1-patch/modules/tracking/src/onlineMIL.cpp 2018-03-10 14:19:49.847808218 +0900
@@ -364,7 +364,7 @@
return float( log_p1 - log_p0 );
}

-inline std::vector<float> ClfOnlineStump::classifySetF( const Mat& x )
+CV_EXPORTS std::vector<float> ClfOnlineStump::classifySetF( const Mat& x )
{
std::vector<float> res( x.rows );

diff -ruN opencv_contrib-3.4.1/modules/tracking/src/trackerFeatureSet.cpp opencv_contrib-3.4.1-patch/modules/tracking/src/trackerFeatureSet.cpp
--- opencv_contrib-3.4.1/modules/tracking/src/trackerFeatureSet.cpp 2018-02-22 22:38:31.000000000 +0900
+++ opencv_contrib-3.4.1-patch/modules/tracking/src/trackerFeatureSet.cpp 2018-03-10 14:19:49.847808218 +0900
@@ -111,7 +111,7 @@
return true;
}

-bool TrackerFeatureSet::addTrackerFeature( Ptr<TrackerFeature>& feature )
+bool TrackerFeatureSet::addTrackerFeature( Ptr<TrackerFeature> feature )
{
if( blockAddTrackerFeature )
{
diff -ruN opencv_contrib-3.4.1/modules/tracking/src/trackerSampler.cpp opencv_contrib-3.4.1-patch/modules/tracking/src/trackerSampler.cpp
--- opencv_contrib-3.4.1/modules/tracking/src/trackerSampler.cpp 2018-02-22 22:38:31.000000000 +0900
+++ opencv_contrib-3.4.1-patch/modules/tracking/src/trackerSampler.cpp 2018-03-10 14:19:49.847808218 +0900
@@ -106,7 +106,7 @@
return true;
}

-bool TrackerSampler::addTrackerSamplerAlgorithm( Ptr<TrackerSamplerAlgorithm>& sampler )
+bool TrackerSampler::addTrackerSamplerAlgorithm( Ptr<TrackerSamplerAlgorithm> sampler )
{
if( blockAddTrackerSampler )
{
Loading

0 comments on commit fdc7008

Please sign in to comment.