mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
cuda: eliminate part of build warnings
This commit is contained in:
parent
f93c1b942a
commit
7818071ba2
@ -47,6 +47,13 @@
|
||||
# error cuda_types.hpp header must be compiled as C++
|
||||
#endif
|
||||
|
||||
#if defined(__OPENCV_BUILD) && defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
|
||||
#endif
|
||||
#if defined(__OPENCV_BUILD) && defined(__GNUC__) && __GNUC__ >= 5
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
|
||||
/** @file
|
||||
* @deprecated Use @ref cudev instead.
|
||||
*/
|
||||
|
@ -64,7 +64,7 @@ namespace
|
||||
class DefaultThrustAllocator: public cv::cuda::device::ThrustAllocator
|
||||
{
|
||||
public:
|
||||
__device__ __host__ uchar* allocate(size_t numBytes)
|
||||
__device__ __host__ uchar* allocate(size_t numBytes) CV_OVERRIDE
|
||||
{
|
||||
#ifndef __CUDA_ARCH__
|
||||
uchar* ptr;
|
||||
@ -74,7 +74,7 @@ namespace
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
__device__ __host__ void deallocate(uchar* ptr, size_t numBytes)
|
||||
__device__ __host__ void deallocate(uchar* ptr, size_t numBytes) CV_OVERRIDE
|
||||
{
|
||||
(void)numBytes;
|
||||
#ifndef __CUDA_ARCH__
|
||||
@ -105,8 +105,8 @@ namespace
|
||||
class DefaultAllocator : public GpuMat::Allocator
|
||||
{
|
||||
public:
|
||||
bool allocate(GpuMat* mat, int rows, int cols, size_t elemSize);
|
||||
void free(GpuMat* mat);
|
||||
bool allocate(GpuMat* mat, int rows, int cols, size_t elemSize) CV_OVERRIDE;
|
||||
void free(GpuMat* mat) CV_OVERRIDE;
|
||||
};
|
||||
|
||||
bool DefaultAllocator::allocate(GpuMat* mat, int rows, int cols, size_t elemSize)
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
UMatData* allocate(int dims, const int* sizes, int type,
|
||||
void* data0, size_t* step,
|
||||
int /*flags*/, UMatUsageFlags /*usageFlags*/) const
|
||||
int /*flags*/, UMatUsageFlags /*usageFlags*/) const CV_OVERRIDE
|
||||
{
|
||||
size_t total = CV_ELEM_SIZE(type);
|
||||
for (int i = dims-1; i >= 0; i--)
|
||||
@ -100,12 +100,12 @@ public:
|
||||
return u;
|
||||
}
|
||||
|
||||
bool allocate(UMatData* u, int /*accessFlags*/, UMatUsageFlags /*usageFlags*/) const
|
||||
bool allocate(UMatData* u, int /*accessFlags*/, UMatUsageFlags /*usageFlags*/) const CV_OVERRIDE
|
||||
{
|
||||
return (u != NULL);
|
||||
}
|
||||
|
||||
void deallocate(UMatData* u) const
|
||||
void deallocate(UMatData* u) const CV_OVERRIDE
|
||||
{
|
||||
if (!u)
|
||||
return;
|
||||
|
@ -560,8 +560,8 @@ namespace
|
||||
explicit StackAllocator(cudaStream_t stream);
|
||||
~StackAllocator();
|
||||
|
||||
bool allocate(GpuMat* mat, int rows, int cols, size_t elemSize);
|
||||
void free(GpuMat* mat);
|
||||
bool allocate(GpuMat* mat, int rows, int cols, size_t elemSize) CV_OVERRIDE;
|
||||
void free(GpuMat* mat) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
StackAllocator(const StackAllocator&);
|
||||
|
@ -66,7 +66,7 @@ namespace
|
||||
LookUpTableImpl(InputArray lut);
|
||||
~LookUpTableImpl();
|
||||
|
||||
void transform(InputArray src, OutputArray dst, Stream& stream = Stream::Null());
|
||||
void transform(InputArray src, OutputArray dst, Stream& stream = Stream::Null()) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
GpuMat d_lut;
|
||||
|
@ -71,28 +71,28 @@ namespace
|
||||
const float defaultNoiseSigma = 30.0f * 0.5f;
|
||||
const float defaultInitialWeight = 0.05f;
|
||||
|
||||
class MOGImpl : public cuda::BackgroundSubtractorMOG
|
||||
class MOGImpl CV_FINAL : public cuda::BackgroundSubtractorMOG
|
||||
{
|
||||
public:
|
||||
MOGImpl(int history, int nmixtures, double backgroundRatio, double noiseSigma);
|
||||
|
||||
void apply(InputArray image, OutputArray fgmask, double learningRate=-1);
|
||||
void apply(InputArray image, OutputArray fgmask, double learningRate, Stream& stream);
|
||||
void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE;
|
||||
void apply(InputArray image, OutputArray fgmask, double learningRate, Stream& stream) CV_OVERRIDE;
|
||||
|
||||
void getBackgroundImage(OutputArray backgroundImage) const;
|
||||
void getBackgroundImage(OutputArray backgroundImage, Stream& stream) const;
|
||||
void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE;
|
||||
void getBackgroundImage(OutputArray backgroundImage, Stream& stream) const CV_OVERRIDE;
|
||||
|
||||
int getHistory() const { return history_; }
|
||||
void setHistory(int nframes) { history_ = nframes; }
|
||||
int getHistory() const CV_OVERRIDE { return history_; }
|
||||
void setHistory(int nframes) CV_OVERRIDE { history_ = nframes; }
|
||||
|
||||
int getNMixtures() const { return nmixtures_; }
|
||||
void setNMixtures(int nmix) { nmixtures_ = nmix; }
|
||||
int getNMixtures() const CV_OVERRIDE { return nmixtures_; }
|
||||
void setNMixtures(int nmix) CV_OVERRIDE { nmixtures_ = nmix; }
|
||||
|
||||
double getBackgroundRatio() const { return backgroundRatio_; }
|
||||
void setBackgroundRatio(double backgroundRatio) { backgroundRatio_ = (float) backgroundRatio; }
|
||||
double getBackgroundRatio() const CV_OVERRIDE { return backgroundRatio_; }
|
||||
void setBackgroundRatio(double backgroundRatio) CV_OVERRIDE { backgroundRatio_ = (float) backgroundRatio; }
|
||||
|
||||
double getNoiseSigma() const { return noiseSigma_; }
|
||||
void setNoiseSigma(double noiseSigma) { noiseSigma_ = (float) noiseSigma; }
|
||||
double getNoiseSigma() const CV_OVERRIDE { return noiseSigma_; }
|
||||
void setNoiseSigma(double noiseSigma) CV_OVERRIDE { noiseSigma_ = (float) noiseSigma; }
|
||||
|
||||
private:
|
||||
//! re-initiaization method
|
||||
|
@ -78,52 +78,52 @@ namespace
|
||||
const unsigned char defaultShadowValue = 127; // value to use in the segmentation mask for shadows, set 0 not to do shadow detection
|
||||
const float defaultShadowThreshold = 0.5f; // Tau - shadow threshold, see the paper for explanation
|
||||
|
||||
class MOG2Impl : public cuda::BackgroundSubtractorMOG2
|
||||
class MOG2Impl CV_FINAL : public cuda::BackgroundSubtractorMOG2
|
||||
{
|
||||
public:
|
||||
MOG2Impl(int history, double varThreshold, bool detectShadows);
|
||||
|
||||
void apply(InputArray image, OutputArray fgmask, double learningRate=-1);
|
||||
void apply(InputArray image, OutputArray fgmask, double learningRate, Stream& stream);
|
||||
void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE;
|
||||
void apply(InputArray image, OutputArray fgmask, double learningRate, Stream& stream) CV_OVERRIDE;
|
||||
|
||||
void getBackgroundImage(OutputArray backgroundImage) const;
|
||||
void getBackgroundImage(OutputArray backgroundImage, Stream& stream) const;
|
||||
void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE;
|
||||
void getBackgroundImage(OutputArray backgroundImage, Stream& stream) const CV_OVERRIDE;
|
||||
|
||||
int getHistory() const { return history_; }
|
||||
void setHistory(int history) { history_ = history; }
|
||||
int getHistory() const CV_OVERRIDE { return history_; }
|
||||
void setHistory(int history) CV_OVERRIDE { history_ = history; }
|
||||
|
||||
int getNMixtures() const { return nmixtures_; }
|
||||
void setNMixtures(int nmixtures) { nmixtures_ = nmixtures; }
|
||||
int getNMixtures() const CV_OVERRIDE { return nmixtures_; }
|
||||
void setNMixtures(int nmixtures) CV_OVERRIDE { nmixtures_ = nmixtures; }
|
||||
|
||||
double getBackgroundRatio() const { return backgroundRatio_; }
|
||||
void setBackgroundRatio(double ratio) { backgroundRatio_ = (float) ratio; }
|
||||
double getBackgroundRatio() const CV_OVERRIDE { return backgroundRatio_; }
|
||||
void setBackgroundRatio(double ratio) CV_OVERRIDE { backgroundRatio_ = (float) ratio; }
|
||||
|
||||
double getVarThreshold() const { return varThreshold_; }
|
||||
void setVarThreshold(double varThreshold) { varThreshold_ = (float) varThreshold; }
|
||||
double getVarThreshold() const CV_OVERRIDE { return varThreshold_; }
|
||||
void setVarThreshold(double varThreshold) CV_OVERRIDE { varThreshold_ = (float) varThreshold; }
|
||||
|
||||
double getVarThresholdGen() const { return varThresholdGen_; }
|
||||
void setVarThresholdGen(double varThresholdGen) { varThresholdGen_ = (float) varThresholdGen; }
|
||||
double getVarThresholdGen() const CV_OVERRIDE { return varThresholdGen_; }
|
||||
void setVarThresholdGen(double varThresholdGen) CV_OVERRIDE { varThresholdGen_ = (float) varThresholdGen; }
|
||||
|
||||
double getVarInit() const { return varInit_; }
|
||||
void setVarInit(double varInit) { varInit_ = (float) varInit; }
|
||||
double getVarInit() const CV_OVERRIDE { return varInit_; }
|
||||
void setVarInit(double varInit) CV_OVERRIDE { varInit_ = (float) varInit; }
|
||||
|
||||
double getVarMin() const { return varMin_; }
|
||||
void setVarMin(double varMin) { varMin_ = (float) varMin; }
|
||||
double getVarMin() const CV_OVERRIDE { return varMin_; }
|
||||
void setVarMin(double varMin) CV_OVERRIDE { varMin_ = (float) varMin; }
|
||||
|
||||
double getVarMax() const { return varMax_; }
|
||||
void setVarMax(double varMax) { varMax_ = (float) varMax; }
|
||||
double getVarMax() const CV_OVERRIDE { return varMax_; }
|
||||
void setVarMax(double varMax) CV_OVERRIDE { varMax_ = (float) varMax; }
|
||||
|
||||
double getComplexityReductionThreshold() const { return ct_; }
|
||||
void setComplexityReductionThreshold(double ct) { ct_ = (float) ct; }
|
||||
double getComplexityReductionThreshold() const CV_OVERRIDE { return ct_; }
|
||||
void setComplexityReductionThreshold(double ct) CV_OVERRIDE { ct_ = (float) ct; }
|
||||
|
||||
bool getDetectShadows() const { return detectShadows_; }
|
||||
void setDetectShadows(bool detectShadows) { detectShadows_ = detectShadows; }
|
||||
bool getDetectShadows() const CV_OVERRIDE { return detectShadows_; }
|
||||
void setDetectShadows(bool detectShadows) CV_OVERRIDE { detectShadows_ = detectShadows; }
|
||||
|
||||
int getShadowValue() const { return shadowValue_; }
|
||||
void setShadowValue(int value) { shadowValue_ = (uchar) value; }
|
||||
int getShadowValue() const CV_OVERRIDE { return shadowValue_; }
|
||||
void setShadowValue(int value) CV_OVERRIDE { shadowValue_ = (uchar) value; }
|
||||
|
||||
double getShadowThreshold() const { return shadowThreshold_; }
|
||||
void setShadowThreshold(double threshold) { shadowThreshold_ = (float) threshold; }
|
||||
double getShadowThreshold() const CV_OVERRIDE { return shadowThreshold_; }
|
||||
void setShadowThreshold(double threshold) CV_OVERRIDE { shadowThreshold_ = (float) threshold; }
|
||||
|
||||
private:
|
||||
void initialize(Size frameSize, int frameType);
|
||||
|
@ -62,11 +62,11 @@ public:
|
||||
explicit CuvidVideoSource(const String& fname);
|
||||
~CuvidVideoSource();
|
||||
|
||||
FormatInfo format() const;
|
||||
void start();
|
||||
void stop();
|
||||
bool isStarted() const;
|
||||
bool hasError() const;
|
||||
FormatInfo format() const CV_OVERRIDE;
|
||||
void start() CV_OVERRIDE;
|
||||
void stop() CV_OVERRIDE;
|
||||
bool isStarted() const CV_OVERRIDE;
|
||||
bool hasError() const CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
// Callback for handling packages of demuxed video data.
|
||||
|
@ -56,9 +56,9 @@ public:
|
||||
FFmpegVideoSource(const String& fname);
|
||||
~FFmpegVideoSource();
|
||||
|
||||
bool getNextPacket(unsigned char** data, int* size, bool* endOfFile);
|
||||
bool getNextPacket(unsigned char** data, int* size, bool* endOfFile) CV_OVERRIDE;
|
||||
|
||||
FormatInfo format() const;
|
||||
FormatInfo format() const CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
FormatInfo format_;
|
||||
|
@ -65,9 +65,9 @@ namespace
|
||||
explicit VideoReaderImpl(const Ptr<VideoSource>& source);
|
||||
~VideoReaderImpl();
|
||||
|
||||
bool nextFrame(OutputArray frame);
|
||||
bool nextFrame(OutputArray frame) CV_OVERRIDE;
|
||||
|
||||
FormatInfo format() const;
|
||||
FormatInfo format() const CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
Ptr<VideoSource> videoSource_;
|
||||
|
@ -78,11 +78,11 @@ class RawVideoSourceWrapper : public VideoSource
|
||||
public:
|
||||
RawVideoSourceWrapper(const Ptr<RawVideoSource>& source);
|
||||
|
||||
FormatInfo format() const;
|
||||
void start();
|
||||
void stop();
|
||||
bool isStarted() const;
|
||||
bool hasError() const;
|
||||
FormatInfo format() const CV_OVERRIDE;
|
||||
void start() CV_OVERRIDE;
|
||||
void stop() CV_OVERRIDE;
|
||||
bool isStarted() const CV_OVERRIDE;
|
||||
bool hasError() const CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
Ptr<RawVideoSource> source_;
|
||||
|
@ -47,6 +47,13 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
#if defined(__OPENCV_BUILD) && defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
|
||||
#endif
|
||||
#if defined(__OPENCV_BUILD) && defined(__GNUC__) && __GNUC__ >= 5
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
|
||||
#include "opencv2/cudalegacy.hpp"
|
||||
#include "opencv2/core/utility.hpp"
|
||||
|
||||
|
@ -262,7 +262,7 @@ public:
|
||||
|
||||
void find(const std::vector<cv::UMat> &src, const std::vector<cv::Point> &corners,
|
||||
std::vector<cv::UMat> &masks) CV_OVERRIDE;
|
||||
void findInPair(size_t first, size_t second, Rect roi);
|
||||
void findInPair(size_t first, size_t second, Rect roi) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
void setGraphWeightsColor(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &mask1, const cv::Mat &mask2,
|
||||
|
@ -441,8 +441,8 @@ namespace
|
||||
public:
|
||||
explicit GpuOpticalFlow(int work_type);
|
||||
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2) CV_OVERRIDE;
|
||||
void collectGarbage() CV_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2) = 0;
|
||||
@ -510,8 +510,8 @@ namespace
|
||||
{
|
||||
public:
|
||||
Brox_CUDA();
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2) CV_OVERRIDE;
|
||||
void collectGarbage() CV_OVERRIDE;
|
||||
|
||||
inline double getAlpha() const CV_OVERRIDE { return alpha_; }
|
||||
inline void setAlpha(double val) CV_OVERRIDE { alpha_ = val; }
|
||||
@ -527,7 +527,7 @@ namespace
|
||||
inline void setSolverIterations(int val) CV_OVERRIDE { solverIterations_ = val; }
|
||||
|
||||
protected:
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
double alpha_;
|
||||
@ -597,8 +597,8 @@ namespace
|
||||
{
|
||||
public:
|
||||
PyrLK_CUDA();
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2) CV_OVERRIDE;
|
||||
void collectGarbage() CV_OVERRIDE;
|
||||
|
||||
inline int getWindowSize() const CV_OVERRIDE { return winSize_; }
|
||||
inline void setWindowSize(int val) CV_OVERRIDE { winSize_ = val; }
|
||||
@ -608,7 +608,7 @@ namespace
|
||||
inline void setIterations(int val) CV_OVERRIDE { iterations_ = val; }
|
||||
|
||||
protected:
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
int winSize_;
|
||||
@ -669,8 +669,8 @@ namespace
|
||||
{
|
||||
public:
|
||||
Farneback_CUDA();
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2) CV_OVERRIDE;
|
||||
void collectGarbage() CV_OVERRIDE;
|
||||
|
||||
inline double getPyrScale() const CV_OVERRIDE { return pyrScale_; }
|
||||
inline void setPyrScale(double val) CV_OVERRIDE { pyrScale_ = val; }
|
||||
@ -688,7 +688,7 @@ namespace
|
||||
inline void setFlags(int val) CV_OVERRIDE { flags_ = val; }
|
||||
|
||||
protected:
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
double pyrScale_;
|
||||
@ -761,8 +761,8 @@ namespace
|
||||
{
|
||||
public:
|
||||
DualTVL1_CUDA();
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2) CV_OVERRIDE;
|
||||
void collectGarbage() CV_OVERRIDE;
|
||||
|
||||
inline double getTau() const CV_OVERRIDE { return tau_; }
|
||||
inline void setTau(double val) CV_OVERRIDE { tau_ = val; }
|
||||
@ -782,7 +782,7 @@ namespace
|
||||
inline void setUseInitialFlow(bool val) CV_OVERRIDE { useInitialFlow_ = val; }
|
||||
|
||||
protected:
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
double tau_;
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
|
||||
virtual void run(
|
||||
InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY,
|
||||
OutputArray errors);
|
||||
OutputArray errors) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
Ptr<cuda::DensePyrLKOpticalFlow> optFlowEstimator_;
|
||||
|
@ -124,7 +124,7 @@ class CV_EXPORTS MoreAccurateMotionWobbleSuppressorGpu : public MoreAccurateMoti
|
||||
{
|
||||
public:
|
||||
void suppress(int idx, const cuda::GpuMat &frame, cuda::GpuMat &result);
|
||||
virtual void suppress(int idx, const Mat &frame, Mat &result);
|
||||
virtual void suppress(int idx, const Mat &frame, Mat &result) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
cuda::GpuMat frameDevice_, resultDevice_;
|
||||
|
@ -30,6 +30,9 @@ if(NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND)
|
||||
endif()
|
||||
|
||||
project(gpu_samples)
|
||||
if(COMMAND ocv_warnings_disable)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wsuggest-override -Winconsistent-missing-override)
|
||||
endif()
|
||||
ocv_include_modules_recurse(${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})
|
||||
if(HAVE_opencv_xfeatures2d)
|
||||
ocv_include_modules_recurse(opencv_xfeatures2d)
|
||||
|
@ -16,6 +16,9 @@
|
||||
#include "opencv2/cudalegacy.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
|
||||
#include "opencv2/core/core_c.h" // FIXIT legacy API
|
||||
#include "opencv2/highgui/highgui_c.h" // FIXIT legacy API
|
||||
|
||||
#if !defined(HAVE_CUDA)
|
||||
int main( int, const char** )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user