Merge branch 'master' of git://code.opencv.org/opencv

pull/7/head
yao 13 years ago
commit 7741d585f5
  1. 1
      3rdparty/tbb/.gitignore
  2. 43
      android/android.toolchain.cmake
  3. 5
      modules/contrib/src/stereovar.cpp
  4. 25
      modules/features2d/src/fast.cpp
  5. 28
      modules/imgproc/src/smooth.cpp
  6. 20
      modules/ts/misc/run.py
  7. 3
      modules/video/src/bgfg_gmg.cpp

@ -0,0 +1 @@
tbb*.tgz

@ -4,7 +4,7 @@
# See home page: http://code.google.com/p/android-cmake/ # See home page: http://code.google.com/p/android-cmake/
# #
# The file is mantained by the OpenCV project. And also can be found at # The file is mantained by the OpenCV project. And also can be found at
# http://code.opencv.org/svn/opencv/trunk/opencv/android/android.toolchain.cmake # http://code.opencv.org/projects/opencv/repository/revisions/master/changes/android/android.toolchain.cmake
# #
# Usage Linux: # Usage Linux:
# $ export ANDROID_NDK=/absolute/path/to/the/android-ndk # $ export ANDROID_NDK=/absolute/path/to/the/android-ndk
@ -182,6 +182,7 @@
# [+] added mips architecture support # [+] added mips architecture support
# - modified August 2012 # - modified August 2012
# [+] updated for NDK r8b # [+] updated for NDK r8b
# [~] all intermediate files generated by toolchain are moved into CMakeFiles
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
cmake_minimum_required( VERSION 2.6.3 ) cmake_minimum_required( VERSION 2.6.3 )
@ -854,45 +855,48 @@ elseif( X86 )
endif() endif()
#linker flags #linker flags
list( APPEND ANDROID_SYSTEM_LIB_DIRS "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}" "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" ) if( NOT DEFINED __ndklibspath )
set( __ndklibspath "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/ndklibs/${ANDROID_NDK_ABI_NAME}" )
endif()
list( APPEND ANDROID_SYSTEM_LIB_DIRS "${__ndklibspath}" "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" )
set( ANDROID_LINKER_FLAGS "" ) set( ANDROID_LINKER_FLAGS "" )
#STL #STL
if( ANDROID_USE_STLPORT ) if( ANDROID_USE_STLPORT )
if( EXISTS "${__stlLibPath}/libstlport_static.a" ) if( EXISTS "${__stlLibPath}/libstlport_static.a" )
__COPY_IF_DIFFERENT( "${__stlLibPath}/libstlport_static.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libstlport_static.a" ) __COPY_IF_DIFFERENT( "${__stlLibPath}/libstlport_static.a" "${__ndklibspath}/libstlport_static.a" )
endif() endif()
if( EXISTS "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libstlport_static.a" ) if( EXISTS "${__ndklibspath}/libstlport_static.a" )
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--start-group -lstlport_static" ) set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--start-group -lstlport_static" )
endif() endif()
else( ANDROID_USE_STLPORT ) else( ANDROID_USE_STLPORT )
if( EXISTS "${__stlLibPath}/libgnustl_static.a" ) if( EXISTS "${__stlLibPath}/libgnustl_static.a" )
__COPY_IF_DIFFERENT( "${__stlLibPath}/libgnustl_static.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libstdc++.a" ) __COPY_IF_DIFFERENT( "${__stlLibPath}/libgnustl_static.a" "${__ndklibspath}/libstdc++.a" )
elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/thumb/libstdc++.a" ) elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/thumb/libstdc++.a" )
__COPY_IF_DIFFERENT( "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/thumb/libstdc++.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libstdc++.a" ) __COPY_IF_DIFFERENT( "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/thumb/libstdc++.a" "${__ndklibspath}/libstdc++.a" )
elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/libstdc++.a" ) elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/libstdc++.a" )
__COPY_IF_DIFFERENT( "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/libstdc++.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libstdc++.a" ) __COPY_IF_DIFFERENT( "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/libstdc++.a" "${__ndklibspath}/libstdc++.a" )
elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${__stlLibPath}/thumb/libstdc++.a" ) elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${__stlLibPath}/thumb/libstdc++.a" )
__COPY_IF_DIFFERENT( "${__stlLibPath}/thumb/libstdc++.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libstdc++.a" ) __COPY_IF_DIFFERENT( "${__stlLibPath}/thumb/libstdc++.a" "${__ndklibspath}/libstdc++.a" )
elseif( EXISTS "${__stlLibPath}/libstdc++.a" ) elseif( EXISTS "${__stlLibPath}/libstdc++.a" )
__COPY_IF_DIFFERENT( "${__stlLibPath}/libstdc++.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libstdc++.a" ) __COPY_IF_DIFFERENT( "${__stlLibPath}/libstdc++.a" "${__ndklibspath}/libstdc++.a" )
endif() endif()
if( EXISTS "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libstdc++.a" ) if( EXISTS "${__ndklibspath}/libstdc++.a" )
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -lstdc++" ) set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -lstdc++" )
endif() endif()
#gcc exception & rtti support #gcc exception & rtti support
if( EXISTS "${__stlLibPath}/libsupc++.a" ) if( EXISTS "${__stlLibPath}/libsupc++.a" )
__COPY_IF_DIFFERENT( "${__stlLibPath}/libsupc++.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" ) __COPY_IF_DIFFERENT( "${__stlLibPath}/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libsupc++.a" ) elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libsupc++.a" )
__COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libsupc++.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" ) __COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libsupc++.a" ) elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libsupc++.a" )
__COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libsupc++.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" ) __COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libsupc++.a" ) elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libsupc++.a" )
__COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libsupc++.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" ) __COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
elseif( EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" ) elseif( EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" )
__COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" ) __COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
endif() endif()
if( EXISTS "${CMAKE_BINARY_DIR}/systemlibs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" ) if( EXISTS "${__ndklibspath}/libsupc++.a" )
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -lsupc++" ) set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -lsupc++" )
endif() endif()
endif( ANDROID_USE_STLPORT ) endif( ANDROID_USE_STLPORT )
@ -1038,13 +1042,14 @@ endmacro()
# export toolchain settings for the try_compile() command # export toolchain settings for the try_compile() command
if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" ) if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" )
set( __toolchain_config "") set( __toolchain_config "")
foreach( __var ANDROID_ABI ANDROID_FORCE_ARM_BUILD ANDROID_NATIVE_API_LEVEL ANDROID_NO_UNDEFINED ANDROID_SO_UNDEFINED ANDROID_SET_OBSOLETE_VARIABLES LIBRARY_OUTPUT_PATH_ROOT ANDROID_USE_STLPORT ANDROID_FORBID_SYGWIN ANDROID_NDK ANDROID_STANDALONE_TOOLCHAIN ANDROID_FUNCTION_LEVEL_LINKING ) foreach( __var ANDROID_ABI ANDROID_FORCE_ARM_BUILD ANDROID_NATIVE_API_LEVEL ANDROID_NO_UNDEFINED ANDROID_SO_UNDEFINED ANDROID_SET_OBSOLETE_VARIABLES LIBRARY_OUTPUT_PATH_ROOT ANDROID_USE_STLPORT ANDROID_FORBID_SYGWIN ANDROID_NDK ANDROID_STANDALONE_TOOLCHAIN ANDROID_FUNCTION_LEVEL_LINKING __ndklibspath )
if( DEFINED ${__var} ) if( DEFINED ${__var} )
set( __toolchain_config "${__toolchain_config}set( ${__var} \"${${__var}}\" )\n" ) set( __toolchain_config "${__toolchain_config}set( ${__var} \"${${__var}}\" )\n" )
endif() endif()
endforeach() endforeach()
file( WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/android.toolchain.config.cmake" "${__toolchain_config}" ) file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/android.toolchain.config.cmake" "${__toolchain_config}" )
unset( __toolchain_config ) unset( __toolchain_config )
unset( __ndklibspath )
endif() endif()
@ -1073,6 +1078,7 @@ endif()
# Can be set only at the first run: # Can be set only at the first run:
# ANDROID_NDK # ANDROID_NDK
# ANDROID_STANDALONE_TOOLCHAIN # ANDROID_STANDALONE_TOOLCHAIN
# ANDROID_TOOLCHAIN_NAME : "arm-linux-androideabi-4.4.3" or "arm-linux-androideabi-4.6" or "mipsel-linux-android-4.4.3" or "mipsel-linux-android-4.6" or "x86-4.4.3" or "x86-4.6"
# Obsolete: # Obsolete:
# ANDROID_API_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL # ANDROID_API_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL
# ARM_TARGET : superseded by ANDROID_ABI # ARM_TARGET : superseded by ANDROID_ABI
@ -1105,7 +1111,6 @@ endif()
# ANDROID_COMPILER_VERSION : GCC version used # ANDROID_COMPILER_VERSION : GCC version used
# ANDROID_CXX_FLAGS : C/C++ compiler flags required by Android platform # ANDROID_CXX_FLAGS : C/C++ compiler flags required by Android platform
# ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI # ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI
# ANDROID_TOOLCHAIN_NAME : "standalone", "arm-linux-androideabi-4.4.3" or "x86-4.4.3" or something similar.
# ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux" # ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux"
# ANDROID_TOOLCHAIN_ROOT : path to the top level of toolchain (standalone or placed inside NDK) # ANDROID_TOOLCHAIN_ROOT : path to the top level of toolchain (standalone or placed inside NDK)
# ANDROID_SUPPORTED_NATIVE_API_LEVELS : list of native API levels found inside NDK # ANDROID_SUPPORTED_NATIVE_API_LEVELS : list of native API levels found inside NDK

