From 691d3923126e7b752bda1711042de204292a901e Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Thu, 16 Feb 2012 20:29:35 +0000 Subject: [PATCH] Fixes: Android NDK r7b, android build warnings, build with Visual Studio 2005. --- CMakeLists.txt | 19 +++++++ android/android.toolchain.cmake | 18 +++---- cmake/OpenCVGenConfig.cmake | 2 +- cmake/OpenCVModule.cmake | 4 +- cmake/OpenCVVersion.cmake | 19 +------ modules/core/src/persistence.cpp | 104 +++++++++++++++++++------------------ modules/core/test/test_arithm.cpp | 22 ++++---- modules/features2d/src/surf.cpp | 1 + modules/highgui/CMakeLists.txt | 4 +- modules/legacy/src/contourtree.cpp | 2 +- modules/legacy/src/epilines.cpp | 93 ++++++++++++++++----------------- modules/ts/src/ts_perf.cpp | 4 +- 12 files changed, 149 insertions(+), 143 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 393b2ce..7be33d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,6 +198,25 @@ endif() set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}") 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 diff --git a/android/android.toolchain.cmake b/android/android.toolchain.cmake index 621fc2e..784575c 100644 --- a/android/android.toolchain.cmake +++ b/android/android.toolchain.cmake @@ -163,7 +163,7 @@ set( CMAKE_SYSTEM_NAME Linux ) #this one not so much 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 ) file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATH ) set( ANDROID_NDK_SEARCH_PATH "${ANDROID_NDK_SEARCH_PATH}/android-ndk" ) @@ -668,11 +668,11 @@ if( ARMEABI OR ARMEABI_V7A ) set( CMAKE_CXX_FLAGS "-fPIC -Wno-psabi" ) set( CMAKE_C_FLAGS "-fPIC -Wno-psabi" ) if( ANDROID_USE_STLPORT ) - set( CMAKE_CXX_FLAGS "-fno-rtti -fno-exceptions" ) - set( CMAKE_C_FLAGS "-fno-rtti -fno-exceptions" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions" ) else() - set( CMAKE_CXX_FLAGS "-frtti -fexceptions" ) - set( CMAKE_C_FLAGS "-fexceptions" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fexceptions" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions" ) endif() 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__ ) @@ -682,11 +682,11 @@ elseif( X86 ) set( CMAKE_CXX_FLAGS "-ffunction-sections -funwind-tables" ) set( CMAKE_C_FLAGS "-ffunction-sections -funwind-tables" ) if( ANDROID_USE_STLPORT ) - set( CMAKE_CXX_FLAGS "-fno-rtti -fno-exceptions" ) - set( CMAKE_C_FLAGS "-fno-rtti -fno-exceptions" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions" ) else() - set( CMAKE_CXX_FLAGS "-frtti -fexceptions" ) - set( CMAKE_C_FLAGS "-fexceptions" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fexceptions" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions" ) endif() else() set( CMAKE_CXX_FLAGS "" ) diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake index 9495eca..a52e047 100644 --- a/cmake/OpenCVGenConfig.cmake +++ b/cmake/OpenCVGenConfig.cmake @@ -46,7 +46,7 @@ macro(ocv_generate_dependencies_map_configmake suffix configuration) get_filename_component(__libname "${__libname}" NAME) if(WIN32) - string(REGEX REPLACE "[.]dll$" ".lib" __libname "${__libname}") + string(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "${CMAKE_LINK_LIBRARY_SUFFIX}" __libname "${__libname}") endif() set(OPENCV_DEPENDENCIES_MAP_${suffix} "${OPENCV_DEPENDENCIES_MAP_${suffix}}set(OpenCV_${__ocv_lib}_LIBNAME_${suffix} \"${__libname}\")\n") diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index b275235..66e917a 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -538,7 +538,7 @@ macro(ocv_add_perf_tests) endif() 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 set_target_properties(${the_target} PROPERTIES @@ -588,7 +588,7 @@ macro(ocv_add_accuracy_tests) endif() 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 set_target_properties(${the_target} PROPERTIES diff --git a/cmake/OpenCVVersion.cmake b/cmake/OpenCVVersion.cmake index 2410325..0bf1d9d 100644 --- a/cmake/OpenCVVersion.cmake +++ b/cmake/OpenCVVersion.cmake @@ -1,28 +1,13 @@ 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]+" ) + 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_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}") # create a dependency on version file # 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) - -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() diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index ffd9c02..6057f65 100644 --- a/modules/core/src/persistence.cpp +++ b/modules/core/src/persistence.cpp @@ -139,7 +139,7 @@ string fromUtf16(const WString& str) { cv::AutoBuffer _buf(str.size()*4 + 1); char* buf = _buf; - + size_t sz = wcstombs(buf, str.c_str(), str.size()); if( sz == (size_t)-1 ) return string(); @@ -151,7 +151,7 @@ WString toUtf16(const string& str) { cv::AutoBuffer _buf(str.size() + 1); wchar_t* buf = _buf; - + size_t sz = mbstowcs(buf, str.c_str(), str.size()); if( sz == (size_t)-1 ) return WString(); @@ -753,7 +753,7 @@ cvGetFileNodeFromSeq( CvFileStorage* fs, value = (CvFileNode*)cvGetSeqElem( seq, index, 0 ); - + return value; }*/ @@ -852,12 +852,14 @@ icvProcessSpecialDouble( CvFileStorage* fs, char* buf, double* value, char** end if( c != '.' ) 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' ) - *(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' ) - *(uint64*)value = (uint64)-1; + v.i = (uint64)-1; else CV_PARSE_ERROR( "Bad format of floating-point constant" ); + *value = v.d; *endptr = buf + 4; } @@ -2018,7 +2020,7 @@ icvXMLParseTag( CvFileStorage* fs, char* ptr, CvStringHashNode** _tag, if( *ptr == '\0' ) CV_PARSE_ERROR( "Preliminary end of the stream" ); - + if( *ptr != '<' ) CV_PARSE_ERROR( "Tag should start with \'<\'" ); @@ -2615,7 +2617,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co fs->filename = (char*)cvMemStorageAlloc( fs->memstorage, fnamelen+1 ); strcpy( fs->filename, filename ); - + char* dot_pos = strrchr(fs->filename, '.'); char compression = '\0'; @@ -2684,7 +2686,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co 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_Assert( strlen(encoding) < 1000 ); char buf[1100]; sprintf(buf, "\n", encoding); @@ -3443,12 +3445,12 @@ icvReadMat( CvFileStorage* fs, CvFileNode* node ) data = cvGetFileNodeByName( fs, node, "data" ); if( !data ) CV_Error( CV_StsError, "The matrix data is not found in file storage" ); - + int nelems = icvFileNodeSeqLen( data ); if( nelems > 0 && nelems != rows*cols*CV_MAT_CN(elem_type) ) CV_Error( CV_StsUnmatchedSizes, "The matrix size does not match to the number of stored elements" ); - + if( nelems > 0 ) { mat = cvCreateMat( rows, cols, elem_type ); @@ -3533,18 +3535,18 @@ icvReadMatND( CvFileStorage* fs, CvFileNode* node ) data = cvGetFileNodeByName( fs, node, "data" ); if( !data ) 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++ ) total_size *= sizes[i]; - + int nelems = icvFileNodeSeqLen( data ); - + if( nelems > 0 && nelems != total_size ) CV_Error( CV_StsUnmatchedSizes, "The matrix size does not match to the number of stored elements" ); - + if( nelems > 0 ) { mat = cvCreateMatND( dims, sizes, elem_type ); @@ -4006,8 +4008,8 @@ icvWriteSeq( CvFileStorage* fs, const char* name, cvWriteInt( fs, "level", level ); dt = icvGetFormat( seq, "dt", &attr, 0, dt_buf ); - - strcpy(buf, ""); + + strcpy(buf, ""); if( CV_IS_SEQ_CLOSED(seq) ) strcat(buf, " closed"); if( CV_IS_SEQ_HOLE(seq) ) @@ -4016,11 +4018,11 @@ icvWriteSeq( CvFileStorage* fs, const char* name, strcat(buf, " curve"); if( CV_SEQ_ELTYPE(seq) == 0 && seq->elem_size != 1 ) strcat(buf, " untyped"); - + cvWriteString( fs, "flags", buf + (buf[0] ? 1 : 0), 1 ); - + cvWriteInt( fs, "count", seq->total ); - + cvWriteString( fs, "dt", dt, 0 ); icvWriteHeaderData( fs, seq, &attr, sizeof(CvSeq) ); @@ -4102,7 +4104,7 @@ icvReadSeq( CvFileStorage* fs, CvFileNode* node ) CV_Error( CV_StsError, "Some of essential sequence attributes are absent" ); flags = CV_SEQ_MAGIC_VAL; - + if( cv_isdigit(flags_str[0]) ) { const int OLD_SEQ_ELTYPE_BITS = 9; @@ -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_CLOSED = 1 << OLD_SEQ_FLAG_SHIFT; const int OLD_SEQ_FLAG_HOLE = 8 << OLD_SEQ_FLAG_SHIFT; - + int flags0 = (int)strtol( flags_str, &endptr, 16 ); if( endptr == flags_str || (flags0 & CV_MAGIC_MASK) != CV_SEQ_MAGIC_VAL ) CV_Error( CV_StsError, "The sequence flags are invalid" ); @@ -4471,14 +4473,14 @@ icvReadGraph( CvFileStorage* fs, CvFileNode* node ) CV_Error( CV_StsError, "Some of essential graph attributes are absent" ); flags = CV_SET_MAGIC_VAL + CV_GRAPH; - + if( isxdigit(flags_str[0]) ) { const int OLD_SEQ_ELTYPE_BITS = 9; const int OLD_SEQ_KIND_BITS = 3; 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; - + int flags0 = (int)strtol( flags_str, &endptr, 16 ); if( endptr == flags_str || (flags0 & CV_MAGIC_MASK) != CV_SET_MAGIC_VAL ) CV_Error( CV_StsError, "The sequence flags are invalid" ); @@ -4780,8 +4782,8 @@ cvFindType( const char* type_name ) if (type_name) for( info = CvType::first; info != 0; info = info->next ) if( strcmp( info->type_name, type_name ) == 0 ) - break; - + break; + return info; } @@ -4978,13 +4980,13 @@ stop_search: if( _real_name) { - if (real_name) - { - *_real_name = (const char*)cvAlloc(strlen(real_name)); - memcpy((void*)*_real_name, real_name, strlen(real_name)); - } else { - *_real_name = 0; - } + if (real_name) + { + *_real_name = (const char*)cvAlloc(strlen(real_name)); + memcpy((void*)*_real_name, real_name, strlen(real_name)); + } else { + *_real_name = 0; + } } return ptr; @@ -5150,7 +5152,7 @@ FileNode FileStorage::operator[](const string& nodename) const FileNode FileStorage::operator[](const char* nodename) const { return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename)); -} +} FileNode FileNode::operator[](const string& nodename) const { @@ -5167,13 +5169,13 @@ FileNode FileNode::operator[](int i) const return isSeq() ? FileNode(fs, (CvFileNode*)cvGetSeqElem(node->data.seq, i)) : i == 0 ? *this : FileNode(); } - + string FileNode::name() const { const char* str; return !node || (str = cvGetFileNodeName(node)) == 0 ? string() : string(str); -} - +} + void* FileNode::readObj() const { if( !fs || !node ) @@ -5294,7 +5296,7 @@ FileNodeIterator& FileNodeIterator::readRaw( const string& fmt, uchar* vec, size getElemSize( fmt, elem_size, cn ); CV_Assert( elem_size > 0 ); size_t count = std::min(remaining, maxCount); - + if( reader.seq ) { cvReadRawDataSlice( fs, &reader, (int)count, vec, fmt.c_str() ); @@ -5309,7 +5311,7 @@ FileNodeIterator& FileNodeIterator::readRaw( const string& fmt, uchar* vec, size return *this; } - + void write( FileStorage& fs, const string& name, int value ) { cvWriteInt( *fs, name.size() ? name.c_str() : 0, value ); } @@ -5332,9 +5334,9 @@ void writeScalar(FileStorage& fs, double value ) { cvWriteReal( *fs, 0, 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 ) { if( value.dims <= 2 ) @@ -5348,25 +5350,25 @@ void write( FileStorage& fs, const string& name, const Mat& value ) 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 ) { Ptr mat = (CvSparseMat*)value; cvWrite( *fs, name.size() ? name.c_str() : 0, mat ); } - - + + WriteStructContext::WriteStructContext(FileStorage& _fs, const string& name, int flags, const string& typeName) : fs(&_fs) { cvStartWriteStruct(**fs, !name.empty() ? name.c_str() : 0, flags, !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 ) { if( node.empty() ) @@ -5391,7 +5393,7 @@ void read( const FileNode& node, Mat& mat, const Mat& default_mat ) CV_Error(CV_StsBadArg, "Unknown array type"); } } - + void read( const FileNode& node, SparseMat& mat, const SparseMat& default_mat ) { if( node.empty() ) @@ -5403,7 +5405,7 @@ void read( const FileNode& node, SparseMat& mat, const SparseMat& default_mat ) CV_Assert(CV_IS_SPARSE_MAT(m)); SparseMat(m).copyTo(mat); } - + } /* End of file. */ diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 7cc1078..d59dc7b 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -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++ ) { _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++ ) { @@ -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 i, nplanes = it.nplanes; 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); - scalarToRawData(lb, lbuf, wtype, cn); - scalarToRawData(rb, rbuf, wtype, cn); + scalarToRawData(lb, lbuf.d, wtype, cn); + scalarToRawData(rb, rbuf.d, wtype, cn); 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 switch( depth ) { 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; 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; 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; 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; 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; 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; 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; default: CV_Error(CV_StsUnsupportedFormat, ""); diff --git a/modules/features2d/src/surf.cpp b/modules/features2d/src/surf.cpp index f4322a0..d544cbc 100644 --- a/modules/features2d/src/surf.cpp +++ b/modules/features2d/src/surf.cpp @@ -124,6 +124,7 @@ struct CvSurfHF { int p0, p1, p2, p3; float w; + CvSurfHF(): p0(0),p1(0),p2(0),p3(0),w(0) {} }; CV_INLINE float diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 720a116..4b59bc0 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -244,7 +244,7 @@ if(IOS) set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} bz2 "-framework QuartzCore" "-framework CoreFoundation" "-framework ImageIO" "-framework CoreGraphics" "-framework AVFoundation") endif() -if(MINGW) +if(WIN32) link_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include")#for directshow endif() @@ -270,5 +270,5 @@ set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "") ocv_add_precompiled_headers(${the_module}) -ocv_add_accuracy_tests(highgui opencv_imgproc) +ocv_add_accuracy_tests() ocv_add_perf_tests() diff --git a/modules/legacy/src/contourtree.cpp b/modules/legacy/src/contourtree.cpp index 95d361a..26851f1 100644 --- a/modules/legacy/src/contourtree.cpp +++ b/modules/legacy/src/contourtree.cpp @@ -586,7 +586,7 @@ icvCreateContourTree( const CvSeq * contour, CvMemStorage * storage, /* CV_WRITE_SEQ_ELEM (tree_one, start_writer); */ i_tree++; /* create Sequence hearder */ - *((CvSeq **) tree) = cvEndWriteSeq( &writer ); + *tree = (CvContourTree*)cvEndWriteSeq( &writer ); /* write points for the main segment into sequence header */ (*tree)->p1 = pt1[0]; diff --git a/modules/legacy/src/epilines.cpp b/modules/legacy/src/epilines.cpp index ad0b085..d8c2656 100644 --- a/modules/legacy/src/epilines.cpp +++ b/modules/legacy/src/epilines.cpp @@ -332,7 +332,6 @@ int icvComputeCoeffForStereo( CvStereoCamera* stereoCamera) } - /*--------------------------------------------------------------------------------------*/ int icvComCoeffForLine( CvPoint2D64d point1, CvPoint2D64d point2, @@ -350,33 +349,33 @@ int icvComCoeffForLine( CvPoint2D64d point1, /* Get direction for all points */ /* Direction for camera 1 */ - double direct1[3]; - double direct2[3]; - double camPoint1[3]; + CvPoint3D64f direct1; + CvPoint3D64f direct2; + CvPoint3D64f camPoint1; - double directS3[3]; - double directS4[3]; - double direct3[3]; - double direct4[3]; - double camPoint2[3]; + CvPoint3D64f directS3; + CvPoint3D64f directS4; + CvPoint3D64f direct3; + CvPoint3D64f direct4; + CvPoint3D64f camPoint2; icvGetDirectionForPoint( point1, camMatr1, - (CvPoint3D64d*)direct1); + &direct1); icvGetDirectionForPoint( point2, camMatr1, - (CvPoint3D64d*)direct2); + &direct2); /* Direction for camera 2 */ icvGetDirectionForPoint( point3, camMatr2, - (CvPoint3D64d*)directS3); + &directS3); icvGetDirectionForPoint( point4, camMatr2, - (CvPoint3D64d*)directS4); + &directS4); /* Create convertion for camera 2: two direction and camera point */ @@ -390,30 +389,30 @@ int icvComCoeffForLine( CvPoint2D64d point1, convRotMatr, convTransVect); - double zeroVect[3]; - zeroVect[0] = zeroVect[1] = zeroVect[2] = 0.0; - camPoint1[0] = camPoint1[1] = camPoint1[2] = 0.0; + CvPoint3D64f zeroVect; + zeroVect.x = zeroVect.y = zeroVect.z = 0.0; + camPoint1.x = camPoint1.y = camPoint1.z = 0.0; - icvConvertPointSystem(*((CvPoint3D64d*)directS3),(CvPoint3D64d*)direct3,convRotMatr,convTransVect); - icvConvertPointSystem(*((CvPoint3D64d*)directS4),(CvPoint3D64d*)direct4,convRotMatr,convTransVect); - icvConvertPointSystem(*((CvPoint3D64d*)zeroVect),(CvPoint3D64d*)camPoint2,convRotMatr,convTransVect); + icvConvertPointSystem(directS3,&direct3,convRotMatr,convTransVect); + icvConvertPointSystem(directS4,&direct4,convRotMatr,convTransVect); + icvConvertPointSystem(zeroVect,&camPoint2,convRotMatr,convTransVect); - double pointB[3]; + CvPoint3D64f pointB; int postype = 0; /* Changed order */ /* Compute point B: xB,yB,zB */ - icvGetCrossLines(*((CvPoint3D64d*)camPoint1),*((CvPoint3D64d*)direct2), - *((CvPoint3D64d*)camPoint2),*((CvPoint3D64d*)direct3), - (CvPoint3D64d*)pointB); + icvGetCrossLines(camPoint1,direct2, + camPoint2,direct3, + &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; - icvGetCrossLines(*((CvPoint3D64d*)camPoint1),*((CvPoint3D64d*)direct1), - *((CvPoint3D64d*)camPoint2),*((CvPoint3D64d*)direct4), - (CvPoint3D64d*)pointB); + icvGetCrossLines(camPoint1,direct1, + camPoint2,direct4, + &pointB); } CvPoint3D64d pointNewA; @@ -424,27 +423,27 @@ int icvComCoeffForLine( CvPoint2D64d point1, if( postype == 0 ) { - icvGetSymPoint3D( *((CvPoint3D64d*)camPoint1), - *((CvPoint3D64d*)direct1), - *((CvPoint3D64d*)pointB), + icvGetSymPoint3D( camPoint1, + direct1, + pointB, &pointNewA); - icvGetSymPoint3D( *((CvPoint3D64d*)camPoint2), - *((CvPoint3D64d*)direct4), - *((CvPoint3D64d*)pointB), + icvGetSymPoint3D( camPoint2, + direct4, + pointB, &pointNewC); } else {/* In this case we must change cameras */ *needSwapCamera = 1; - icvGetSymPoint3D( *((CvPoint3D64d*)camPoint2), - *((CvPoint3D64d*)direct3), - *((CvPoint3D64d*)pointB), + icvGetSymPoint3D( camPoint2, + direct3, + pointB, &pointNewA); - icvGetSymPoint3D( *((CvPoint3D64d*)camPoint1), - *((CvPoint3D64d*)direct2), - *((CvPoint3D64d*)pointB), + icvGetSymPoint3D( camPoint1, + direct2, + pointB, &pointNewC); } @@ -453,9 +452,9 @@ int icvComCoeffForLine( CvPoint2D64d point1, double x1,y1,z1; - x1 = camPoint1[0]; - y1 = camPoint1[1]; - z1 = camPoint1[2]; + x1 = camPoint1.x; + y1 = camPoint1.y; + z1 = camPoint1.z; double xA,yA,zA; double xB,yB,zB; @@ -465,9 +464,9 @@ int icvComCoeffForLine( CvPoint2D64d point1, yA = pointNewA.y; zA = pointNewA.z; - xB = pointB[0]; - yB = pointB[1]; - zB = pointB[2]; + xB = pointB.x; + yB = pointB.y; + zB = pointB.z; xC = pointNewC.x; yC = pointNewC.y; @@ -479,8 +478,8 @@ int icvComCoeffForLine( CvPoint2D64d point1, gamma = len2 / len1; icvComputeStereoLineCoeffs( pointNewA, - *((CvPoint3D64d*)pointB), - *((CvPoint3D64d*)camPoint1), + pointB, + camPoint1, gamma, coeffs); diff --git a/modules/ts/src/ts_perf.cpp b/modules/ts/src/ts_perf.cpp index 302e32d..f0fb361 100644 --- a/modules/ts/src/ts_perf.cpp +++ b/modules/ts/src/ts_perf.cpp @@ -834,8 +834,8 @@ void TestBase::reportMetrics(bool toJUnitXML) break; }; - LOGD("bytesIn =%11lu", m.bytesIn); - LOGD("bytesOut =%11lu", m.bytesOut); + LOGD("bytesIn =%11lu", (unsigned long)m.bytesIn); + LOGD("bytesOut =%11lu", (unsigned long)m.bytesOut); if (nIters == (unsigned int)-1 || m.terminationReason == performance_metrics::TERM_ITERATIONS) LOGD("samples =%11u", m.samples); else -- 2.7.4