fix for bug 2264

fix compilation OpenCV with cxx11 under Ubuntu with clang and gcc 4.7
This commit is contained in:
marina.kolpakova 2012-10-08 02:37:22 +04:00
parent 2ec264303e
commit 23699acca0
3 changed files with 30 additions and 22 deletions

View File

@ -85,7 +85,10 @@ namespace
};
size_t colors_mum = sizeof(colors)/sizeof(colors[0]);
#if defined __cplusplus && __cplusplus > 199711L
#else
template<class FwIt, class T> void iota(FwIt first, FwIt last, T value) { while(first != last) *first++ = value++; }
#endif
void computeNormals( const Octree& Octree, const vector<Point3f>& centers, vector<Point3f>& normals,
vector<uchar>& mask, float normalRadius, int minNeighbors = 20)

View File

@ -8,26 +8,17 @@ namespace {
//////////////////////////////////////////////////////////////////////
// StereoBM
typedef pair<string, string> pair_string;
typedef std::tr1::tuple<string, string> pair_string;
DEF_PARAM_TEST_1(ImagePair, pair_string);
static pair_string make_string_pair(const string& a, const string& b)
{
#ifdef _MSC_VER
return pair<string, string>(a, b);
#else
return make_pair<string, string>(a, b);
#endif
}
PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(make_string_pair("gpu/perf/aloe.png", "gpu/perf/aloeR.png")))
PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(pair_string("gpu/perf/aloe.png", "gpu/perf/aloeR.png")))
{
declare.time(5.0);
const cv::Mat imgLeft = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
const cv::Mat imgLeft = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(imgLeft.empty());
const cv::Mat imgRight = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);
const cv::Mat imgRight = readImage(GET_PARAM(1), cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(imgRight.empty());
const int preset = 0;
@ -66,14 +57,14 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(make_string_pair("gpu/perf/aloe.
//////////////////////////////////////////////////////////////////////
// StereoBeliefPropagation
PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(make_string_pair("gpu/stereobp/aloe-L.png", "gpu/stereobp/aloe-R.png")))
PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(pair_string("gpu/stereobp/aloe-L.png", "gpu/stereobp/aloe-R.png")))
{
declare.time(10.0);
const cv::Mat imgLeft = readImage(GetParam().first);
const cv::Mat imgLeft = readImage(GET_PARAM(0));
ASSERT_FALSE(imgLeft.empty());
const cv::Mat imgRight = readImage(GetParam().second);
const cv::Mat imgRight = readImage(GET_PARAM(1));
ASSERT_FALSE(imgRight.empty());
const int ndisp = 64;
@ -102,14 +93,14 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(make_string_pair(
//////////////////////////////////////////////////////////////////////
// StereoConstantSpaceBP
PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(make_string_pair("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-R.png")))
PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(pair_string("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-R.png")))
{
declare.time(10.0);
const cv::Mat imgLeft = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
const cv::Mat imgLeft = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(imgLeft.empty());
const cv::Mat imgRight = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);
const cv::Mat imgRight = readImage(GET_PARAM(1), cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(imgRight.empty());
const int ndisp = 128;
@ -138,12 +129,12 @@ PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(make_string_pair("g
//////////////////////////////////////////////////////////////////////
// DisparityBilateralFilter
PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(make_string_pair("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-disp.png")))
PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(pair_string("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-disp.png")))
{
const cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
const cv::Mat img = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img.empty());
const cv::Mat disp = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);
const cv::Mat disp = readImage(GET_PARAM(1), cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(disp.empty());
const int ndisp = 128;

View File

@ -1654,7 +1654,21 @@ inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
# undef _TR1_FUNCTIONAL // Allows the user to #include
// <tr1/functional> if he chooses to.
# else
# if defined (__cplusplus) && __cplusplus > 199711L
# include <tuple>
namespace std {
namespace tr1 {
using std::tuple;
using std::tuple_element;
using std::get;
using std::tuple_size;
using std::make_tuple;
}
}
# else
# include <tr1/tuple> // NOLINT
# endif
# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
# else