@ -67,11 +67,12 @@ StereoVar::~StereoVar()
static Mat diffX(Mat &src) static Mat diffX(Mat &src)
{ {
register int x, y, cols = src.cols - 1; int cols = src.cols - 1;
Mat dst(src.size(), src.type()); Mat dst(src.size(), src.type());
for(y = 0; y < src.rows; y++){ for(int y = 0; y < src.rows; y++){
const float* pSrc = src.ptr<float>(y); const float* pSrc = src.ptr<float>(y);
float* pDst = dst.ptr<float>(y); float* pDst = dst.ptr<float>(y);
int x = 0;
#if CV_SSE2 #if CV_SSE2
for (x = 0; x <= cols - 8; x += 8) { for (x = 0; x <= cols - 8; x += 8) {
__m128 a0 = _mm_loadu_ps(pSrc + x); __m128 a0 = _mm_loadu_ps(pSrc + x);

@ -9,16 +9,16 @@ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
are met: are met:
*Redistributions of source code must retain the above copyright *Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. notice, this list of conditions and the following disclaimer.
*Redistributions in binary form must reproduce the above copyright *Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
*Neither the name of the University of Cambridge nor the names of *Neither the name of the University of Cambridge nor the names of
its contributors may be used to endorse or promote products derived its contributors may be used to endorse or promote products derived
from this software without specific prior written permission. from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@ -350,7 +350,7 @@ int cornerScore<8>(const uchar* ptr, const int pixel[], int threshold)
} }
int b0 = -a0; int b0 = -a0;
for( k = 0; k < 12; k += 2 ) for( k = 0; k < 8; k += 2 )
{ {
int b = std::max((int)d[k+1], (int)d[k+2]); int b = std::max((int)d[k+1], (int)d[k+2]);
b = std::max(b, (int)d[k+3]); b = std::max(b, (int)d[k+3]);
@ -375,7 +375,10 @@ template<int patternSize>
void FAST_t(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression) void FAST_t(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression)
{ {
Mat img = _img.getMat(); Mat img = _img.getMat();
const int K = patternSize/2, N = patternSize + K + 1, quarterPatternSize = patternSize/4; const int K = patternSize/2, N = patternSize + K + 1;
#if CV_SSE2
const int quarterPatternSize = patternSize/4;
#endif
int i, j, k, pixel[25]; int i, j, k, pixel[25];
makeOffsets(pixel, (int)img.step, patternSize); makeOffsets(pixel, (int)img.step, patternSize);
for(k = patternSize; k < 25; k++) for(k = patternSize; k < 25; k++)
@ -585,7 +588,7 @@ FastFeatureDetector::FastFeatureDetector( int _threshold, bool _nonmaxSuppressio
FastFeatureDetector::FastFeatureDetector( int _threshold, bool _nonmaxSuppression, int _type ) FastFeatureDetector::FastFeatureDetector( int _threshold, bool _nonmaxSuppression, int _type )
: threshold(_threshold), nonmaxSuppression(_nonmaxSuppression), type(_type) : threshold(_threshold), nonmaxSuppression(_nonmaxSuppression), type(_type)
{} {}
void FastFeatureDetector::detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask ) const void FastFeatureDetector::detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask ) const
{ {
Mat grayImage = image; Mat grayImage = image;

@ -1298,17 +1298,17 @@ public:
maxk(_maxk), space_ofs(_space_ofs), space_weight(_space_weight), color_weight(_color_weight) maxk(_maxk), space_ofs(_space_ofs), space_weight(_space_weight), color_weight(_color_weight)
{ {
} }
virtual void operator() (const Range& range) const virtual void operator() (const Range& range) const
{ {
int i, j, cn = dest->channels(), k; int i, j, cn = dest->channels(), k;
Size size = dest->size(); Size size = dest->size();
for( i = range.start; i < range.end; i++ ) for( i = range.start; i < range.end; i++ )
{ {
const uchar* sptr = temp->ptr(i+radius) + radius*cn; const uchar* sptr = temp->ptr(i+radius) + radius*cn;
uchar* dptr = dest->ptr(i); uchar* dptr = dest->ptr(i);
if( cn == 1 ) if( cn == 1 )
{ {
for( j = 0; j < size.width; j++ ) for( j = 0; j < size.width; j++ )
@ -1351,10 +1351,10 @@ public:
} }
} }
} }
private: private:
const Mat *temp;
Mat *dest; Mat *dest;
const Mat *temp;
int radius, maxk, *space_ofs; int radius, maxk, *space_ofs;
float *space_weight, *color_weight; float *space_weight, *color_weight;
}; };
@ -1367,40 +1367,40 @@ bilateralFilter_8u( const Mat& src, Mat& dst, int d,
int cn = src.channels(); int cn = src.channels();
int i, j, maxk, radius; int i, j, maxk, radius;
Size size = src.size(); Size size = src.size();
CV_Assert( (src.type() == CV_8UC1 || src.type() == CV_8UC3) && CV_Assert( (src.type() == CV_8UC1 || src.type() == CV_8UC3) &&
src.type() == dst.type() && src.size() == dst.size() && src.type() == dst.type() && src.size() == dst.size() &&
src.data != dst.data ); src.data != dst.data );
if( sigma_color <= 0 ) if( sigma_color <= 0 )
sigma_color = 1; sigma_color = 1;
if( sigma_space <= 0 ) if( sigma_space <= 0 )
sigma_space = 1; sigma_space = 1;
double gauss_color_coeff = -0.5/(sigma_color*sigma_color); double gauss_color_coeff = -0.5/(sigma_color*sigma_color);
double gauss_space_coeff = -0.5/(sigma_space*sigma_space); double gauss_space_coeff = -0.5/(sigma_space*sigma_space);
if( d <= 0 ) if( d <= 0 )
radius = cvRound(sigma_space*1.5); radius = cvRound(sigma_space*1.5);
else else
radius = d/2; radius = d/2;
radius = MAX(radius, 1); radius = MAX(radius, 1);
d = radius*2 + 1; d = radius*2 + 1;
Mat temp; Mat temp;
copyMakeBorder( src, temp, radius, radius, radius, radius, borderType ); copyMakeBorder( src, temp, radius, radius, radius, radius, borderType );
vector<float> _color_weight(cn*256); vector<float> _color_weight(cn*256);
vector<float> _space_weight(d*d); vector<float> _space_weight(d*d);
vector<int> _space_ofs(d*d); vector<int> _space_ofs(d*d);
float* color_weight = &_color_weight[0]; float* color_weight = &_color_weight[0];
float* space_weight = &_space_weight[0]; float* space_weight = &_space_weight[0];
int* space_ofs = &_space_ofs[0]; int* space_ofs = &_space_ofs[0];
// initialize color-related bilateral filter coefficients // initialize color-related bilateral filter coefficients
for( i = 0; i < 256*cn; i++ ) for( i = 0; i < 256*cn; i++ )
color_weight[i] = (float)std::exp(i*i*gauss_color_coeff); color_weight[i] = (float)std::exp(i*i*gauss_color_coeff);
// initialize space-related bilateral filter coefficients // initialize space-related bilateral filter coefficients
for( i = -radius, maxk = 0; i <= radius; i++ ) for( i = -radius, maxk = 0; i <= radius; i++ )
for( j = -radius; j <= radius; j++ ) for( j = -radius; j <= radius; j++ )
@ -1411,7 +1411,7 @@ bilateralFilter_8u( const Mat& src, Mat& dst, int d,
space_weight[maxk] = (float)std::exp(r*r*gauss_space_coeff); space_weight[maxk] = (float)std::exp(r*r*gauss_space_coeff);
space_ofs[maxk++] = (int)(i*temp.step + j*cn); space_ofs[maxk++] = (int)(i*temp.step + j*cn);
} }
BilateralFilter_8u_Invoker body(dst, temp, radius, maxk, space_ofs, space_weight, color_weight); BilateralFilter_8u_Invoker body(dst, temp, radius, maxk, space_ofs, space_weight, color_weight);
parallel_for_(Range(0, size.height), body); parallel_for_(Range(0, size.height), body);
} }

@ -337,10 +337,9 @@ class RunInfo(object):
def getSvnVersion(self, path, name): def getSvnVersion(self, path, name):
if not path: if not path:
setattr(self, name, None) val = None
return elif not self.svnversion_path and hostos == 'nt':
if not self.svnversion_path and hostos == 'nt': val = self.tryGetSvnVersionWithTortoise(path, name)
self.tryGetSvnVersionWithTortoise(path, name)
else: else:
svnversion = self.svnversion_path svnversion = self.svnversion_path
if not svnversion: if not svnversion:
@ -348,11 +347,14 @@ class RunInfo(object):
try: try:
output = Popen([svnversion, "-n", path], stdout=PIPE, stderr=PIPE).communicate() output = Popen([svnversion, "-n", path], stdout=PIPE, stderr=PIPE).communicate()
if not output[1]: if not output[1]:
setattr(self, name, output[0]) val = output[0]
else: else:
setattr(self, name, None) val = None
except OSError: except OSError:
setattr(self, name, None) val = None
if val:
val = val.replace(" ", "_")
setattr(self, name, val)
def tryGetSvnVersionWithTortoise(self, path, name): def tryGetSvnVersionWithTortoise(self, path, name):
try: try:
@ -371,9 +373,9 @@ class RunInfo(object):
tmpfile = open(tmpfilename2, "r") tmpfile = open(tmpfilename2, "r")
version = tmpfile.read() version = tmpfile.read()
tmpfile.close() tmpfile.close()
setattr(self, name, version) return version
except: except:
setattr(self, name, None) return None
finally: finally:
if dir: if dir:
shutil.rmtree(dir) shutil.rmtree(dir)

@ -440,8 +440,7 @@ bool BackgroundSubtractorGMG::HistogramFeatureGMG::operator ==(HistogramFeatureG
std::vector<size_t>::iterator color_a; std::vector<size_t>::iterator color_a;
std::vector<size_t>::iterator color_b; std::vector<size_t>::iterator color_b;
std::vector<size_t>::iterator color_a_end = this->color.end(); std::vector<size_t>::iterator color_a_end = this->color.end();
std::vector<size_t>::iterator color_b_end = rhs.color.end(); for (color_a = color.begin(), color_b = rhs.color.begin(); color_a != color_a_end; ++color_a, ++color_b)
for (color_a = color.begin(),color_b =rhs.color.begin();color_a!=color_a_end;++color_a,++color_b)
{ {
if (*color_a != *color_b) if (*color_a != *color_b)
{ {

Loading…
Cancel
Save