Fix MSVC build issues
This commit is contained in:
parent
2b1ef95415
commit
71e43852ce
@ -47,6 +47,15 @@
|
|||||||
#include "opencv2/core/types_c.h"
|
#include "opencv2/core/types_c.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
/* disable warning C4190: 'function' has C-linkage specified, but returns UDT 'typename'
|
||||||
|
which is incompatible with C
|
||||||
|
|
||||||
|
It is OK to disable it because we only extend few plain structures with
|
||||||
|
C++ construrtors for simpler interoperability with C++ API of the library
|
||||||
|
*/
|
||||||
|
# pragma warning(disable:4190)
|
||||||
|
#endif
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -257,10 +257,10 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
Utility methods
|
Utility methods
|
||||||
*/
|
*/
|
||||||
template<typename _Tp, int m> double determinant(const Matx<_Tp, m, m>& a);
|
template<typename _Tp, int m> static double determinant(const Matx<_Tp, m, m>& a);
|
||||||
template<typename _Tp, int m, int n> double trace(const Matx<_Tp, m, n>& a);
|
template<typename _Tp, int m, int n> static double trace(const Matx<_Tp, m, n>& a);
|
||||||
template<typename _Tp, int m, int n> double norm(const Matx<_Tp, m, n>& M);
|
template<typename _Tp, int m, int n> static double norm(const Matx<_Tp, m, n>& M);
|
||||||
template<typename _Tp, int m, int n> double norm(const Matx<_Tp, m, n>& M, int normType);
|
template<typename _Tp, int m, int n> static double norm(const Matx<_Tp, m, n>& M, int normType);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
Utility methods
|
Utility methods
|
||||||
*/
|
*/
|
||||||
template<typename _Tp, int cn> Vec<_Tp, cn> normalize(const Vec<_Tp, cn>& v);
|
template<typename _Tp, int cn> static Vec<_Tp, cn> normalize(const Vec<_Tp, cn>& v);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ public:
|
|||||||
typedef _Tp channel_type;
|
typedef _Tp channel_type;
|
||||||
|
|
||||||
enum { generic_type = 0,
|
enum { generic_type = 0,
|
||||||
depth = DataType<channel_type>::value,
|
depth = DataType<channel_type>::depth,
|
||||||
channels = 4,
|
channels = 4,
|
||||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||||
type = CV_MAKETYPE(depth, channels)
|
type = CV_MAKETYPE(depth, channels)
|
||||||
|
@ -267,7 +267,7 @@ CV_INLINE double cvRandReal( CvRNG* rng )
|
|||||||
#define IPL_BORDER_REFLECT 2
|
#define IPL_BORDER_REFLECT 2
|
||||||
#define IPL_BORDER_WRAP 3
|
#define IPL_BORDER_WRAP 3
|
||||||
|
|
||||||
typedef struct _IplImage
|
typedef struct CV_EXPORTS _IplImage
|
||||||
{
|
{
|
||||||
int nSize; /* sizeof(IplImage) */
|
int nSize; /* sizeof(IplImage) */
|
||||||
int ID; /* version (=0)*/
|
int ID; /* version (=0)*/
|
||||||
@ -558,7 +558,7 @@ CV_INLINE int cvIplDepth( int type )
|
|||||||
#define CV_MAX_DIM 32
|
#define CV_MAX_DIM 32
|
||||||
#define CV_MAX_DIM_HEAP 1024
|
#define CV_MAX_DIM_HEAP 1024
|
||||||
|
|
||||||
typedef struct CvMatND
|
typedef struct CV_EXPORTS CvMatND
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
int dims;
|
int dims;
|
||||||
@ -626,7 +626,7 @@ typedef struct CV_EXPORTS CvSparseMat
|
|||||||
CvSparseMat;
|
CvSparseMat;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
CvSparseMat* cvCreateSparseMat(const cv::SparseMat& m);
|
CV_EXPORTS CvSparseMat* cvCreateSparseMat(const cv::SparseMat& m);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CV_IS_SPARSE_MAT_HDR(mat) \
|
#define CV_IS_SPARSE_MAT_HDR(mat) \
|
||||||
|
@ -931,10 +931,10 @@ CvSeq *cv::ocl::OclCascadeClassifier::oclHaarDetectObjects( oclMat &gimg, CvMemS
|
|||||||
std::vector<float> scalev;
|
std::vector<float> scalev;
|
||||||
for(factor = 1.f;; factor *= scaleFactor)
|
for(factor = 1.f;; factor *= scaleFactor)
|
||||||
{
|
{
|
||||||
CvSize winSize = { cvRound(winSize0.width * factor), cvRound(winSize0.height * factor) };
|
CvSize winSize( cvRound(winSize0.width * factor), cvRound(winSize0.height * factor) );
|
||||||
sz.width = cvRound( gimg.cols / factor ) + 1;
|
sz.width = cvRound( gimg.cols / factor ) + 1;
|
||||||
sz.height = cvRound( gimg.rows / factor ) + 1;
|
sz.height = cvRound( gimg.rows / factor ) + 1;
|
||||||
CvSize sz1 = { sz.width - winSize0.width - 1, sz.height - winSize0.height - 1 };
|
CvSize sz1( sz.width - winSize0.width - 1, sz.height - winSize0.height - 1 );
|
||||||
|
|
||||||
if( sz1.width <= 0 || sz1.height <= 0 )
|
if( sz1.width <= 0 || sz1.height <= 0 )
|
||||||
break;
|
break;
|
||||||
@ -1158,9 +1158,7 @@ CvSeq *cv::ocl::OclCascadeClassifier::oclHaarDetectObjects( oclMat &gimg, CvMemS
|
|||||||
cvRound(factor * winsize0.height) < gimg.rows - 10;
|
cvRound(factor * winsize0.height) < gimg.rows - 10;
|
||||||
n_factors++, factor *= scaleFactor )
|
n_factors++, factor *= scaleFactor )
|
||||||
{
|
{
|
||||||
CvSize winSize = { cvRound( winsize0.width * factor ),
|
CvSize winSize( cvRound( winsize0.width * factor ), cvRound( winsize0.height * factor ) );
|
||||||
cvRound( winsize0.height * factor )
|
|
||||||
};
|
|
||||||
if( winSize.width < minSize.width || winSize.height < minSize.height )
|
if( winSize.width < minSize.width || winSize.height < minSize.height )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -1320,7 +1318,7 @@ CvSeq *cv::ocl::OclCascadeClassifier::oclHaarDetectObjects( oclMat &gimg, CvMemS
|
|||||||
|
|
||||||
if( findBiggestObject && rectList.size() )
|
if( findBiggestObject && rectList.size() )
|
||||||
{
|
{
|
||||||
CvAvgComp result_comp = {{0, 0, 0, 0}, 0};
|
CvAvgComp result_comp = {CvRect(), 0};
|
||||||
|
|
||||||
for( size_t i = 0; i < rectList.size(); i++ )
|
for( size_t i = 0; i < rectList.size(); i++ )
|
||||||
{
|
{
|
||||||
|
@ -927,7 +927,7 @@ void cv::ocl::oclMat::createEx(int _rows, int _cols, int _type, DevMemRW rw_type
|
|||||||
{
|
{
|
||||||
clCxt = Context::getContext();
|
clCxt = Context::getContext();
|
||||||
/* core logic */
|
/* core logic */
|
||||||
_type &= TYPE_MASK;
|
_type &= Mat::TYPE_MASK;
|
||||||
//download_channels = CV_MAT_CN(_type);
|
//download_channels = CV_MAT_CN(_type);
|
||||||
//if(download_channels==3)
|
//if(download_channels==3)
|
||||||
//{
|
//{
|
||||||
|
@ -265,7 +265,7 @@ static void ocl_cvMoments( const void* array, CvMoments* mom, int binary )
|
|||||||
if( size.width <= 0 || size.height <= 0 )
|
if( size.width <= 0 || size.height <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cv::Mat src0(mat);
|
cv::Mat src0 = cv::cvarrToMat(mat);
|
||||||
cv::ocl::oclMat src(src0);
|
cv::ocl::oclMat src(src0);
|
||||||
cv::Size tileSize;
|
cv::Size tileSize;
|
||||||
int blockx,blocky;
|
int blockx,blocky;
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
#ifndef __OPENCV_TS_PERF_HPP__
|
#ifndef __OPENCV_TS_PERF_HPP__
|
||||||
#define __OPENCV_TS_PERF_HPP__
|
#define __OPENCV_TS_PERF_HPP__
|
||||||
|
|
||||||
|
#ifdef HAVE_CVCONFIG_H
|
||||||
|
# include "cvconfig.h"
|
||||||
|
#endif
|
||||||
|
#ifndef GTEST_CREATE_SHARED_LIBRARY
|
||||||
|
# ifdef BUILD_SHARED_LIBS
|
||||||
|
# define GTEST_LINKED_AS_SHARED_LIBRARY 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "opencv2/core.hpp"
|
#include "opencv2/core.hpp"
|
||||||
#include "ts_gtest.h"
|
#include "ts_gtest.h"
|
||||||
|
|
||||||
#ifdef HAVE_TBB
|
|
||||||
#include "tbb/task_scheduler_init.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !(defined(LOGD) || defined(LOGI) || defined(LOGW) || defined(LOGE))
|
#if !(defined(LOGD) || defined(LOGI) || defined(LOGW) || defined(LOGE))
|
||||||
# if defined(ANDROID) && defined(USE_ANDROID_LOGGING)
|
# if defined(ANDROID) && defined(USE_ANDROID_LOGGING)
|
||||||
# include <android/log.h>
|
# include <android/log.h>
|
||||||
|
@ -47,7 +47,6 @@ static Ptr<DenseOpticalFlowExt> createOptFlow(const string& name, bool useGpu)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
cerr << "Incorrect Optical Flow algorithm - " << name << endl;
|
cerr << "Incorrect Optical Flow algorithm - " << name << endl;
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ptr<DenseOpticalFlowExt>();
|
return Ptr<DenseOpticalFlowExt>();
|
||||||
@ -90,7 +89,11 @@ int main(int argc, const char* argv[])
|
|||||||
superRes->set("scale", scale);
|
superRes->set("scale", scale);
|
||||||
superRes->set("iterations", iterations);
|
superRes->set("iterations", iterations);
|
||||||
superRes->set("temporalAreaRadius", temporalAreaRadius);
|
superRes->set("temporalAreaRadius", temporalAreaRadius);
|
||||||
superRes->set("opticalFlow", createOptFlow(optFlow, useGpu));
|
|
||||||
|
Ptr<DenseOpticalFlowExt> of = createOptFlow(optFlow, useGpu);
|
||||||
|
if (of.empty())
|
||||||
|
exit(-1);
|
||||||
|
superRes->set("opticalFlow", of);
|
||||||
|
|
||||||
Ptr<FrameSource> frameSource;
|
Ptr<FrameSource> frameSource;
|
||||||
if (useGpu)
|
if (useGpu)
|
||||||
|
@ -114,7 +114,7 @@ int main( int argc, const char** argv )
|
|||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
IplImage* iplImg = cvQueryFrame( capture );
|
IplImage* iplImg = cvQueryFrame( capture );
|
||||||
frame = iplImg;
|
frame = cv::cvarrToMat(iplImg);
|
||||||
if( frame.empty() )
|
if( frame.empty() )
|
||||||
break;
|
break;
|
||||||
if( iplImg->origin == IPL_ORIGIN_TL )
|
if( iplImg->origin == IPL_ORIGIN_TL )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user