mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 21:20:18 +08:00
Merge pull request #700 from cuda-geek/fix_build_with_cuda
fix master build with CUDA after latest 2.4 merge
This commit is contained in:
commit
8c41c614eb
@ -68,6 +68,8 @@ void cv::gpu::GeneralizedHough_GPU::release() {}
|
||||
|
||||
#else /* !defined (HAVE_CUDA) */
|
||||
|
||||
#include "opencv2/core/utility.hpp"
|
||||
|
||||
namespace cv { namespace gpu { namespace device
|
||||
{
|
||||
namespace hough
|
||||
|
@ -71,6 +71,7 @@ int cv::gpu::countNonZero(const GpuMat&, GpuMat&) { throw_nogpu(); return 0; }
|
||||
void cv::gpu::reduce(const GpuMat&, GpuMat&, int, int, int, Stream&) { throw_nogpu(); }
|
||||
|
||||
#else
|
||||
#include "opencv2/core/utility.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -55,6 +55,7 @@ cv::gpu::StereoConstantSpaceBP::StereoConstantSpaceBP(int, int, int, int, float,
|
||||
void cv::gpu::StereoConstantSpaceBP::operator()(const GpuMat&, const GpuMat&, GpuMat&, Stream&) { throw_nogpu(); }
|
||||
|
||||
#else /* !defined (HAVE_CUDA) */
|
||||
#include "opencv2/core/utility.hpp"
|
||||
|
||||
namespace cv { namespace gpu { namespace device
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ GPU_TEST_P(MOG, Update)
|
||||
cv::gpu::MOG_GPU mog;
|
||||
cv::gpu::GpuMat foreground = createMat(frame.size(), CV_8UC1, useRoi);
|
||||
|
||||
cv::BackgroundSubtractorMOG mog_gold;
|
||||
cv::Ptr<cv::BackgroundSubtractorMOG> mog_gold = cv::createBackgroundSubtractorMOG();
|
||||
cv::Mat foreground_gold;
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
@ -211,7 +211,7 @@ GPU_TEST_P(MOG, Update)
|
||||
|
||||
mog(loadMat(frame, useRoi), foreground, (float)learningRate);
|
||||
|
||||
mog_gold(frame, foreground_gold, learningRate);
|
||||
mog_gold->apply(frame, foreground_gold, learningRate);
|
||||
|
||||
ASSERT_MAT_NEAR(foreground_gold, foreground, 0.0);
|
||||
}
|
||||
@ -270,7 +270,7 @@ GPU_TEST_P(MOG2, Update)
|
||||
cv::gpu::GpuMat foreground = createMat(frame.size(), CV_8UC1, useRoi);
|
||||
|
||||
cv::Ptr<cv::BackgroundSubtractorMOG2> mog2_gold = cv::createBackgroundSubtractorMOG2();
|
||||
mog2_gold.setDetectShadows(detectShadow);
|
||||
mog2_gold->setDetectShadows(detectShadow);
|
||||
cv::Mat foreground_gold;
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
@ -315,7 +315,7 @@ GPU_TEST_P(MOG2, getBackgroundImage)
|
||||
cv::gpu::GpuMat foreground;
|
||||
|
||||
cv::Ptr<cv::BackgroundSubtractorMOG2> mog2_gold = cv::createBackgroundSubtractorMOG2();
|
||||
mog2_gold.setDetectShadows(detectShadow);
|
||||
mog2_gold->setDetectShadows(detectShadow);
|
||||
cv::Mat foreground_gold;
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
|
@ -24,7 +24,7 @@ using namespace perf;
|
||||
DEF_PARAM_TEST_1(Image, string);
|
||||
|
||||
PERF_TEST_P(Image, GPU_SURF,
|
||||
Values<string>("gpu/perf/aloe.png"))
|
||||
Values<std::string>("gpu/perf/aloe.png"))
|
||||
{
|
||||
declare.time(50.0);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA)
|
||||
#include "opencv2/nonfree/gpu.hpp"
|
||||
#include "opencv2/ts/gpu_perf.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef GTEST_CREATE_SHARED_LIBRARY
|
||||
|
@ -59,7 +59,7 @@
|
||||
#include "opencv2/nonfree/gpu.hpp"
|
||||
|
||||
#if defined(HAVE_CUDA)
|
||||
#include "opencv2/gpu/stream_accessor.hpp"
|
||||
#include "opencv2/core/stream_accessor.hpp"
|
||||
#include "opencv2/gpu/device/common.hpp"
|
||||
|
||||
static inline void throw_nogpu() { CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); }
|
||||
|
@ -21,7 +21,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (cmd.get<bool>("help"))
|
||||
{
|
||||
cmd.printParams();
|
||||
cmd.printMessage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ namespace btv_l1_device
|
||||
|
||||
namespace
|
||||
{
|
||||
void calcRelativeMotions(const vector<pair<GpuMat, GpuMat> >& forwardMotions, const vector<pair<GpuMat, GpuMat> >& backwardMotions,
|
||||
vector<pair<GpuMat, GpuMat> >& relForwardMotions, vector<pair<GpuMat, GpuMat> >& relBackwardMotions,
|
||||
void calcRelativeMotions(const std::vector<std::pair<GpuMat, GpuMat> >& forwardMotions, const std::vector<std::pair<GpuMat, GpuMat> >& backwardMotions,
|
||||
std::vector<std::pair<GpuMat, GpuMat> >& relForwardMotions, std::vector<std::pair<GpuMat, GpuMat> >& relBackwardMotions,
|
||||
int baseIdx, Size size)
|
||||
{
|
||||
const int count = static_cast<int>(forwardMotions.size());
|
||||
@ -115,7 +115,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
void upscaleMotions(const vector<pair<GpuMat, GpuMat> >& lowResMotions, vector<pair<GpuMat, GpuMat> >& highResMotions, int scale)
|
||||
void upscaleMotions(const std::vector<std::pair<GpuMat, GpuMat> >& lowResMotions, std::vector<std::pair<GpuMat, GpuMat> >& highResMotions, int scale)
|
||||
{
|
||||
highResMotions.resize(lowResMotions.size());
|
||||
|
||||
@ -129,8 +129,8 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
void buildMotionMaps(const pair<GpuMat, GpuMat>& forwardMotion, const pair<GpuMat, GpuMat>& backwardMotion,
|
||||
pair<GpuMat, GpuMat>& forwardMap, pair<GpuMat, GpuMat>& backwardMap)
|
||||
void buildMotionMaps(const std::pair<GpuMat, GpuMat>& forwardMotion, const std::pair<GpuMat, GpuMat>& backwardMotion,
|
||||
std::pair<GpuMat, GpuMat>& forwardMap, std::pair<GpuMat, GpuMat>& backwardMap)
|
||||
{
|
||||
forwardMap.first.create(forwardMotion.first.size(), CV_32FC1);
|
||||
forwardMap.second.create(forwardMotion.first.size(), CV_32FC1);
|
||||
@ -169,7 +169,7 @@ namespace
|
||||
btv_l1_device::diffSign(src1.reshape(1), src2.reshape(1), dst.reshape(1), StreamAccessor::getStream(stream));
|
||||
}
|
||||
|
||||
void calcBtvWeights(int btvKernelSize, double alpha, vector<float>& btvWeights)
|
||||
void calcBtvWeights(int btvKernelSize, double alpha, std::vector<float>& btvWeights)
|
||||
{
|
||||
const size_t size = btvKernelSize * btvKernelSize;
|
||||
|
||||
@ -212,8 +212,8 @@ namespace
|
||||
public:
|
||||
BTVL1_GPU_Base();
|
||||
|
||||
void process(const vector<GpuMat>& src, GpuMat& dst,
|
||||
const vector<pair<GpuMat, GpuMat> >& forwardMotions, const vector<pair<GpuMat, GpuMat> >& backwardMotions,
|
||||
void process(const std::vector<GpuMat>& src, GpuMat& dst,
|
||||
const std::vector<std::pair<GpuMat, GpuMat> >& forwardMotions, const std::vector<std::pair<GpuMat, GpuMat> >& backwardMotions,
|
||||
int baseIdx);
|
||||
|
||||
void collectGarbage();
|
||||
@ -230,29 +230,29 @@ namespace
|
||||
Ptr<DenseOpticalFlowExt> opticalFlow_;
|
||||
|
||||
private:
|
||||
vector<Ptr<FilterEngine_GPU> > filters_;
|
||||
std::vector<Ptr<FilterEngine_GPU> > filters_;
|
||||
int curBlurKernelSize_;
|
||||
double curBlurSigma_;
|
||||
int curSrcType_;
|
||||
|
||||
vector<float> btvWeights_;
|
||||
std::vector<float> btvWeights_;
|
||||
int curBtvKernelSize_;
|
||||
double curAlpha_;
|
||||
|
||||
vector<pair<GpuMat, GpuMat> > lowResForwardMotions_;
|
||||
vector<pair<GpuMat, GpuMat> > lowResBackwardMotions_;
|
||||
std::vector<std::pair<GpuMat, GpuMat> > lowResForwardMotions_;
|
||||
std::vector<std::pair<GpuMat, GpuMat> > lowResBackwardMotions_;
|
||||
|
||||
vector<pair<GpuMat, GpuMat> > highResForwardMotions_;
|
||||
vector<pair<GpuMat, GpuMat> > highResBackwardMotions_;
|
||||
std::vector<std::pair<GpuMat, GpuMat> > highResForwardMotions_;
|
||||
std::vector<std::pair<GpuMat, GpuMat> > highResBackwardMotions_;
|
||||
|
||||
vector<pair<GpuMat, GpuMat> > forwardMaps_;
|
||||
vector<pair<GpuMat, GpuMat> > backwardMaps_;
|
||||
std::vector<std::pair<GpuMat, GpuMat> > forwardMaps_;
|
||||
std::vector<std::pair<GpuMat, GpuMat> > backwardMaps_;
|
||||
|
||||
GpuMat highRes_;
|
||||
|
||||
vector<Stream> streams_;
|
||||
vector<GpuMat> diffTerms_;
|
||||
vector<GpuMat> a_, b_, c_;
|
||||
std::vector<Stream> streams_;
|
||||
std::vector<GpuMat> diffTerms_;
|
||||
std::vector<GpuMat> a_, b_, c_;
|
||||
GpuMat regTerm_;
|
||||
};
|
||||
|
||||
@ -276,8 +276,8 @@ namespace
|
||||
curAlpha_ = -1.0;
|
||||
}
|
||||
|
||||
void BTVL1_GPU_Base::process(const vector<GpuMat>& src, GpuMat& dst,
|
||||
const vector<pair<GpuMat, GpuMat> >& forwardMotions, const vector<pair<GpuMat, GpuMat> >& backwardMotions,
|
||||
void BTVL1_GPU_Base::process(const std::vector<GpuMat>& src, GpuMat& dst,
|
||||
const std::vector<std::pair<GpuMat, GpuMat> >& forwardMotions, const std::vector<std::pair<GpuMat, GpuMat> >& backwardMotions,
|
||||
int baseIdx)
|
||||
{
|
||||
CV_Assert( scale_ > 1 );
|
||||
@ -418,18 +418,18 @@ namespace
|
||||
GpuMat curFrame_;
|
||||
GpuMat prevFrame_;
|
||||
|
||||
vector<GpuMat> frames_;
|
||||
vector<pair<GpuMat, GpuMat> > forwardMotions_;
|
||||
vector<pair<GpuMat, GpuMat> > backwardMotions_;
|
||||
vector<GpuMat> outputs_;
|
||||
std::vector<GpuMat> frames_;
|
||||
std::vector<std::pair<GpuMat, GpuMat> > forwardMotions_;
|
||||
std::vector<std::pair<GpuMat, GpuMat> > backwardMotions_;
|
||||
std::vector<GpuMat> outputs_;
|
||||
|
||||
int storePos_;
|
||||
int procPos_;
|
||||
int outPos_;
|
||||
|
||||
vector<GpuMat> srcFrames_;
|
||||
vector<pair<GpuMat, GpuMat> > srcForwardMotions_;
|
||||
vector<pair<GpuMat, GpuMat> > srcBackwardMotions_;
|
||||
std::vector<GpuMat> srcFrames_;
|
||||
std::vector<std::pair<GpuMat, GpuMat> > srcForwardMotions_;
|
||||
std::vector<std::pair<GpuMat, GpuMat> > srcBackwardMotions_;
|
||||
GpuMat finalOutput_;
|
||||
};
|
||||
|
||||
@ -530,8 +530,8 @@ namespace
|
||||
|
||||
if (storePos_ > 0)
|
||||
{
|
||||
pair<GpuMat, GpuMat>& forwardMotion = at(storePos_ - 1, forwardMotions_);
|
||||
pair<GpuMat, GpuMat>& backwardMotion = at(storePos_, backwardMotions_);
|
||||
std::pair<GpuMat, GpuMat>& forwardMotion = at(storePos_ - 1, forwardMotions_);
|
||||
std::pair<GpuMat, GpuMat>& backwardMotion = at(storePos_, backwardMotions_);
|
||||
|
||||
opticalFlow_->calc(prevFrame_, curFrame_, forwardMotion.first, forwardMotion.second);
|
||||
opticalFlow_->calc(curFrame_, prevFrame_, backwardMotion.first, backwardMotion.second);
|
||||
@ -542,9 +542,9 @@ namespace
|
||||
|
||||
void BTVL1_GPU::processFrame(int idx)
|
||||
{
|
||||
const int startIdx = max(idx - temporalAreaRadius_, 0);
|
||||
const int startIdx = std::max(idx - temporalAreaRadius_, 0);
|
||||
const int procIdx = idx;
|
||||
const int endIdx = min(startIdx + 2 * temporalAreaRadius_, storePos_);
|
||||
const int endIdx = std::min(startIdx + 2 * temporalAreaRadius_, storePos_);
|
||||
|
||||
const int count = endIdx - startIdx + 1;
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
#include "opencv2/gpu.hpp"
|
||||
#ifdef HAVE_CUDA
|
||||
#include "opencv2/gpu/stream_accessor.hpp"
|
||||
#include "opencv2/core/stream_accessor.hpp"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user