diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e1abd943d..2d4704779b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,6 +198,7 @@ OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binar OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) ) OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) ) OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX ) +OCV_OPTION(ENABLE_COVERAGE "Enable coverage collection with GCov" OFF IF CMAKE_COMPILER_IS_GNUCXX ) OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CMAKE_COMPILER_IS_GNUCXX AND NOT (APPLE AND CMAKE_COMPILER_IS_CLANGCXX) ) OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) ) OCV_OPTION(ENABLE_FAST_MATH "Enable -ffast-math (not recommended for GCC 4.6.x)" OFF IF (CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) ) @@ -418,8 +419,15 @@ include(cmake/OpenCVModule.cmake) # ---------------------------------------------------------------------------- # Detect endianness of build platform # ---------------------------------------------------------------------------- -include(TestBigEndian) -test_big_endian(WORDS_BIGENDIAN) + +if(CMAKE_SYSTEM_NAME STREQUAL iOS) + # test_big_endian needs try_compile, which doesn't work for iOS + # http://public.kitware.com/Bug/view.php?id=12288 + set(WORDS_BIGENDIAN 0) +else() + include(TestBigEndian) + test_big_endian(WORDS_BIGENDIAN) +endif() # ---------------------------------------------------------------------------- # Detect 3rd-party libraries diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index 59b19b601d..ba74ebe4ab 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -185,6 +185,11 @@ if(CMAKE_COMPILER_IS_GNUCXX) add_extra_compiler_option(-ffunction-sections) endif() + if(ENABLE_COVERAGE) + set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} --coverage") + set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} --coverage") + endif() + set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} -DNDEBUG") set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG") endif() diff --git a/cmake/OpenCVDetectCUDA.cmake b/cmake/OpenCVDetectCUDA.cmake index f655ce8cd6..89602acaa0 100644 --- a/cmake/OpenCVDetectCUDA.cmake +++ b/cmake/OpenCVDetectCUDA.cmake @@ -178,9 +178,8 @@ if(CUDA_FOUND) # we remove -Wsign-promo as it generates warnings under linux string(REPLACE "-Wsign-promo" "" ${var} "${${var}}") - # we remove -fvisibility-inlines-hidden because it's used for C++ compiler - # but NVCC uses C compiler by default - string(REPLACE "-fvisibility-inlines-hidden" "" ${var} "${${var}}") + # we remove -Wno-sign-promo as it generates warnings under linux + string(REPLACE "-Wno-sign-promo" "" ${var} "${${var}}") # we remove -Wno-delete-non-virtual-dtor because it's used for C++ compiler # but NVCC uses C compiler by default diff --git a/cmake/OpenCVFindIPP.cmake b/cmake/OpenCVFindIPP.cmake index 772cae886f..db02e6acbf 100644 --- a/cmake/OpenCVFindIPP.cmake +++ b/cmake/OpenCVFindIPP.cmake @@ -163,9 +163,16 @@ function(set_ipp_new_libraries _LATEST_VERSION) ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_SUFFIX}${IPP_LIB_SUFFIX} ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPI}${IPP_SUFFIX}${IPP_LIB_SUFFIX} ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPS}${IPP_SUFFIX}${IPP_LIB_SUFFIX} - ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${IPP_LIB_SUFFIX} - PARENT_SCOPE) + ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${IPP_LIB_SUFFIX}) + if (UNIX) + set(IPP_LIBRARIES + ${IPP_LIBRARIES} + ${IPP_LIB_PREFIX}irc${CMAKE_SHARED_LIBRARY_SUFFIX} + ${IPP_LIB_PREFIX}imf${CMAKE_SHARED_LIBRARY_SUFFIX} + ${IPP_LIB_PREFIX}svml${CMAKE_SHARED_LIBRARY_SUFFIX}) + endif() + set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE) return() endfunction() @@ -208,19 +215,39 @@ function(set_ipp_variables _LATEST_VERSION) set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE) if (APPLE) - set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib PARENT_SCOPE) + set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib) elseif (IPP_X64) if(NOT EXISTS ${IPP_ROOT_DIR}/lib/intel64) message(SEND_ERROR "IPP EM64T libraries not found") endif() - set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64 PARENT_SCOPE) + set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64) else() if(NOT EXISTS ${IPP_ROOT_DIR}/lib/ia32) message(SEND_ERROR "IPP IA32 libraries not found") endif() - set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/ia32 PARENT_SCOPE) + set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/ia32) endif() + if (UNIX) + get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../lib REALPATH) + if (IPP_X64) + if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/intel64) + message(SEND_ERROR "Intel compiler EM64T libraries not found") + endif() + set(IPP_LIBRARY_DIRS + ${IPP_LIBRARY_DIRS} + ${INTEL_COMPILER_LIBRARY_DIR}/intel64) + else() + if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/ia32) + message(SEND_ERROR "Intel compiler IA32 libraries not found") + endif() + set(IPP_LIBRARY_DIRS + ${IPP_LIBRARY_DIRS} + ${INTEL_COMPILER_LIBRARY_DIR}/ia32) + endif() + endif() + set(IPP_LIBRARY_DIRS ${IPP_LIBRARY_DIRS} PARENT_SCOPE) + # set IPP_LIBRARIES variable (7.x or 8.x lib names) set_ipp_new_libraries(${_LATEST_VERSION}) set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE) diff --git a/doc/conf.py b/doc/conf.py index 7d5908fc71..0112725b92 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -54,7 +54,7 @@ master_doc = 'index' # General information about the project. project = u'OpenCV' -copyright = u'2011-2013, opencv dev team' +copyright = u'2011-2014, opencv dev team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/doc/tutorials/imgproc/histograms/template_matching/template_matching.rst b/doc/tutorials/imgproc/histograms/template_matching/template_matching.rst index f4b30ef894..eb90369ff3 100644 --- a/doc/tutorials/imgproc/histograms/template_matching/template_matching.rst +++ b/doc/tutorials/imgproc/histograms/template_matching/template_matching.rst @@ -85,7 +85,7 @@ d. **method=CV\_TM\_CCORR\_NORMED** .. math:: - R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I'(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}} + R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}} e. **method=CV\_TM\_CCOEFF** diff --git a/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.rst b/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.rst index f32efd2920..f1f8205577 100644 --- a/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.rst +++ b/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.rst @@ -25,29 +25,34 @@ Let's use a simple program such as DisplayImage.cpp shown below. .. code-block:: cpp - #include - #include + #include + #include - using namespace cv; + using namespace cv; - int main( int argc, char** argv ) - { - Mat image; - image = imread( argv[1], 1 ); + int main(int argc, char** argv ) + { + if ( argc != 2 ) + { + printf("usage: DisplayImage.out \n"); + return -1; + } - if( argc != 2 || !image.data ) - { - printf( "No image data \n" ); - return -1; - } + Mat image; + image = imread( argv[1], 1 ); - namedWindow( "Display Image", WINDOW_AUTOSIZE ); - imshow( "Display Image", image ); + if ( !image.data ) + { + printf("No image data \n"); + return -1; + } + namedWindow("Display Image", WINDOW_AUTOSIZE ); + imshow("Display Image", image); - waitKey(0); + waitKey(0); - return 0; - } + return 0; + } Create a CMake file --------------------- diff --git a/doc/tutorials/introduction/load_save_image/load_save_image.rst b/doc/tutorials/introduction/load_save_image/load_save_image.rst index ac0ee02e5d..57d55d3a9e 100644 --- a/doc/tutorials/introduction/load_save_image/load_save_image.rst +++ b/doc/tutorials/introduction/load_save_image/load_save_image.rst @@ -99,7 +99,7 @@ Explanation imshow( imageName, image ); imshow( "Gray image", gray_image ); -#. Add add the *waitKey(0)* function call for the program to wait forever for an user key press. +#. Add the *waitKey(0)* function call for the program to wait forever for an user key press. Result diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt index a1cda724f4..e5898023f2 100644 --- a/modules/core/CMakeLists.txt +++ b/modules/core/CMakeLists.txt @@ -10,7 +10,7 @@ if(HAVE_WINRT) endif() if(HAVE_CUDA) - ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wenum-compare -Wunused-function) + ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wenum-compare -Wunused-function -Wshadow) endif() file(GLOB lib_cuda_hdrs "include/opencv2/${name}/cuda/*.hpp" "include/opencv2/${name}/cuda/*.h") diff --git a/modules/core/doc/basic_structures.rst b/modules/core/doc/basic_structures.rst index 280c317ae4..bd29b829c1 100644 --- a/modules/core/doc/basic_structures.rst +++ b/modules/core/doc/basic_structures.rst @@ -1620,7 +1620,7 @@ The method copies the matrix data to another matrix. Before copying the data, th so that the destination matrix is reallocated if needed. While ``m.copyTo(m);`` works flawlessly, the function does not handle the case of a partial overlap between the source and the destination matrices. -When the operation mask is specified, and the ``Mat::create`` call shown above reallocated the matrix, the newly allocated matrix is initialized with all zeros before copying the data. +When the operation mask is specified, if the ``Mat::create`` call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data. .. _Mat::convertTo: diff --git a/modules/core/perf/opencl/perf_bufferpool.cpp b/modules/core/perf/opencl/perf_bufferpool.cpp index abb0757515..2e01db4045 100644 --- a/modules/core/perf/opencl/perf_bufferpool.cpp +++ b/modules/core/perf/opencl/perf_bufferpool.cpp @@ -61,7 +61,7 @@ OCL_PERF_TEST_P(BufferPoolFixture, BufferPool_UMatCreation100, Bool()) } } - SANITY_CHECK_NOTHING() + SANITY_CHECK_NOTHING(); } OCL_PERF_TEST_P(BufferPoolFixture, BufferPool_UMatCountNonZero100, Bool()) @@ -79,7 +79,7 @@ OCL_PERF_TEST_P(BufferPoolFixture, BufferPool_UMatCountNonZero100, Bool()) } } - SANITY_CHECK_NOTHING() + SANITY_CHECK_NOTHING(); } OCL_PERF_TEST_P(BufferPoolFixture, BufferPool_UMatCanny10, Bool()) @@ -104,7 +104,7 @@ OCL_PERF_TEST_P(BufferPoolFixture, BufferPool_UMatCanny10, Bool()) } } - SANITY_CHECK_NOTHING() + SANITY_CHECK_NOTHING(); } OCL_PERF_TEST_P(BufferPoolFixture, BufferPool_UMatIntegral10, Bool()) @@ -124,7 +124,7 @@ OCL_PERF_TEST_P(BufferPoolFixture, BufferPool_UMatIntegral10, Bool()) } } - SANITY_CHECK_NOTHING() + SANITY_CHECK_NOTHING(); } } } // namespace cvtest::ocl diff --git a/modules/core/perf/opencl/perf_usage_flags.cpp b/modules/core/perf/opencl/perf_usage_flags.cpp index 275ff56e2f..3f59fec8be 100644 --- a/modules/core/perf/opencl/perf_usage_flags.cpp +++ b/modules/core/perf/opencl/perf_usage_flags.cpp @@ -34,7 +34,7 @@ OCL_PERF_TEST_P(UsageFlagsBoolFixture, UsageFlags_AllocHostMem, ::testing::Combi cv::subtract(dst, Scalar::all(1), final); } - SANITY_CHECK_NOTHING() + SANITY_CHECK_NOTHING(); } } } // namespace cvtest::ocl diff --git a/modules/cudaimgproc/src/cuda/canny.cu b/modules/cudaimgproc/src/cuda/canny.cu index 36cccb0e33..3d770e179d 100644 --- a/modules/cudaimgproc/src/cuda/canny.cu +++ b/modules/cudaimgproc/src/cuda/canny.cu @@ -293,8 +293,12 @@ namespace canny n += smem[threadIdx.y + 2][threadIdx.x + 2] == 2; } + __syncthreads(); + if (n > 0) smem[threadIdx.y + 1][threadIdx.x + 1] = 2; + + __syncthreads(); } const int e = smem[threadIdx.y + 1][threadIdx.x + 1]; diff --git a/modules/highgui/src/cap_ios_abstract_camera.mm b/modules/highgui/src/cap_ios_abstract_camera.mm index a77e200a82..b40b3648de 100644 --- a/modules/highgui/src/cap_ios_abstract_camera.mm +++ b/modules/highgui/src/cap_ios_abstract_camera.mm @@ -278,8 +278,20 @@ { self.captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.captureSession]; - if ([self.captureVideoPreviewLayer isOrientationSupported]) { - [self.captureVideoPreviewLayer setOrientation:self.defaultAVCaptureVideoOrientation]; + if ([self.captureVideoPreviewLayer respondsToSelector:@selector(connection)]) + { + if ([self.captureVideoPreviewLayer.connection isVideoOrientationSupported]) + { + [self.captureVideoPreviewLayer.connection setVideoOrientation:self.defaultAVCaptureVideoOrientation]; + } + } + else + { + // Deprecated in 6.0; here for backward compatibility + if ([self.captureVideoPreviewLayer isOrientationSupported]) + { + [self.captureVideoPreviewLayer setOrientation:self.defaultAVCaptureVideoOrientation]; + } } if (parentView != nil) { @@ -290,9 +302,6 @@ NSLog(@"[Camera] created AVCaptureVideoPreviewLayer"); } - - - - (void)setDesiredCameraPosition:(AVCaptureDevicePosition)desiredPosition; { for (AVCaptureDevice *device in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]) { diff --git a/modules/highgui/src/grfmt_tiff.cpp b/modules/highgui/src/grfmt_tiff.cpp index 03e30c73ce..9013c39d11 100644 --- a/modules/highgui/src/grfmt_tiff.cpp +++ b/modules/highgui/src/grfmt_tiff.cpp @@ -259,11 +259,15 @@ bool TiffDecoder::readData( Mat& img ) { case 8: { + uchar * bstart = buffer; if( !is_tiled ) ok = TIFFReadRGBAStrip( tif, y, (uint32*)buffer ); else + { ok = TIFFReadRGBATile( tif, x, y, (uint32*)buffer ); - + //Tiles fill the buffer from the bottom up + bstart += (tile_height0 - tile_height) * tile_width0 * 4; + } if( !ok ) { close(); @@ -275,19 +279,19 @@ bool TiffDecoder::readData( Mat& img ) { if (wanted_channels == 4) { - icvCvt_BGRA2RGBA_8u_C4R( buffer + i*tile_width*4, 0, + icvCvt_BGRA2RGBA_8u_C4R( bstart + i*tile_width0*4, 0, data + x*4 + img.step*(tile_height - i - 1), 0, cvSize(tile_width,1) ); } else { - icvCvt_BGRA2BGR_8u_C4C3R( buffer + i*tile_width*4, 0, + icvCvt_BGRA2BGR_8u_C4C3R( bstart + i*tile_width0*4, 0, data + x*3 + img.step*(tile_height - i - 1), 0, cvSize(tile_width,1), 2 ); } } else - icvCvt_BGRA2Gray_8u_C4C1R( buffer + i*tile_width*4, 0, + icvCvt_BGRA2Gray_8u_C4C1R( bstart + i*tile_width0*4, 0, data + x + img.step*(tile_height - i - 1), 0, cvSize(tile_width,1), 2 ); break; @@ -312,19 +316,19 @@ bool TiffDecoder::readData( Mat& img ) { if( ncn == 1 ) { - icvCvt_Gray2BGR_16u_C1C3R(buffer16 + i*tile_width*ncn, 0, + icvCvt_Gray2BGR_16u_C1C3R(buffer16 + i*tile_width0*ncn, 0, (ushort*)(data + img.step*i) + x*3, 0, cvSize(tile_width,1) ); } else if( ncn == 3 ) { - icvCvt_RGB2BGR_16u_C3R(buffer16 + i*tile_width*ncn, 0, + icvCvt_RGB2BGR_16u_C3R(buffer16 + i*tile_width0*ncn, 0, (ushort*)(data + img.step*i) + x*3, 0, cvSize(tile_width,1) ); } else { - icvCvt_BGRA2BGR_16u_C4C3R(buffer16 + i*tile_width*ncn, 0, + icvCvt_BGRA2BGR_16u_C4C3R(buffer16 + i*tile_width0*ncn, 0, (ushort*)(data + img.step*i) + x*3, 0, cvSize(tile_width,1), 2 ); } @@ -334,12 +338,12 @@ bool TiffDecoder::readData( Mat& img ) if( ncn == 1 ) { memcpy((ushort*)(data + img.step*i)+x, - buffer16 + i*tile_width*ncn, + buffer16 + i*tile_width0*ncn, tile_width*sizeof(buffer16[0])); } else { - icvCvt_BGRA2Gray_16u_CnC1R(buffer16 + i*tile_width*ncn, 0, + icvCvt_BGRA2Gray_16u_CnC1R(buffer16 + i*tile_width0*ncn, 0, (ushort*)(data + img.step*i) + x, 0, cvSize(tile_width,1), ncn, 2 ); } @@ -367,13 +371,13 @@ bool TiffDecoder::readData( Mat& img ) if(dst_bpp == 32) { memcpy((float*)(data + img.step*i)+x, - buffer32 + i*tile_width*ncn, + buffer32 + i*tile_width0*ncn, tile_width*sizeof(buffer32[0])); } else { memcpy((double*)(data + img.step*i)+x, - buffer64 + i*tile_width*ncn, + buffer64 + i*tile_width0*ncn, tile_width*sizeof(buffer64[0])); } } diff --git a/modules/highgui/test/test_grfmt.cpp b/modules/highgui/test/test_grfmt.cpp index 0343ba154e..eca77e1dba 100644 --- a/modules/highgui/test/test_grfmt.cpp +++ b/modules/highgui/test/test_grfmt.cpp @@ -471,6 +471,47 @@ TEST(Highgui_Tiff, write_read_16bit_big_little_endian) } } +class CV_GrfmtReadTifTiledWithNotFullTiles: public cvtest::BaseTest +{ +public: + void run(int) + { + try + { + /* see issue #3472 - dealing with tiled images where the tile size is + * not a multiple of image size. + * The tiled images were created with 'convert' from ImageMagick, + * using the command 'convert -define tiff:tile-geometry=128x128 -depth [8|16] + * Note that the conversion to 16 bits expands the range from 0-255 to 0-255*255, + * so the test converts back but rounding errors cause small differences. + */ + cv::Mat img = imread(string(ts->get_data_path()) + "readwrite/non_tiled.tif",-1); + if (img.empty()) ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA); + ASSERT_TRUE(img.channels() == 3); + cv::Mat tiled8 = imread(string(ts->get_data_path()) + "readwrite/tiled_8.tif", -1); + if (tiled8.empty()) ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA); + ASSERT_PRED_FORMAT2(cvtest::MatComparator(0, 0), img, tiled8); + + cv::Mat tiled16 = imread(string(ts->get_data_path()) + "readwrite/tiled_16.tif", -1); + if (tiled16.empty()) ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA); + ASSERT_TRUE(tiled16.elemSize() == 6); + tiled16.convertTo(tiled8, CV_8UC3, 1./256.); + ASSERT_PRED_FORMAT2(cvtest::MatComparator(2, 0), img, tiled8); + // What about 32, 64 bit? + } + catch(...) + { + ts->set_failed_test_info(cvtest::TS::FAIL_EXCEPTION); + } + ts->set_failed_test_info(cvtest::TS::OK); + } +}; + +TEST(Highgui_Tiff, decode_tile_remainder) +{ + CV_GrfmtReadTifTiledWithNotFullTiles test; test.safe_run(); +} + #endif #ifdef HAVE_WEBP diff --git a/modules/imgproc/src/clahe.cpp b/modules/imgproc/src/clahe.cpp index 138bf83b55..e50d7088d9 100644 --- a/modules/imgproc/src/clahe.cpp +++ b/modules/imgproc/src/clahe.cpp @@ -133,8 +133,8 @@ namespace class CLAHE_CalcLut_Body : public cv::ParallelLoopBody { public: - CLAHE_CalcLut_Body(const cv::Mat& src, cv::Mat& lut, cv::Size tileSize, int tilesX, int tilesY, int clipLimit, float lutScale) : - src_(src), lut_(lut), tileSize_(tileSize), tilesX_(tilesX), tilesY_(tilesY), clipLimit_(clipLimit), lutScale_(lutScale) + CLAHE_CalcLut_Body(const cv::Mat& src, cv::Mat& lut, cv::Size tileSize, int tilesX, int clipLimit, float lutScale) : + src_(src), lut_(lut), tileSize_(tileSize), tilesX_(tilesX), clipLimit_(clipLimit), lutScale_(lutScale) { } @@ -146,7 +146,6 @@ namespace cv::Size tileSize_; int tilesX_; - int tilesY_; int clipLimit_; float lutScale_; }; @@ -401,7 +400,7 @@ namespace cv::Mat srcForLut = _srcForLut.getMat(); lut_.create(tilesX_ * tilesY_, histSize, CV_8UC1); - CLAHE_CalcLut_Body calcLutBody(srcForLut, lut_, tileSize, tilesX_, tilesY_, clipLimit, lutScale); + CLAHE_CalcLut_Body calcLutBody(srcForLut, lut_, tileSize, tilesX_, clipLimit, lutScale); cv::parallel_for_(cv::Range(0, tilesX_ * tilesY_), calcLutBody); CLAHE_Interpolation_Body interpolationBody(src, dst, lut_, tileSize, tilesX_, tilesY_); diff --git a/modules/imgproc/src/color.cpp b/modules/imgproc/src/color.cpp index 5dfcbc9569..3822ab3c16 100644 --- a/modules/imgproc/src/color.cpp +++ b/modules/imgproc/src/color.cpp @@ -2272,7 +2272,7 @@ struct YUV420p2RGB888Invoker : ParallelLoopBody const int rangeBegin = range.start * 2; const int rangeEnd = range.end * 2; - size_t uvsteps[2] = {width/2, stride - width/2}; + int uvsteps[2] = {width/2, stride - width/2}; int usIdx = ustepIdx, vsIdx = vstepIdx; const uchar* y1 = my1 + rangeBegin * stride; @@ -2340,7 +2340,7 @@ struct YUV420p2RGBA8888Invoker : ParallelLoopBody int rangeBegin = range.start * 2; int rangeEnd = range.end * 2; - size_t uvsteps[2] = {width/2, stride - width/2}; + int uvsteps[2] = {width/2, stride - width/2}; int usIdx = ustepIdx, vsIdx = vstepIdx; const uchar* y1 = my1 + rangeBegin * stride; diff --git a/modules/imgproc/src/floodfill.cpp b/modules/imgproc/src/floodfill.cpp index c49611f609..9e5067a87d 100644 --- a/modules/imgproc/src/floodfill.cpp +++ b/modules/imgproc/src/floodfill.cpp @@ -42,7 +42,7 @@ #include "precomp.hpp" -#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) # pragma GCC diagnostic ignored "-Warray-bounds" #endif diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index a9e16ec4ef..2d401275c4 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -1216,8 +1216,13 @@ public: alpha(_alpha), _beta(__beta), ssize(_ssize), dsize(_dsize), ksize(_ksize), xmin(_xmin), xmax(_xmax) { + CV_Assert(ksize <= MAX_ESIZE); } +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Warray-bounds" +#endif virtual void operator() (const Range& range) const { int dy, cn = src.channels(); @@ -1266,6 +1271,9 @@ public: vresize( (const WT**)rows, (T*)(dst.data + dst.step*dy), beta, dsize.width ); } } +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +# pragma GCC diagnostic pop +#endif private: Mat src; @@ -1273,7 +1281,9 @@ private: const int* xofs, *yofs; const AT* alpha, *_beta; Size ssize, dsize; - int ksize, xmin, xmax; + const int ksize, xmin, xmax; + + resizeGeneric_Invoker& operator = (const resizeGeneric_Invoker&); }; template diff --git a/modules/imgproc/src/moments.cpp b/modules/imgproc/src/moments.cpp index 98c542b208..a8cfc96132 100644 --- a/modules/imgproc/src/moments.cpp +++ b/modules/imgproc/src/moments.cpp @@ -203,6 +203,10 @@ static Moments contourMoments( const Mat& contour ) \****************************************************************************************/ template +#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 9 +// Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60196 +__attribute__((optimize("no-tree-vectorize"))) +#endif static void momentsInTile( const Mat& img, double* moments ) { Size size = img.size(); diff --git a/modules/imgproc/test/test_convhull.cpp b/modules/imgproc/test/test_convhull.cpp index cb9944fd63..2b6169cf5b 100644 --- a/modules/imgproc/test/test_convhull.cpp +++ b/modules/imgproc/test/test_convhull.cpp @@ -1380,7 +1380,7 @@ CV_FitLineTest::CV_FitLineTest() max_noise = 0.05; } -#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Warray-bounds" #endif @@ -1456,7 +1456,7 @@ void CV_FitLineTest::generate_point_set( void* pointsSet ) } } -#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) # pragma GCC diagnostic pop #endif @@ -1484,7 +1484,7 @@ void CV_FitLineTest::run_func() cv::fitLine(cv::cvarrToMat(points), (cv::Vec6f&)line[0], dist_type, 0, reps, aeps); } -#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Warray-bounds" #endif @@ -1567,7 +1567,7 @@ _exit_: return code; } -#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) # pragma GCC diagnostic pop #endif diff --git a/modules/legacy/src/bgfg_gaussmix.cpp b/modules/legacy/src/bgfg_gaussmix.cpp index 4a19fde386..415e63a0e9 100644 --- a/modules/legacy/src/bgfg_gaussmix.cpp +++ b/modules/legacy/src/bgfg_gaussmix.cpp @@ -413,7 +413,7 @@ CV_INLINE int _icvRemoveShadowGMM(float* data, int nD, //IEEE Trans. on Pattern Analysis and Machine Intelligence, vol.26, no.5, pages 651-656, 2004 //http://www.zoranz.net/Publications/zivkovic2004PAMI.pdf -#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif @@ -606,7 +606,7 @@ CV_INLINE int _icvUpdateGMM(float* data, int nD, return bBackground; } -#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) # pragma GCC diagnostic pop #endif diff --git a/modules/legacy/src/face.cpp b/modules/legacy/src/face.cpp index b188a10def..2132ea8f95 100644 --- a/modules/legacy/src/face.cpp +++ b/modules/legacy/src/face.cpp @@ -200,6 +200,7 @@ void RFace::CalculateError(FaceData * lpFaceData) void RFace::CreateFace(void * lpData) { FaceData Data; + memset(&Data, 0, sizeof(FaceData)); double Error = MAX_ERROR; double CurError = MAX_ERROR; diff --git a/modules/legacy/src/lmeds.cpp b/modules/legacy/src/lmeds.cpp index 33b57a7597..d1bb298ec1 100644 --- a/modules/legacy/src/lmeds.cpp +++ b/modules/legacy/src/lmeds.cpp @@ -163,7 +163,7 @@ icvLMedS( int *points1, int *points2, int numPoints, CvMatrix3 * fundamentalMatr /*===========================================================================*/ /*===========================================================================*/ -#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Warray-bounds" #endif @@ -328,7 +328,7 @@ icvCubic( double a2, double a1, double a0, double *squares ) return CV_NO_ERR; } /* icvCubic */ -#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) # pragma GCC diagnostic pop #endif diff --git a/modules/nonfree/CMakeLists.txt b/modules/nonfree/CMakeLists.txt index 86caca9d73..851646f259 100644 --- a/modules/nonfree/CMakeLists.txt +++ b/modules/nonfree/CMakeLists.txt @@ -3,5 +3,5 @@ if(BUILD_ANDROID_PACKAGE) endif() set(the_description "Functionality with possible limitations on the use") -ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef) +ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wshadow) ocv_define_module(nonfree opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_cudaarithm) diff --git a/modules/photo/src/cuda/nlm.cu b/modules/photo/src/cuda/nlm.cu index 371dab592c..2c36239616 100644 --- a/modules/photo/src/cuda/nlm.cu +++ b/modules/photo/src/cuda/nlm.cu @@ -264,7 +264,7 @@ namespace cv { namespace cuda { namespace device __device__ __forceinline__ int calcDist(const uchar2& a, const uchar2& b) { return (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y); } __device__ __forceinline__ int calcDist(const uchar3& a, const uchar3& b) { return (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) + (a.z-b.z)*(a.z-b.z); } - template struct FastNonLocalMenas + template struct FastNonLocalMeans { enum { @@ -288,7 +288,7 @@ namespace cv { namespace cuda { namespace device int block_window; float minus_h2_inv; - FastNonLocalMenas(int search_window_, int block_window_, float h) : search_radius(search_window_/2), block_radius(block_window_/2), + FastNonLocalMeans(int search_window_, int block_window_, float h) : search_radius(search_window_/2), block_radius(block_window_/2), search_window(search_window_), block_window(block_window_), minus_h2_inv(-1.f/(h * h * VecTraits::cn)) {} PtrStep src; @@ -392,7 +392,7 @@ namespace cv { namespace cuda { namespace device } } - __device__ __forceinline__ void convolve_window(int i, int j, const int* dist_sums, PtrStepi& col_sums, PtrStepi& up_col_sums, T& dst) const + __device__ __forceinline__ void convolve_window(int i, int j, const int* dist_sums, T& dst) const { typedef typename TypeVec::cn>::vec_type sum_type; @@ -469,18 +469,18 @@ namespace cv { namespace cuda { namespace device __syncthreads(); - convolve_window(i, j, dist_sums, col_sums, up_col_sums, dst(i, j)); + convolve_window(i, j, dist_sums, dst(i, j)); } } }; template - __global__ void fast_nlm_kernel(const FastNonLocalMenas fnlm, PtrStepSz dst) { fnlm(dst); } + __global__ void fast_nlm_kernel(const FastNonLocalMeans fnlm, PtrStepSz dst) { fnlm(dst); } void nln_fast_get_buffer_size(const PtrStepSzb& src, int search_window, int block_window, int& buffer_cols, int& buffer_rows) { - typedef FastNonLocalMenas FNLM; + typedef FastNonLocalMeans FNLM; dim3 grid(divUp(src.cols, FNLM::TILE_COLS), divUp(src.rows, FNLM::TILE_ROWS)); buffer_cols = search_window * search_window * grid.y; @@ -491,7 +491,7 @@ namespace cv { namespace cuda { namespace device void nlm_fast_gpu(const PtrStepSzb& src, PtrStepSzb dst, PtrStepi buffer, int search_window, int block_window, float h, cudaStream_t stream) { - typedef FastNonLocalMenas FNLM; + typedef FastNonLocalMeans FNLM; FNLM fnlm(search_window, block_window, h); fnlm.src = (PtrStepSz)src; diff --git a/modules/superres/CMakeLists.txt b/modules/superres/CMakeLists.txt index 7514833b6d..092b1cd408 100644 --- a/modules/superres/CMakeLists.txt +++ b/modules/superres/CMakeLists.txt @@ -3,6 +3,6 @@ if(ANDROID OR IOS) endif() set(the_description "Super Resolution") -ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 -Wundef) +ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 -Wundef -Wshadow) ocv_define_module(superres opencv_imgproc opencv_video OPTIONAL opencv_highgui opencv_cudaarithm opencv_cudafilters opencv_cudawarping opencv_cudaimgproc opencv_cudaoptflow opencv_cudacodec) diff --git a/modules/ts/include/opencv2/ts/ts_perf.hpp b/modules/ts/include/opencv2/ts/ts_perf.hpp index 479e634c1e..e3b6481d10 100644 --- a/modules/ts/include/opencv2/ts/ts_perf.hpp +++ b/modules/ts/include/opencv2/ts/ts_perf.hpp @@ -205,7 +205,7 @@ private: #define SANITY_CHECK_MOMENTS(array, ...) ::perf::Regression::addMoments(this, #array, array , ## __VA_ARGS__) #define SANITY_CHECK_KEYPOINTS(array, ...) ::perf::Regression::addKeypoints(this, #array, array , ## __VA_ARGS__) #define SANITY_CHECK_MATCHES(array, ...) ::perf::Regression::addMatches(this, #array, array , ## __VA_ARGS__) -#define SANITY_CHECK_NOTHING() this->setVerified(); +#define SANITY_CHECK_NOTHING() this->setVerified() class CV_EXPORTS GpuPerf { diff --git a/modules/ts/misc/xls-report.py b/modules/ts/misc/xls-report.py index e71a7f66c7..6b90b59247 100755 --- a/modules/ts/misc/xls-report.py +++ b/modules/ts/misc/xls-report.py @@ -97,6 +97,9 @@ re_data_type = re.compile(r'^ (?: 8 | 16 | 32 | 64 ) [USF] C [1234] $', re.VERBO time_style = xlwt.easyxf(num_format_str='#0.00') no_time_style = xlwt.easyxf('pattern: pattern solid, fore_color gray25') +failed_style = xlwt.easyxf('pattern: pattern solid, fore_color red') +noimpl_style = xlwt.easyxf('pattern: pattern solid, fore_color orange') +style_dict = {"failed": failed_style, "noimpl":noimpl_style} speedup_style = time_style good_speedup_style = xlwt.easyxf('font: color green', num_format_str='#0.00') @@ -328,7 +331,7 @@ def main(): for c in config_names: if c in configs: - sheet.write(row, col, configs[c], time_style) + sheet.write(row, col, configs[c], style_dict.get(configs[c], time_style)) else: sheet.write(row, col, None, no_time_style) col += 1 diff --git a/modules/ts/src/ts_arrtest.cpp b/modules/ts/src/ts_arrtest.cpp index a3a058c518..8ba0b3786e 100644 --- a/modules/ts/src/ts_arrtest.cpp +++ b/modules/ts/src/ts_arrtest.cpp @@ -123,7 +123,7 @@ void ArrayTest::get_test_array_types_and_sizes( int /*test_case_idx*/, vector