Commit 691d3923 authored by Andrey Kamaev's avatar Andrey Kamaev

Fixes: Android NDK r7b, android build warnings, build with Visual Studio 2005.

parent 2219e381
...@@ -198,6 +198,25 @@ endif() ...@@ -198,6 +198,25 @@ endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}") set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(OPENCV_INCLUDE_PREFIX include)
if(INSTALL_TO_MANGLED_PATHS)
set(OPENCV_INCLUDE_PREFIX include/opencv-${OPENCV_VERSION})
endif()
if(WIN32)
# Postfix of DLLs:
set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
set(OPENCV_DEBUG_POSTFIX d)
else()
# Postfix of so's:
set(OPENCV_DLLVERSION "")
set(OPENCV_DEBUG_POSTFIX "")
endif()
if(NOT "${CMAKE_DEBUG_POSTFIX}" STREQUAL "")
set(OPENCV_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Path for build/platform -specific headers # Path for build/platform -specific headers
......
...@@ -163,7 +163,7 @@ set( CMAKE_SYSTEM_NAME Linux ) ...@@ -163,7 +163,7 @@ set( CMAKE_SYSTEM_NAME Linux )
#this one not so much #this one not so much
set( CMAKE_SYSTEM_VERSION 1 ) set( CMAKE_SYSTEM_VERSION 1 )
set( ANDROID_SUPPORTED_NDK_VERSIONS -r7 -r6b -r6 -r5c -r5b -r5 "" ) set( ANDROID_SUPPORTED_NDK_VERSIONS -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
if( CMAKE_HOST_WIN32 ) if( CMAKE_HOST_WIN32 )
file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATH ) file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATH )
set( ANDROID_NDK_SEARCH_PATH "${ANDROID_NDK_SEARCH_PATH}/android-ndk" ) set( ANDROID_NDK_SEARCH_PATH "${ANDROID_NDK_SEARCH_PATH}/android-ndk" )
...@@ -668,11 +668,11 @@ if( ARMEABI OR ARMEABI_V7A ) ...@@ -668,11 +668,11 @@ if( ARMEABI OR ARMEABI_V7A )
set( CMAKE_CXX_FLAGS "-fPIC -Wno-psabi" ) set( CMAKE_CXX_FLAGS "-fPIC -Wno-psabi" )
set( CMAKE_C_FLAGS "-fPIC -Wno-psabi" ) set( CMAKE_C_FLAGS "-fPIC -Wno-psabi" )
if( ANDROID_USE_STLPORT ) if( ANDROID_USE_STLPORT )
set( CMAKE_CXX_FLAGS "-fno-rtti -fno-exceptions" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions" )
set( CMAKE_C_FLAGS "-fno-rtti -fno-exceptions" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions" )
else() else()
set( CMAKE_CXX_FLAGS "-frtti -fexceptions" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fexceptions" )
set( CMAKE_C_FLAGS "-fexceptions" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions" )
endif() endif()
remove_definitions( -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ ) remove_definitions( -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ )
add_definitions( -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ ) add_definitions( -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ )
...@@ -682,11 +682,11 @@ elseif( X86 ) ...@@ -682,11 +682,11 @@ elseif( X86 )
set( CMAKE_CXX_FLAGS "-ffunction-sections -funwind-tables" ) set( CMAKE_CXX_FLAGS "-ffunction-sections -funwind-tables" )
set( CMAKE_C_FLAGS "-ffunction-sections -funwind-tables" ) set( CMAKE_C_FLAGS "-ffunction-sections -funwind-tables" )
if( ANDROID_USE_STLPORT ) if( ANDROID_USE_STLPORT )
set( CMAKE_CXX_FLAGS "-fno-rtti -fno-exceptions" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions" )
set( CMAKE_C_FLAGS "-fno-rtti -fno-exceptions" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions" )
else() else()
set( CMAKE_CXX_FLAGS "-frtti -fexceptions" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fexceptions" )
set( CMAKE_C_FLAGS "-fexceptions" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions" )
endif() endif()
else() else()
set( CMAKE_CXX_FLAGS "" ) set( CMAKE_CXX_FLAGS "" )
......
...@@ -46,7 +46,7 @@ macro(ocv_generate_dependencies_map_configmake suffix configuration) ...@@ -46,7 +46,7 @@ macro(ocv_generate_dependencies_map_configmake suffix configuration)
get_filename_component(__libname "${__libname}" NAME) get_filename_component(__libname "${__libname}" NAME)
if(WIN32) if(WIN32)
string(REGEX REPLACE "[.]dll$" ".lib" __libname "${__libname}") string(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "${CMAKE_LINK_LIBRARY_SUFFIX}" __libname "${__libname}")
endif() endif()
set(OPENCV_DEPENDENCIES_MAP_${suffix} "${OPENCV_DEPENDENCIES_MAP_${suffix}}set(OpenCV_${__ocv_lib}_LIBNAME_${suffix} \"${__libname}\")\n") set(OPENCV_DEPENDENCIES_MAP_${suffix} "${OPENCV_DEPENDENCIES_MAP_${suffix}}set(OpenCV_${__ocv_lib}_LIBNAME_${suffix} \"${__libname}\")\n")
......
...@@ -538,7 +538,7 @@ macro(ocv_add_perf_tests) ...@@ -538,7 +538,7 @@ macro(ocv_add_perf_tests)
endif() endif()
add_executable(${the_target} ${OPENCV_PERF_${the_module}_SOURCES}) add_executable(${the_target} ${OPENCV_PERF_${the_module}_SOURCES})
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${perf_deps}) target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${perf_deps} ${OPENCV_LINKER_LIBS})
# Additional target properties # Additional target properties
set_target_properties(${the_target} PROPERTIES set_target_properties(${the_target} PROPERTIES
...@@ -588,7 +588,7 @@ macro(ocv_add_accuracy_tests) ...@@ -588,7 +588,7 @@ macro(ocv_add_accuracy_tests)
endif() endif()
add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES}) add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES})
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${test_deps}) target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${test_deps} ${OPENCV_LINKER_LIBS})
# Additional target properties # Additional target properties
set_target_properties(${the_target} PROPERTIES set_target_properties(${the_target} PROPERTIES
......
SET(OPENCV_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/modules/core/include/opencv2/core/version.hpp") SET(OPENCV_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/modules/core/include/opencv2/core/version.hpp")
FILE(STRINGS "${OPENCV_VERSION_FILE}" OPENCV_VERSION_PARTS REGEX "#define CV_.+OR_VERSION[ ]+[0-9]+" ) FILE(STRINGS "${OPENCV_VERSION_FILE}" OPENCV_VERSION_PARTS REGEX "#define CV_.+OR_VERSION[ ]+[0-9]+" )
string(REGEX REPLACE ".+CV_MAJOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MAJOR "${OPENCV_VERSION_PARTS}") string(REGEX REPLACE ".+CV_MAJOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MAJOR "${OPENCV_VERSION_PARTS}")
string(REGEX REPLACE ".+CV_MINOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MINOR "${OPENCV_VERSION_PARTS}") string(REGEX REPLACE ".+CV_MINOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MINOR "${OPENCV_VERSION_PARTS}")
string(REGEX REPLACE ".+CV_SUBMINOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_PATCH "${OPENCV_VERSION_PARTS}") string(REGEX REPLACE ".+CV_SUBMINOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_PATCH "${OPENCV_VERSION_PARTS}")
set(OPENCV_VERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
set(OPENCV_VERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}") set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
# create a dependency on version file # create a dependency on version file
# we never use output of the following command but cmake will rerun automatically if the version file changes # we never use output of the following command but cmake will rerun automatically if the version file changes
configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY) configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY)
if(WIN32)
# Postfix of DLLs:
set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
set(OPENCV_DEBUG_POSTFIX d)
else()
# Postfix of so's:
set(OPENCV_DLLVERSION "")
set(OPENCV_DEBUG_POSTFIX)
endif()
#name mangling
set(OPENCV_INCLUDE_PREFIX include)
if(INSTALL_TO_MANGLED_PATHS)
set(OPENCV_INCLUDE_PREFIX include/opencv-${OPENCV_VERSION})
endif()
...@@ -139,7 +139,7 @@ string fromUtf16(const WString& str) ...@@ -139,7 +139,7 @@ string fromUtf16(const WString& str)
{ {
cv::AutoBuffer<char> _buf(str.size()*4 + 1); cv::AutoBuffer<char> _buf(str.size()*4 + 1);
char* buf = _buf; char* buf = _buf;
size_t sz = wcstombs(buf, str.c_str(), str.size()); size_t sz = wcstombs(buf, str.c_str(), str.size());
if( sz == (size_t)-1 ) if( sz == (size_t)-1 )
return string(); return string();
...@@ -151,7 +151,7 @@ WString toUtf16(const string& str) ...@@ -151,7 +151,7 @@ WString toUtf16(const string& str)
{ {
cv::AutoBuffer<wchar_t> _buf(str.size() + 1); cv::AutoBuffer<wchar_t> _buf(str.size() + 1);
wchar_t* buf = _buf; wchar_t* buf = _buf;
size_t sz = mbstowcs(buf, str.c_str(), str.size()); size_t sz = mbstowcs(buf, str.c_str(), str.size());
if( sz == (size_t)-1 ) if( sz == (size_t)-1 )
return WString(); return WString();
...@@ -753,7 +753,7 @@ cvGetFileNodeFromSeq( CvFileStorage* fs, ...@@ -753,7 +753,7 @@ cvGetFileNodeFromSeq( CvFileStorage* fs,
value = (CvFileNode*)cvGetSeqElem( seq, index, 0 ); value = (CvFileNode*)cvGetSeqElem( seq, index, 0 );
return value; return value;
}*/ }*/
...@@ -852,12 +852,14 @@ icvProcessSpecialDouble( CvFileStorage* fs, char* buf, double* value, char** end ...@@ -852,12 +852,14 @@ icvProcessSpecialDouble( CvFileStorage* fs, char* buf, double* value, char** end
if( c != '.' ) if( c != '.' )
CV_PARSE_ERROR( "Bad format of floating-point constant" ); CV_PARSE_ERROR( "Bad format of floating-point constant" );
union{double d; uint64 i;} v;
if( toupper(buf[1]) == 'I' && toupper(buf[2]) == 'N' && toupper(buf[3]) == 'F' ) if( toupper(buf[1]) == 'I' && toupper(buf[2]) == 'N' && toupper(buf[3]) == 'F' )
*(uint64*)value = ((uint64)inf_hi << 32); v.i = (uint64)inf_hi << 32;
else if( toupper(buf[1]) == 'N' && toupper(buf[2]) == 'A' && toupper(buf[3]) == 'N' ) else if( toupper(buf[1]) == 'N' && toupper(buf[2]) == 'A' && toupper(buf[3]) == 'N' )
*(uint64*)value = (uint64)-1; v.i = (uint64)-1;
else else
CV_PARSE_ERROR( "Bad format of floating-point constant" ); CV_PARSE_ERROR( "Bad format of floating-point constant" );
*value = v.d;
*endptr = buf + 4; *endptr = buf + 4;
} }
...@@ -2018,7 +2020,7 @@ icvXMLParseTag( CvFileStorage* fs, char* ptr, CvStringHashNode** _tag, ...@@ -2018,7 +2020,7 @@ icvXMLParseTag( CvFileStorage* fs, char* ptr, CvStringHashNode** _tag,
if( *ptr == '\0' ) if( *ptr == '\0' )
CV_PARSE_ERROR( "Preliminary end of the stream" ); CV_PARSE_ERROR( "Preliminary end of the stream" );
if( *ptr != '<' ) if( *ptr != '<' )
CV_PARSE_ERROR( "Tag should start with \'<\'" ); CV_PARSE_ERROR( "Tag should start with \'<\'" );
...@@ -2615,7 +2617,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co ...@@ -2615,7 +2617,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
fs->filename = (char*)cvMemStorageAlloc( fs->memstorage, fnamelen+1 ); fs->filename = (char*)cvMemStorageAlloc( fs->memstorage, fnamelen+1 );
strcpy( fs->filename, filename ); strcpy( fs->filename, filename );
char* dot_pos = strrchr(fs->filename, '.'); char* dot_pos = strrchr(fs->filename, '.');
char compression = '\0'; char compression = '\0';
...@@ -2684,7 +2686,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co ...@@ -2684,7 +2686,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
strcmp( encoding, "utf-16" ) == 0 || strcmp( encoding, "utf-16" ) == 0 ||
strcmp( encoding, "Utf-16" ) == 0 ) strcmp( encoding, "Utf-16" ) == 0 )
CV_Error( CV_StsBadArg, "UTF-16 XML encoding is not supported! Use 8-bit encoding\n"); CV_Error( CV_StsBadArg, "UTF-16 XML encoding is not supported! Use 8-bit encoding\n");
CV_Assert( strlen(encoding) < 1000 ); CV_Assert( strlen(encoding) < 1000 );
char buf[1100]; char buf[1100];
sprintf(buf, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", encoding); sprintf(buf, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", encoding);
...@@ -3443,12 +3445,12 @@ icvReadMat( CvFileStorage* fs, CvFileNode* node ) ...@@ -3443,12 +3445,12 @@ icvReadMat( CvFileStorage* fs, CvFileNode* node )
data = cvGetFileNodeByName( fs, node, "data" ); data = cvGetFileNodeByName( fs, node, "data" );
if( !data ) if( !data )
CV_Error( CV_StsError, "The matrix data is not found in file storage" ); CV_Error( CV_StsError, "The matrix data is not found in file storage" );
int nelems = icvFileNodeSeqLen( data ); int nelems = icvFileNodeSeqLen( data );
if( nelems > 0 && nelems != rows*cols*CV_MAT_CN(elem_type) ) if( nelems > 0 && nelems != rows*cols*CV_MAT_CN(elem_type) )
CV_Error( CV_StsUnmatchedSizes, CV_Error( CV_StsUnmatchedSizes,
"The matrix size does not match to the number of stored elements" ); "The matrix size does not match to the number of stored elements" );
if( nelems > 0 ) if( nelems > 0 )
{ {
mat = cvCreateMat( rows, cols, elem_type ); mat = cvCreateMat( rows, cols, elem_type );
...@@ -3533,18 +3535,18 @@ icvReadMatND( CvFileStorage* fs, CvFileNode* node ) ...@@ -3533,18 +3535,18 @@ icvReadMatND( CvFileStorage* fs, CvFileNode* node )
data = cvGetFileNodeByName( fs, node, "data" ); data = cvGetFileNodeByName( fs, node, "data" );
if( !data ) if( !data )
CV_Error( CV_StsError, "The matrix data is not found in file storage" ); CV_Error( CV_StsError, "The matrix data is not found in file storage" );
for( total_size = CV_MAT_CN(elem_type), i = 0; i < dims; i++ ) for( total_size = CV_MAT_CN(elem_type), i = 0; i < dims; i++ )
total_size *= sizes[i]; total_size *= sizes[i];
int nelems = icvFileNodeSeqLen( data ); int nelems = icvFileNodeSeqLen( data );
if( nelems > 0 && nelems != total_size ) if( nelems > 0 && nelems != total_size )
CV_Error( CV_StsUnmatchedSizes, CV_Error( CV_StsUnmatchedSizes,
"The matrix size does not match to the number of stored elements" ); "The matrix size does not match to the number of stored elements" );
if( nelems > 0 ) if( nelems > 0 )
{ {
mat = cvCreateMatND( dims, sizes, elem_type ); mat = cvCreateMatND( dims, sizes, elem_type );
...@@ -4006,8 +4008,8 @@ icvWriteSeq( CvFileStorage* fs, const char* name, ...@@ -4006,8 +4008,8 @@ icvWriteSeq( CvFileStorage* fs, const char* name,
cvWriteInt( fs, "level", level ); cvWriteInt( fs, "level", level );
dt = icvGetFormat( seq, "dt", &attr, 0, dt_buf ); dt = icvGetFormat( seq, "dt", &attr, 0, dt_buf );
strcpy(buf, ""); strcpy(buf, "");
if( CV_IS_SEQ_CLOSED(seq) ) if( CV_IS_SEQ_CLOSED(seq) )
strcat(buf, " closed"); strcat(buf, " closed");
if( CV_IS_SEQ_HOLE(seq) ) if( CV_IS_SEQ_HOLE(seq) )
...@@ -4016,11 +4018,11 @@ icvWriteSeq( CvFileStorage* fs, const char* name, ...@@ -4016,11 +4018,11 @@ icvWriteSeq( CvFileStorage* fs, const char* name,
strcat(buf, " curve"); strcat(buf, " curve");
if( CV_SEQ_ELTYPE(seq) == 0 && seq->elem_size != 1 ) if( CV_SEQ_ELTYPE(seq) == 0 && seq->elem_size != 1 )
strcat(buf, " untyped"); strcat(buf, " untyped");
cvWriteString( fs, "flags", buf + (buf[0] ? 1 : 0), 1 ); cvWriteString( fs, "flags", buf + (buf[0] ? 1 : 0), 1 );
cvWriteInt( fs, "count", seq->total ); cvWriteInt( fs, "count", seq->total );
cvWriteString( fs, "dt", dt, 0 ); cvWriteString( fs, "dt", dt, 0 );
icvWriteHeaderData( fs, seq, &attr, sizeof(CvSeq) ); icvWriteHeaderData( fs, seq, &attr, sizeof(CvSeq) );
...@@ -4102,7 +4104,7 @@ icvReadSeq( CvFileStorage* fs, CvFileNode* node ) ...@@ -4102,7 +4104,7 @@ icvReadSeq( CvFileStorage* fs, CvFileNode* node )
CV_Error( CV_StsError, "Some of essential sequence attributes are absent" ); CV_Error( CV_StsError, "Some of essential sequence attributes are absent" );
flags = CV_SEQ_MAGIC_VAL; flags = CV_SEQ_MAGIC_VAL;
if( cv_isdigit(flags_str[0]) ) if( cv_isdigit(flags_str[0]) )
{ {
const int OLD_SEQ_ELTYPE_BITS = 9; const int OLD_SEQ_ELTYPE_BITS = 9;
...@@ -4113,7 +4115,7 @@ icvReadSeq( CvFileStorage* fs, CvFileNode* node ) ...@@ -4113,7 +4115,7 @@ icvReadSeq( CvFileStorage* fs, CvFileNode* node )
const int OLD_SEQ_FLAG_SHIFT = OLD_SEQ_KIND_BITS + OLD_SEQ_ELTYPE_BITS; const int OLD_SEQ_FLAG_SHIFT = OLD_SEQ_KIND_BITS + OLD_SEQ_ELTYPE_BITS;
const int OLD_SEQ_FLAG_CLOSED = 1 << OLD_SEQ_FLAG_SHIFT; const int OLD_SEQ_FLAG_CLOSED = 1 << OLD_SEQ_FLAG_SHIFT;
const int OLD_SEQ_FLAG_HOLE = 8 << OLD_SEQ_FLAG_SHIFT; const int OLD_SEQ_FLAG_HOLE = 8 << OLD_SEQ_FLAG_SHIFT;
int flags0 = (int)strtol( flags_str, &endptr, 16 ); int flags0 = (int)strtol( flags_str, &endptr, 16 );
if( endptr == flags_str || (flags0 & CV_MAGIC_MASK) != CV_SEQ_MAGIC_VAL ) if( endptr == flags_str || (flags0 & CV_MAGIC_MASK) != CV_SEQ_MAGIC_VAL )
CV_Error( CV_StsError, "The sequence flags are invalid" ); CV_Error( CV_StsError, "The sequence flags are invalid" );
...@@ -4471,14 +4473,14 @@ icvReadGraph( CvFileStorage* fs, CvFileNode* node ) ...@@ -4471,14 +4473,14 @@ icvReadGraph( CvFileStorage* fs, CvFileNode* node )
CV_Error( CV_StsError, "Some of essential graph attributes are absent" ); CV_Error( CV_StsError, "Some of essential graph attributes are absent" );
flags = CV_SET_MAGIC_VAL + CV_GRAPH; flags = CV_SET_MAGIC_VAL + CV_GRAPH;
if( isxdigit(flags_str[0]) ) if( isxdigit(flags_str[0]) )
{ {
const int OLD_SEQ_ELTYPE_BITS = 9; const int OLD_SEQ_ELTYPE_BITS = 9;
const int OLD_SEQ_KIND_BITS = 3; const int OLD_SEQ_KIND_BITS = 3;
const int OLD_SEQ_FLAG_SHIFT = OLD_SEQ_KIND_BITS + OLD_SEQ_ELTYPE_BITS; const int OLD_SEQ_FLAG_SHIFT = OLD_SEQ_KIND_BITS + OLD_SEQ_ELTYPE_BITS;
const int OLD_GRAPH_FLAG_ORIENTED = 1 << OLD_SEQ_FLAG_SHIFT; const int OLD_GRAPH_FLAG_ORIENTED = 1 << OLD_SEQ_FLAG_SHIFT;
int flags0 = (int)strtol( flags_str, &endptr, 16 ); int flags0 = (int)strtol( flags_str, &endptr, 16 );
if( endptr == flags_str || (flags0 & CV_MAGIC_MASK) != CV_SET_MAGIC_VAL ) if( endptr == flags_str || (flags0 & CV_MAGIC_MASK) != CV_SET_MAGIC_VAL )
CV_Error( CV_StsError, "The sequence flags are invalid" ); CV_Error( CV_StsError, "The sequence flags are invalid" );
...@@ -4780,8 +4782,8 @@ cvFindType( const char* type_name ) ...@@ -4780,8 +4782,8 @@ cvFindType( const char* type_name )
if (type_name) if (type_name)
for( info = CvType::first; info != 0; info = info->next ) for( info = CvType::first; info != 0; info = info->next )
if( strcmp( info->type_name, type_name ) == 0 ) if( strcmp( info->type_name, type_name ) == 0 )
break; break;
return info; return info;
} }
...@@ -4978,13 +4980,13 @@ stop_search: ...@@ -4978,13 +4980,13 @@ stop_search:
if( _real_name) if( _real_name)
{ {
if (real_name) if (real_name)
{ {
*_real_name = (const char*)cvAlloc(strlen(real_name)); *_real_name = (const char*)cvAlloc(strlen(real_name));
memcpy((void*)*_real_name, real_name, strlen(real_name)); memcpy((void*)*_real_name, real_name, strlen(real_name));
} else { } else {
*_real_name = 0; *_real_name = 0;
} }
} }
return ptr; return ptr;
...@@ -5150,7 +5152,7 @@ FileNode FileStorage::operator[](const string& nodename) const ...@@ -5150,7 +5152,7 @@ FileNode FileStorage::operator[](const string& nodename) const
FileNode FileStorage::operator[](const char* nodename) const FileNode FileStorage::operator[](const char* nodename) const
{ {
return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename)); return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename));
} }
FileNode FileNode::operator[](const string& nodename) const FileNode FileNode::operator[](const string& nodename) const
{ {
...@@ -5167,13 +5169,13 @@ FileNode FileNode::operator[](int i) const ...@@ -5167,13 +5169,13 @@ FileNode FileNode::operator[](int i) const
return isSeq() ? FileNode(fs, (CvFileNode*)cvGetSeqElem(node->data.seq, i)) : return isSeq() ? FileNode(fs, (CvFileNode*)cvGetSeqElem(node->data.seq, i)) :
i == 0 ? *this : FileNode(); i == 0 ? *this : FileNode();
} }
string FileNode::name() const string FileNode::name() const
{ {
const char* str; const char* str;
return !node || (str = cvGetFileNodeName(node)) == 0 ? string() : string(str); return !node || (str = cvGetFileNodeName(node)) == 0 ? string() : string(str);
} }
void* FileNode::readObj() const void* FileNode::readObj() const
{ {
if( !fs || !node ) if( !fs || !node )
...@@ -5294,7 +5296,7 @@ FileNodeIterator& FileNodeIterator::readRaw( const string& fmt, uchar* vec, size ...@@ -5294,7 +5296,7 @@ FileNodeIterator& FileNodeIterator::readRaw( const string& fmt, uchar* vec, size
getElemSize( fmt, elem_size, cn ); getElemSize( fmt, elem_size, cn );
CV_Assert( elem_size > 0 ); CV_Assert( elem_size > 0 );
size_t count = std::min(remaining, maxCount); size_t count = std::min(remaining, maxCount);
if( reader.seq ) if( reader.seq )
{ {
cvReadRawDataSlice( fs, &reader, (int)count, vec, fmt.c_str() ); cvReadRawDataSlice( fs, &reader, (int)count, vec, fmt.c_str() );
...@@ -5309,7 +5311,7 @@ FileNodeIterator& FileNodeIterator::readRaw( const string& fmt, uchar* vec, size ...@@ -5309,7 +5311,7 @@ FileNodeIterator& FileNodeIterator::readRaw( const string& fmt, uchar* vec, size
return *this; return *this;
} }
void write( FileStorage& fs, const string& name, int value ) void write( FileStorage& fs, const string& name, int value )
{ cvWriteInt( *fs, name.size() ? name.c_str() : 0, value ); } { cvWriteInt( *fs, name.size() ? name.c_str() : 0, value ); }
...@@ -5332,9 +5334,9 @@ void writeScalar(FileStorage& fs, double value ) ...@@ -5332,9 +5334,9 @@ void writeScalar(FileStorage& fs, double value )
{ cvWriteReal( *fs, 0, value ); } { cvWriteReal( *fs, 0, value ); }
void writeScalar(FileStorage& fs, const string& value ) void writeScalar(FileStorage& fs, const string& value )
{ cvWriteString( *fs, 0, value.c_str() ); } { cvWriteString( *fs, 0, value.c_str() ); }
void write( FileStorage& fs, const string& name, const Mat& value ) void write( FileStorage& fs, const string& name, const Mat& value )
{ {
if( value.dims <= 2 ) if( value.dims <= 2 )
...@@ -5348,25 +5350,25 @@ void write( FileStorage& fs, const string& name, const Mat& value ) ...@@ -5348,25 +5350,25 @@ void write( FileStorage& fs, const string& name, const Mat& value )
cvWrite( *fs, name.size() ? name.c_str() : 0, &mat ); cvWrite( *fs, name.size() ? name.c_str() : 0, &mat );
} }
} }
// TODO: the 4 functions below need to be implemented more efficiently // TODO: the 4 functions below need to be implemented more efficiently
void write( FileStorage& fs, const string& name, const SparseMat& value ) void write( FileStorage& fs, const string& name, const SparseMat& value )
{ {
Ptr<CvSparseMat> mat = (CvSparseMat*)value; Ptr<CvSparseMat> mat = (CvSparseMat*)value;
cvWrite( *fs, name.size() ? name.c_str() : 0, mat ); cvWrite( *fs, name.size() ? name.c_str() : 0, mat );
} }
WriteStructContext::WriteStructContext(FileStorage& _fs, const string& name, WriteStructContext::WriteStructContext(FileStorage& _fs, const string& name,
int flags, const string& typeName) : fs(&_fs) int flags, const string& typeName) : fs(&_fs)
{ {
cvStartWriteStruct(**fs, !name.empty() ? name.c_str() : 0, flags, cvStartWriteStruct(**fs, !name.empty() ? name.c_str() : 0, flags,
!typeName.empty() ? typeName.c_str() : 0); !typeName.empty() ? typeName.c_str() : 0);
} }
WriteStructContext::~WriteStructContext() { cvEndWriteStruct(**fs); }
WriteStructContext::~WriteStructContext() { cvEndWriteStruct(**fs); }
void read( const FileNode& node, Mat& mat, const Mat& default_mat ) void read( const FileNode& node, Mat& mat, const Mat& default_mat )
{ {
if( node.empty() ) if( node.empty() )
...@@ -5391,7 +5393,7 @@ void read( const FileNode& node, Mat& mat, const Mat& default_mat ) ...@@ -5391,7 +5393,7 @@ void read( const FileNode& node, Mat& mat, const Mat& default_mat )
CV_Error(CV_StsBadArg, "Unknown array type"); CV_Error(CV_StsBadArg, "Unknown array type");
} }
} }
void read( const FileNode& node, SparseMat& mat, const SparseMat& default_mat ) void read( const FileNode& node, SparseMat& mat, const SparseMat& default_mat )
{ {
if( node.empty() ) if( node.empty() )
...@@ -5403,7 +5405,7 @@ void read( const FileNode& node, SparseMat& mat, const SparseMat& default_mat ) ...@@ -5403,7 +5405,7 @@ void read( const FileNode& node, SparseMat& mat, const SparseMat& default_mat )
CV_Assert(CV_IS_SPARSE_MAT(m)); CV_Assert(CV_IS_SPARSE_MAT(m));
SparseMat(m).copyTo(mat); SparseMat(m).copyTo(mat);
} }
} }
/* End of file. */ /* End of file. */
...@@ -517,7 +517,7 @@ inRangeS_(const _Tp* src, const _WTp* a, const _WTp* b, uchar* dst, size_t total ...@@ -517,7 +517,7 @@ inRangeS_(const _Tp* src, const _WTp* a, const _WTp* b, uchar* dst, size_t total
for( i = 0; i < total; i++ ) for( i = 0; i < total; i++ )
{ {
_Tp val = src[i*cn]; _Tp val = src[i*cn];
dst[i] = a[0] <= val && val <= b[0] ? 255 : 0; dst[i] = (a[0] <= val && val <= b[0]) ? uchar(255) : 0;
} }
for( c = 1; c < cn; c++ ) for( c = 1; c < cn; c++ )
{ {
...@@ -609,10 +609,10 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds ...@@ -609,10 +609,10 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds
size_t total = planes[0].total(); size_t total = planes[0].total();
size_t i, nplanes = it.nplanes; size_t i, nplanes = it.nplanes;
int depth = src.depth(), cn = src.channels(); int depth = src.depth(), cn = src.channels();
double lbuf[4], rbuf[4]; union { double d[4]; float f[4]; int i[4];} lbuf, rbuf;
int wtype = CV_MAKETYPE(depth <= CV_32S ? CV_32S : depth, cn); int wtype = CV_MAKETYPE(depth <= CV_32S ? CV_32S : depth, cn);
scalarToRawData(lb, lbuf, wtype, cn); scalarToRawData(lb, lbuf.d, wtype, cn);
scalarToRawData(rb, rbuf, wtype, cn); scalarToRawData(rb, rbuf.d, wtype, cn);
for( i = 0; i < nplanes; i++, ++it ) for( i = 0; i < nplanes; i++, ++it )
{ {
...@@ -622,25 +622,25 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds ...@@ -622,25 +622,25 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds
switch( depth ) switch( depth )
{ {
case CV_8U: case CV_8U:
inRangeS_((const uchar*)sptr, (const int*)lbuf, (const int*)rbuf, dptr, total, cn); inRangeS_((const uchar*)sptr, lbuf.i, rbuf.i, dptr, total, cn);
break; break;
case CV_8S: case CV_8S:
inRangeS_((const schar*)sptr, (const int*)lbuf, (const int*)rbuf, dptr, total, cn); inRangeS_((const schar*)sptr, lbuf.i, rbuf.i, dptr, total, cn);
break; break;
case CV_16U: case CV_16U:
inRangeS_((const ushort*)sptr, (const int*)lbuf, (const int*)rbuf, dptr, total, cn); inRangeS_((const ushort*)sptr, lbuf.i, rbuf.i, dptr, total, cn);
break; break;
case CV_16S: case CV_16S:
inRangeS_((const short*)sptr, (const int*)lbuf, (const int*)rbuf, dptr, total, cn); inRangeS_((const short*)sptr, lbuf.i, rbuf.i, dptr, total, cn);
break; break;
case CV_32S: case CV_32S:
inRangeS_((const int*)sptr, (const int*)lbuf, (const int*)rbuf, dptr, total, cn); inRangeS_((const int*)sptr, lbuf.i, rbuf.i, dptr, total, cn);
break; break;
case CV_32F: case CV_32F:
inRangeS_((const float*)sptr, (const float*)lbuf, (const float*)rbuf, dptr, total, cn); inRangeS_((const float*)sptr, lbuf.f, rbuf.f, dptr, total, cn);
break; break;
case CV_64F: case CV_64F:
inRangeS_((const double*)sptr, (const double*)lbuf, (const double*)rbuf, dptr, total, cn); inRangeS_((const double*)sptr, lbuf.d, rbuf.d, dptr, total, cn);
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(CV_StsUnsupportedFormat, "");
......
...@@ -124,6 +124,7 @@ struct CvSurfHF ...@@ -124,6 +124,7 @@ struct CvSurfHF
{ {
int p0, p1, p2, p3; int p0, p1, p2, p3;
float w; float w;
CvSurfHF(): p0(0),p1(0),p2(0),p3(0),w(0) {}
}; };
CV_INLINE float CV_INLINE float
......
...@@ -244,7 +244,7 @@ if(IOS) ...@@ -244,7 +244,7 @@ if(IOS)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} bz2 "-framework QuartzCore" "-framework CoreFoundation" "-framework ImageIO" "-framework CoreGraphics" "-framework AVFoundation") set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} bz2 "-framework QuartzCore" "-framework CoreFoundation" "-framework ImageIO" "-framework CoreGraphics" "-framework AVFoundation")
endif() endif()
if(MINGW) if(WIN32)
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib") link_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include")#for directshow include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include")#for directshow
endif() endif()
...@@ -270,5 +270,5 @@ set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "") ...@@ -270,5 +270,5 @@ set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
ocv_add_precompiled_headers(${the_module}) ocv_add_precompiled_headers(${the_module})
ocv_add_accuracy_tests(highgui opencv_imgproc) ocv_add_accuracy_tests()
ocv_add_perf_tests() ocv_add_perf_tests()
...@@ -586,7 +586,7 @@ icvCreateContourTree( const CvSeq * contour, CvMemStorage * storage, ...@@ -586,7 +586,7 @@ icvCreateContourTree( const CvSeq * contour, CvMemStorage * storage,
/* CV_WRITE_SEQ_ELEM (tree_one, start_writer); */ /* CV_WRITE_SEQ_ELEM (tree_one, start_writer); */
i_tree++; i_tree++;
/* create Sequence hearder */ /* create Sequence hearder */
*((CvSeq **) tree) = cvEndWriteSeq( &writer ); *tree = (CvContourTree*)cvEndWriteSeq( &writer );
/* write points for the main segment into sequence header */ /* write points for the main segment into sequence header */
(*tree)->p1 = pt1[0]; (*tree)->p1 = pt1[0];
......
...@@ -332,7 +332,6 @@ int icvComputeCoeffForStereo( CvStereoCamera* stereoCamera) ...@@ -332,7 +332,6 @@ int icvComputeCoeffForStereo( CvStereoCamera* stereoCamera)
} }
/*--------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------*/
int icvComCoeffForLine( CvPoint2D64d point1, int icvComCoeffForLine( CvPoint2D64d point1,
CvPoint2D64d point2, CvPoint2D64d point2,
...@@ -350,33 +349,33 @@ int icvComCoeffForLine( CvPoint2D64d point1, ...@@ -350,33 +349,33 @@ int icvComCoeffForLine( CvPoint2D64d point1,
/* Get direction for all points */ /* Get direction for all points */
/* Direction for camera 1 */ /* Direction for camera 1 */
double direct1[3]; CvPoint3D64f direct1;
double direct2[3]; CvPoint3D64f direct2;
double camPoint1[3]; CvPoint3D64f camPoint1;
double directS3[3]; CvPoint3D64f directS3;
double directS4[3]; CvPoint3D64f directS4;
double direct3[3]; CvPoint3D64f direct3;
double direct4[3]; CvPoint3D64f direct4;
double camPoint2[3]; CvPoint3D64f camPoint2;
icvGetDirectionForPoint( point1, icvGetDirectionForPoint( point1,
camMatr1, camMatr1,
(CvPoint3D64d*)direct1); &direct1);
icvGetDirectionForPoint( point2, icvGetDirectionForPoint( point2,
camMatr1, camMatr1,
(CvPoint3D64d*)direct2); &direct2);
/* Direction for camera 2 */ /* Direction for camera 2 */
icvGetDirectionForPoint( point3, icvGetDirectionForPoint( point3,
camMatr2, camMatr2,
(CvPoint3D64d*)directS3); &directS3);
icvGetDirectionForPoint( point4, icvGetDirectionForPoint( point4,
camMatr2, camMatr2,
(CvPoint3D64d*)directS4); &directS4);
/* Create convertion for camera 2: two direction and camera point */ /* Create convertion for camera 2: two direction and camera point */
...@@ -390,30 +389,30 @@ int icvComCoeffForLine( CvPoint2D64d point1, ...@@ -390,30 +389,30 @@ int icvComCoeffForLine( CvPoint2D64d point1,
convRotMatr, convRotMatr,
convTransVect); convTransVect);
double zeroVect[3]; CvPoint3D64f zeroVect;
zeroVect[0] = zeroVect[1] = zeroVect[2] = 0.0; zeroVect.x = zeroVect.y = zeroVect.z = 0.0;
camPoint1[0] = camPoint1[1] = camPoint1[2] = 0.0; camPoint1.x = camPoint1.y = camPoint1.z = 0.0;
icvConvertPointSystem(*((CvPoint3D64d*)directS3),(CvPoint3D64d*)direct3,convRotMatr,convTransVect); icvConvertPointSystem(directS3,&direct3,convRotMatr,convTransVect);
icvConvertPointSystem(*((CvPoint3D64d*)directS4),(CvPoint3D64d*)direct4,convRotMatr,convTransVect); icvConvertPointSystem(directS4,&direct4,convRotMatr,convTransVect);
icvConvertPointSystem(*((CvPoint3D64d*)zeroVect),(CvPoint3D64d*)camPoint2,convRotMatr,convTransVect); icvConvertPointSystem(zeroVect,&camPoint2,convRotMatr,convTransVect);
double pointB[3]; CvPoint3D64f pointB;
int postype = 0; int postype = 0;
/* Changed order */ /* Changed order */
/* Compute point B: xB,yB,zB */ /* Compute point B: xB,yB,zB */
icvGetCrossLines(*((CvPoint3D64d*)camPoint1),*((CvPoint3D64d*)direct2), icvGetCrossLines(camPoint1,direct2,
*((CvPoint3D64d*)camPoint2),*((CvPoint3D64d*)direct3), camPoint2,direct3,
(CvPoint3D64d*)pointB); &pointB);
if( pointB[2] < 0 )/* If negative use other lines for cross */ if( pointB.z < 0 )/* If negative use other lines for cross */
{ {
postype = 1; postype = 1;
icvGetCrossLines(*((CvPoint3D64d*)camPoint1),*((CvPoint3D64d*)direct1), icvGetCrossLines(camPoint1,direct1,
*((CvPoint3D64d*)camPoint2),*((CvPoint3D64d*)direct4), camPoint2,direct4,
(CvPoint3D64d*)pointB); &pointB);
} }
CvPoint3D64d pointNewA; CvPoint3D64d pointNewA;
...@@ -424,27 +423,27 @@ int icvComCoeffForLine( CvPoint2D64d point1, ...@@ -424,27 +423,27 @@ int icvComCoeffForLine( CvPoint2D64d point1,
if( postype == 0 ) if( postype == 0 )
{ {
icvGetSymPoint3D( *((CvPoint3D64d*)camPoint1), icvGetSymPoint3D( camPoint1,
*((CvPoint3D64d*)direct1), direct1,
*((CvPoint3D64d*)pointB), pointB,
&pointNewA); &pointNewA);
icvGetSymPoint3D( *((CvPoint3D64d*)camPoint2), icvGetSymPoint3D( camPoint2,
*((CvPoint3D64d*)direct4), direct4,
*((CvPoint3D64d*)pointB), pointB,
&pointNewC); &pointNewC);
} }
else else
{/* In this case we must change cameras */ {/* In this case we must change cameras */
*needSwapCamera = 1; *needSwapCamera = 1;
icvGetSymPoint3D( *((CvPoint3D64d*)camPoint2), icvGetSymPoint3D( camPoint2,
*((CvPoint3D64d*)direct3), direct3,
*((CvPoint3D64d*)pointB), pointB,
&pointNewA); &pointNewA);
icvGetSymPoint3D( *((CvPoint3D64d*)camPoint1), icvGetSymPoint3D( camPoint1,
*((CvPoint3D64d*)direct2), direct2,
*((CvPoint3D64d*)pointB), pointB,
&pointNewC); &pointNewC);
} }
...@@ -453,9 +452,9 @@ int icvComCoeffForLine( CvPoint2D64d point1, ...@@ -453,9 +452,9 @@ int icvComCoeffForLine( CvPoint2D64d point1,
double x1,y1,z1; double x1,y1,z1;
x1 = camPoint1[0]; x1 = camPoint1.x;
y1 = camPoint1[1]; y1 = camPoint1.y;
z1 = camPoint1[2]; z1 = camPoint1.z;
double xA,yA,zA; double xA,yA,zA;
double xB,yB,zB; double xB,yB,zB;
...@@ -465,9 +464,9 @@ int icvComCoeffForLine( CvPoint2D64d point1, ...@@ -465,9 +464,9 @@ int icvComCoeffForLine( CvPoint2D64d point1,
yA = pointNewA.y; yA = pointNewA.y;
zA = pointNewA.z; zA = pointNewA.z;
xB = pointB[0]; xB = pointB.x;
yB = pointB[1]; yB = pointB.y;
zB = pointB[2]; zB = pointB.z;
xC = pointNewC.x; xC = pointNewC.x;
yC = pointNewC.y; yC = pointNewC.y;
...@@ -479,8 +478,8 @@ int icvComCoeffForLine( CvPoint2D64d point1, ...@@ -479,8 +478,8 @@ int icvComCoeffForLine( CvPoint2D64d point1,
gamma = len2 / len1; gamma = len2 / len1;
icvComputeStereoLineCoeffs( pointNewA, icvComputeStereoLineCoeffs( pointNewA,
*((CvPoint3D64d*)pointB), pointB,
*((CvPoint3D64d*)camPoint1), camPoint1,
gamma, gamma,
coeffs); coeffs);
......
...@@ -834,8 +834,8 @@ void TestBase::reportMetrics(bool toJUnitXML) ...@@ -834,8 +834,8 @@ void TestBase::reportMetrics(bool toJUnitXML)
break; break;
}; };
LOGD("bytesIn =%11lu", m.bytesIn); LOGD("bytesIn =%11lu", (unsigned long)m.bytesIn);
LOGD("bytesOut =%11lu", m.bytesOut); LOGD("bytesOut =%11lu", (unsigned long)m.bytesOut);
if (nIters == (unsigned int)-1 || m.terminationReason == performance_metrics::TERM_ITERATIONS) if (nIters == (unsigned int)-1 || m.terminationReason == performance_metrics::TERM_ITERATIONS)
LOGD("samples =%11u", m.samples); LOGD("samples =%11u", m.samples);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment