1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Fix build with STLPort from NDK r8d

This commit is contained in:
Andrey Kamaev
2012-12-21 19:58:51 +04:00
parent ffdbddd6b1
commit 9944282b09
18 changed files with 47 additions and 33 deletions
+12 -11
View File
@@ -3,6 +3,7 @@
#include <sys/stat.h>
#include <dirent.h>
#include <android/log.h>
#include <cctype>
#include <string>
#include <vector>
#include <algorithm>
@@ -303,8 +304,8 @@ std::string CameraWrapperConnector::getPathLibFolder()
LOGD("Library name: %s", dl_info.dli_fname);
LOGD("Library base address: %p", dl_info.dli_fbase);
const char* libName=dl_info.dli_fname;
while( ((*libName)=='/') || ((*libName)=='.') )
const char* libName=dl_info.dli_fname;
while( ((*libName)=='/') || ((*libName)=='.') )
libName++;
char lineBuf[2048];
@@ -312,9 +313,9 @@ std::string CameraWrapperConnector::getPathLibFolder()
if(file)
{
while (fgets(lineBuf, sizeof lineBuf, file) != NULL)
{
//verify that line ends with library name
while (fgets(lineBuf, sizeof lineBuf, file) != NULL)
{
//verify that line ends with library name
int lineLength = strlen(lineBuf);
int libNameLength = strlen(libName);
@@ -327,7 +328,7 @@ std::string CameraWrapperConnector::getPathLibFolder()
if (0 != strncmp(lineBuf + lineLength - libNameLength, libName, libNameLength))
{
//the line does not contain the library name
//the line does not contain the library name
continue;
}
@@ -346,18 +347,18 @@ std::string CameraWrapperConnector::getPathLibFolder()
fclose(file);
return pathBegin;
}
fclose(file);
LOGE("Could not find library path");
}
fclose(file);
LOGE("Could not find library path");
}
else
{
LOGE("Could not read /proc/self/smaps");
LOGE("Could not read /proc/self/smaps");
}
}
else
{
LOGE("Could not get library name and base address");
LOGE("Could not get library name and base address");
}
return string();
+2 -2
View File
@@ -767,8 +767,8 @@ void ChamferMatcher::Matching::findContourOrientations(const template_coords_t&
}
// get the middle two angles
nth_element(angles.begin(), angles.begin()+M-1, angles.end());
nth_element(angles.begin()+M-1, angles.begin()+M, angles.end());
std::nth_element(angles.begin(), angles.begin()+M-1, angles.end());
std::nth_element(angles.begin()+M-1, angles.begin()+M, angles.end());
// sort(angles.begin(), angles.end());
// average them to compute tangent
+1 -1
View File
@@ -85,7 +85,7 @@ namespace
};
size_t colors_mum = sizeof(colors)/sizeof(colors[0]);
#if defined __cplusplus && __cplusplus > 199711L
#if (defined __cplusplus && __cplusplus > 199711L) || defined _STLPORT_MAJOR
#else
template<class FwIt, class T> void iota(FwIt first, FwIt last, T value) { while(first != last) *first++ = value++; }
#endif
+1 -1
View File
@@ -4655,7 +4655,7 @@ class CV_EXPORTS CommandLineParser
template<typename _Tp>
static _Tp getData(const std::string& str)
{
_Tp res;
_Tp res = _Tp();
std::stringstream s1(str);
s1 >> res;
return res;
@@ -65,7 +65,8 @@
#elif __GNUC__*10 + __GNUC_MINOR__ >= 42
#if !(defined WIN32 || defined _WIN32) && (defined __i486__ || defined __i586__ || \
defined __i686__ || defined __MMX__ || defined __SSE__ || defined __ppc__)
defined __i686__ || defined __MMX__ || defined __SSE__ || defined __ppc__) || \
(defined __GNUC__ && defined _STLPORT_MAJOR)
#define CV_XADD __sync_fetch_and_add
#else
#include <ext/atomicity.h>
+3 -3
View File
@@ -232,7 +232,7 @@ void KeyPointsFilter::runByImageBorder( vector<KeyPoint>& keypoints, Size imageS
if (imageSize.height <= borderSize * 2 || imageSize.width <= borderSize * 2)
keypoints.clear();
else
keypoints.erase( remove_if(keypoints.begin(), keypoints.end(),
keypoints.erase( std::remove_if(keypoints.begin(), keypoints.end(),
RoiPredicate(Rect(Point(borderSize, borderSize),
Point(imageSize.width - borderSize, imageSize.height - borderSize)))),
keypoints.end() );
@@ -259,7 +259,7 @@ void KeyPointsFilter::runByKeypointSize( vector<KeyPoint>& keypoints, float minS
CV_Assert( maxSize >= 0);
CV_Assert( minSize <= maxSize );
keypoints.erase( remove_if(keypoints.begin(), keypoints.end(), SizePredicate(minSize, maxSize)),
keypoints.erase( std::remove_if(keypoints.begin(), keypoints.end(), SizePredicate(minSize, maxSize)),
keypoints.end() );
}
@@ -282,7 +282,7 @@ void KeyPointsFilter::runByPixelsMask( vector<KeyPoint>& keypoints, const Mat& m
if( mask.empty() )
return;
keypoints.erase(remove_if(keypoints.begin(), keypoints.end(), MaskPredicate(mask)), keypoints.end());
keypoints.erase(std::remove_if(keypoints.begin(), keypoints.end(), MaskPredicate(mask)), keypoints.end());
}
struct KeyPoint_LessThan
+3 -3
View File
@@ -77,7 +77,7 @@ DescriptorMatcher::DescriptorCollection::DescriptorCollection()
DescriptorMatcher::DescriptorCollection::DescriptorCollection( const DescriptorCollection& collection )
{
mergedDescriptors = collection.mergedDescriptors.clone();
copy( collection.startIdxs.begin(), collection.startIdxs.begin(), startIdxs.begin() );
std::copy( collection.startIdxs.begin(), collection.startIdxs.begin(), startIdxs.begin() );
}
DescriptorMatcher::DescriptorCollection::~DescriptorCollection()
@@ -807,9 +807,9 @@ GenericDescriptorMatcher::KeyPointCollection::KeyPointCollection( const KeyPoint
keypoints.resize( collection.keypoints.size() );
for( size_t i = 0; i < keypoints.size(); i++ )
copy( collection.keypoints[i].begin(), collection.keypoints[i].end(), keypoints[i].begin() );
std::copy( collection.keypoints[i].begin(), collection.keypoints[i].end(), keypoints[i].begin() );
copy( collection.startIndices.begin(), collection.startIndices.end(), startIndices.begin() );
std::copy( collection.startIndices.begin(), collection.startIndices.end(), startIndices.begin() );
}
void GenericDescriptorMatcher::KeyPointCollection::add( const vector<Mat>& _images,
+2
View File
@@ -52,6 +52,8 @@
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/core/internal.hpp"
#include <algorithm>
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/features2d/features2d_tegra.hpp"
#endif
+1 -1
View File
@@ -122,7 +122,7 @@ void estimateFocal(const vector<ImageFeatures> &features, const vector<MatchesIn
{
double median;
sort(all_focals.begin(), all_focals.end());
std::sort(all_focals.begin(), all_focals.end());
if (all_focals.size() % 2 == 1)
median = all_focals[all_focals.size() / 2];
else
+1 -1
View File
@@ -468,7 +468,7 @@ void Stitcher::estimateCameraParams()
focals.push_back(cameras_[i].focal);
}
sort(focals.begin(), focals.end());
std::sort(focals.begin(), focals.end());
if (focals.size() % 2 == 1)
warped_image_scale_ = static_cast<float>(focals[focals.size() / 2]);
else
+8 -3
View File
@@ -564,7 +564,7 @@
# define GTEST_HAS_RTTI 0
# else
# define GTEST_HAS_RTTI 1
# endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
# endif // GTEST_OS_LINUX_ANDROID && _STLPORT_MAJOR && !__EXCEPTIONS
# else
# define GTEST_HAS_RTTI 0
# endif // __GXX_RTTI
@@ -650,8 +650,11 @@
// support TR1 tuple. libc++ only provides std::tuple, in C++11 mode,
// and it can be used with some compilers that define __GNUC__.
# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
&& !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
&& !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) && !defined(_STLPORT_MAJOR) \
|| (defined(_MSC_VER) && _MSC_VER >= 1600)
# define GTEST_ENV_HAS_TR1_TUPLE_ 1
# else
# define GTEST_ENV_HAS_TR1_TUPLE_ 0
# endif
// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
@@ -659,7 +662,7 @@
// can build with clang but need to use gcc4.2's libstdc++).
# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
# define GTEST_ENV_HAS_STD_TUPLE_ 1
#else
# else
# define GTEST_ENV_HAS_STD_TUPLE_ 0
# endif
@@ -667,6 +670,8 @@
# define GTEST_USE_OWN_TR1_TUPLE 0
# else
# define GTEST_USE_OWN_TR1_TUPLE 1
# undef GTEST_HAS_TR1_TUPLE
# define GTEST_HAS_TR1_TUPLE 1
# endif
#endif // GTEST_USE_OWN_TR1_TUPLE
+1 -1
View File
@@ -172,7 +172,7 @@ void ConsistentMosaicInpainter::inpaint(int idx, Mat &frame, Mat &mask)
if (var < stdevThresh_ * stdevThresh_)
{
sort(pixels.begin(), pixels.begin() + n);
std::sort(pixels.begin(), pixels.begin() + n);
int nh = (n-1)/2;
int c1 = pixels[nh].color.x;
int c2 = pixels[nh].color.y;