Fixed Android build of new videostab module
This commit is contained in:
parent
844bdea5ac
commit
14a1549dac
modules/videostab
@ -1,3 +1,3 @@
|
|||||||
set(the_description "Video stabilization")
|
set(the_description "Video stabilization")
|
||||||
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video OPTIONAL opencv_gpu)
|
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_highgui OPTIONAL opencv_gpu)
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ private:
|
|||||||
float dist;
|
float dist;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
DXY() {}
|
DXY() : dist(0), x(0), y(0) {}
|
||||||
DXY(float dist, int x, int y) : dist(dist), x(x), y(y) {}
|
DXY(float dist, int x, int y) : dist(dist), x(x), y(y) {}
|
||||||
bool operator <(const DXY &dxy) const { return dist < dxy.dist; }
|
bool operator <(const DXY &dxy) const { return dist < dxy.dist; }
|
||||||
};
|
};
|
||||||
|
@ -44,7 +44,11 @@
|
|||||||
#define __OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP__
|
#define __OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP__
|
||||||
|
|
||||||
#include "opencv2/core/core.hpp"
|
#include "opencv2/core/core.hpp"
|
||||||
#include "opencv2/gpu/gpu.hpp"
|
#include "opencv2/opencv_modules.hpp"
|
||||||
|
|
||||||
|
#if HAVE_OPENCV_GPU
|
||||||
|
# include "opencv2/gpu/gpu.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
@ -94,6 +98,7 @@ public:
|
|||||||
OutputArray status, OutputArray errors);
|
OutputArray status, OutputArray errors);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if HAVE_OPENCV_GPU
|
||||||
class DensePyrLkOptFlowEstimatorGpu
|
class DensePyrLkOptFlowEstimatorGpu
|
||||||
: public PyrLkOptFlowEstimatorBase, public IDenseOptFlowEstimator
|
: public PyrLkOptFlowEstimatorBase, public IDenseOptFlowEstimator
|
||||||
{
|
{
|
||||||
@ -107,6 +112,7 @@ private:
|
|||||||
gpu::PyrLKOpticalFlow optFlowEstimator_;
|
gpu::PyrLKOpticalFlow optFlowEstimator_;
|
||||||
gpu::GpuMat frame0_, frame1_, flowX_, flowY_, errors_;
|
gpu::GpuMat frame0_, frame1_, flowX_, flowY_, errors_;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace videostab
|
} // namespace videostab
|
||||||
} // namespace cv
|
} // namespace cv
|
||||||
|
@ -246,7 +246,11 @@ public:
|
|||||||
|
|
||||||
MotionInpainter::MotionInpainter()
|
MotionInpainter::MotionInpainter()
|
||||||
{
|
{
|
||||||
|
#if HAVE_OPENCV_GPU
|
||||||
setOptFlowEstimator(new DensePyrLkOptFlowEstimatorGpu());
|
setOptFlowEstimator(new DensePyrLkOptFlowEstimatorGpu());
|
||||||
|
#else
|
||||||
|
CV_Error( CV_StsNotImplemented, "Current implementation of MotionInpainter requires GPU" );
|
||||||
|
#endif
|
||||||
setFlowErrorThreshold(1e-4f);
|
setFlowErrorThreshold(1e-4f);
|
||||||
setBorderMode(BORDER_REPLICATE);
|
setBorderMode(BORDER_REPLICATE);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
//M*/
|
//M*/
|
||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "opencv2/gpu/gpu.hpp"
|
|
||||||
#include "opencv2/video/video.hpp"
|
#include "opencv2/video/video.hpp"
|
||||||
#include "opencv2/videostab/optical_flow.hpp"
|
#include "opencv2/videostab/optical_flow.hpp"
|
||||||
|
|
||||||
@ -60,6 +59,7 @@ void SparsePyrLkOptFlowEstimator::run(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if HAVE_OPENCV_GPU
|
||||||
DensePyrLkOptFlowEstimatorGpu::DensePyrLkOptFlowEstimatorGpu()
|
DensePyrLkOptFlowEstimatorGpu::DensePyrLkOptFlowEstimatorGpu()
|
||||||
{
|
{
|
||||||
CV_Assert(gpu::getCudaEnabledDeviceCount() > 0);
|
CV_Assert(gpu::getCudaEnabledDeviceCount() > 0);
|
||||||
@ -86,6 +86,7 @@ void DensePyrLkOptFlowEstimatorGpu::run(
|
|||||||
flowX_.download(flowX.getMatRef());
|
flowX_.download(flowX.getMatRef());
|
||||||
flowY_.download(flowY.getMatRef());
|
flowY_.download(flowY.getMatRef());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
} // namespace videostab
|
} // namespace videostab
|
||||||
|
Loading…
x
Reference in New Issue
Block a user