OCV_OPTION(WITH_VIDEOINPUT "Build HighGUI with DirectShow support" ON IF WIN32 )
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF WIN32 )
OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
-OCV_OPTION(WITH_CLP "Include Clp support (EPL)" OFF IF (UNIX AND NOT ANDROID AND NOT IOS) )
+OCV_OPTION(WITH_CLP "Include Clp support (EPL)" OFF IF (NOT ANDROID AND NOT IOS) )
# OpenCV build components
# ===================================================
set(HAVE_CLP FALSE)
if(WITH_CLP)
- PKG_CHECK_MODULES(CLP clp)
- if(CLP_FOUND)
- set(HAVE_CLP TRUE)
- if(NOT ${CLP_INCLUDE_DIRS} STREQUAL "")
- ocv_include_directories(${CLP_INCLUDE_DIRS})
+
+ if(UNIX)
+ PKG_CHECK_MODULES(CLP clp)
+ if(CLP_FOUND)
+ set(HAVE_CLP TRUE)
+ if(NOT ${CLP_INCLUDE_DIRS} STREQUAL "")
+ ocv_include_directories(${CLP_INCLUDE_DIRS})
+ endif()
+ link_directories(${CLP_LIBRARY_DIRS})
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CLP_LIBRARIES})
endif()
- link_directories(${CLP_LIBRARY_DIRS})
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CLP_LIBRARIES})
- else()
+ endif()
+
+ if(NOT CLP_FOUND)
find_path(CLP_INCLUDE_PATH "coin"
PATHS "/usr/local/include" "/usr/include" "/opt/include"
DOC "The path to Clp headers")
if(CLP_INCLUDE_PATH)
- ocv_include_directories(${CLP_INCLUDE_PATH})
+ ocv_include_directories(${CLP_INCLUDE_PATH} "${CLP_INCLUDE_PATH}/coin")
set(CLP_LIBRARY_DIR "${CLP_INCLUDE_PATH}/../lib" CACHE PATH "Full path of Clp library directory")
link_directories(${CLP_LIBRARY_DIR})
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} Clp CoinUtils bz2 z lapack blas m)
+ if(UNIX)
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} Clp CoinUtils bz2 z lapack blas m)
+ else()
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libClp libCoinUtils)
+ endif()
set(HAVE_CLP TRUE)
endif()
endif()
+
endif()
################## Extra HighGUI libs on Windows ###################
#include "opencv2/videostab/ring_buffer.hpp"
#ifdef HAVE_CLP
-#include "coin/ClpSimplex.hpp"
-#include "coin/ClpPresolve.hpp"
-#include "coin/ClpPrimalColumnSteepest.hpp"
-#include "coin/ClpDualRowSteepest.hpp"
+ #include "ClpSimplex.hpp"
+ #include "ClpPresolve.hpp"
+ #include "ClpPrimalColumnSteepest.hpp"
+ #include "ClpDualRowSteepest.hpp"
+ #define INF 1e10
#endif
-#define INF 1e10
+// Clp replaces min and max with ?: globally, we can't use std::min and std::max in case
+// when HAVE_CLP is true, otherwise we create the defines by ourselves
+#ifndef min
+ #define min(a,b) std::min(a,b)
+#endif
+#ifndef max
+ #define max(a,b) std::max(a,b)
+#endif
using namespace std;
{
void MotionStabilizationPipeline::stabilize(
- int size, const vector<Mat> &motions, pair<int,int> range,
- Mat *stabilizationMotions)
+ int size, const vector<Mat> &motions, pair<int,int> range, Mat *stabilizationMotions)
{
vector<Mat> updatedMotions(motions.size());
for (size_t i = 0; i < motions.size(); ++i)
const Mat &cur = at(idx, motions);
Mat res = Mat::zeros(cur.size(), cur.type());
float sum = 0.f;
- int iMin = std::max(idx - radius_, range.first);
- int iMax = std::min(idx + radius_, range.second);
+ int iMin = max(idx - radius_, range.first);
+ int iMax = min(idx + radius_, range.second);
for (int i = iMin; i <= iMax; ++i)
{
res += weight_[radius_ + i - idx] * getMotion(idx, i, motions);
{
setMotionModel(model);
setFrameSize(Size(0,0));
- setTrimRatio(0.1);
+ setTrimRatio(0.1f);
setWeight1(1);
setWeight2(10);
setWeight3(100);
#else
void LpMotionStabilizer::stabilize(
- int size, const vector<Mat> &motions, pair<int,int> range,
- Mat *stabilizationMotions)
+ int size, const vector<Mat> &motions, pair<int,int> range, Mat *stabilizationMotions)
{
CV_Assert(model_ == MM_LINEAR_SIMILARITY);
CoinPackedMatrix A(true, &rows_[0], &cols_[0], &elems_[0], elems_.size());
A.setDimensions(nrows, ncols);
- ClpSimplex model;
+ ClpSimplex model(false);
model.loadProblem(A, &collb_[0], &colub_[0], &obj_[0], &rowlb_[0], &rowub_[0]);
ClpDualRowSteepest dualSteep(1);