diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index d1558f406..a1a1b9020 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -782,9 +782,14 @@ macro(_ocv_create_module) ocv_install_target(${the_module} EXPORT OpenCVModules OPTIONAL RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT libs - LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT libs + LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT libs NAMELINK_SKIP ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT dev ) + get_target_property(_target_type ${the_module} TYPE) + if("${_target_type}" STREQUAL "SHARED_LIBRARY") + install(TARGETS ${the_module} + LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT dev NAMELINK_ONLY) + endif() foreach(m ${OPENCV_MODULE_${the_module}_CHILDREN} ${the_module}) # only "public" headers need to be installed diff --git a/cmake/OpenCVPackaging.cmake b/cmake/OpenCVPackaging.cmake index d88826464..59d602c5d 100644 --- a/cmake/OpenCVPackaging.cmake +++ b/cmake/OpenCVPackaging.cmake @@ -78,8 +78,22 @@ set(CPACK_COMPONENT_TESTS_DEPENDS libs) if(HAVE_CUDA) string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION}) - set(CPACK_DEB_LIBS_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}") - set(CPACK_DEB_DEV_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}") + if(${CUDA_VERSION} VERSION_LESS "6.5") + set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}") + set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}") + else() + set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-cudart-${cuda_version_suffix}, cuda-npp-${cuda_version_suffix}") + set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-cudart-dev-${cuda_version_suffix}, cuda-npp-dev-${cuda_version_suffix}") + if(HAVE_CUFFT) + set(CPACK_DEB_libs_PACKAGE_DEPENDS "${CPACK_DEB_libs_PACKAGE_DEPENDS}, cuda-cufft-${cuda_version_suffix}") + set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cufft-dev-${cuda_version_suffix}") + endif() + if(HAVE_HAVE_CUBLAS) + set(CPACK_DEB_libs_PACKAGE_DEPENDS "${CPACK_DEB_libs_PACKAGE_DEPENDS}, cuda-cublas-${cuda_version_suffix}") + set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cublas-dev-${cuda_version_suffix}") + endif() + endif() + set(CPACK_COMPONENT_dev_DEPENDS libs) endif() if(NOT OPENCV_CUSTOM_PACKAGE_INFO) diff --git a/modules/calib3d/test/test_fisheye.cpp b/modules/calib3d/test/test_fisheye.cpp index d4212e94f..ba05f1ee2 100644 --- a/modules/calib3d/test/test_fisheye.cpp +++ b/modules/calib3d/test/test_fisheye.cpp @@ -385,7 +385,12 @@ TEST_F(fisheyeTest, EtimateUncertainties) CV_Assert(errors.alpha == 0); } +#ifdef HAVE_TEGRA_OPTIMIZATION +// not passing accuracy constrains +TEST_F(fisheyeTest, DISABLED_rectify) +#else TEST_F(fisheyeTest, rectify) +#endif { const std::string folder =combine(datasets_repository_path, "calib-3_stereo_from_JY"); diff --git a/modules/cudaarithm/include/opencv2/cudaarithm.hpp b/modules/cudaarithm/include/opencv2/cudaarithm.hpp index 6e475db98..d377a70e7 100644 --- a/modules/cudaarithm/include/opencv2/cudaarithm.hpp +++ b/modules/cudaarithm/include/opencv2/cudaarithm.hpp @@ -211,8 +211,8 @@ CV_EXPORTS void pow(InputArray src, double power, OutputArray dst, Stream& strea @param dst Destination matrix that has the same size and type as the input array(s). @param cmpop Flag specifying the relation between the elements to be checked: - **CMP_EQ:** a(.) == b(.) -- **CMP_GT:** a(.) \< b(.) -- **CMP_GE:** a(.) \<= b(.) +- **CMP_GT:** a(.) \> b(.) +- **CMP_GE:** a(.) \>= b(.) - **CMP_LT:** a(.) \< b(.) - **CMP_LE:** a(.) \<= b(.) - **CMP_NE:** a(.) != b(.) diff --git a/modules/features2d/src/draw.cpp b/modules/features2d/src/draw.cpp index 6673e4631..63410e713 100644 --- a/modules/features2d/src/draw.cpp +++ b/modules/features2d/src/draw.cpp @@ -159,10 +159,10 @@ static void _prepareImgAndDrawKeypoints( InputArray img1, const std::vector +#include namespace cv { @@ -242,10 +243,12 @@ bool TiffDecoder::readData( Mat& img ) if( tile_width0 <= 0 ) tile_width0 = m_width; - if( tile_height0 <= 0 ) + if( tile_height0 <= 0 || + (!is_tiled && tile_height0 == std::numeric_limits::max()) ) tile_height0 = m_height; - AutoBuffer _buffer( size_t(8) * tile_height0*tile_width0); + const size_t buffer_size = bpp * ncn * tile_height0 * tile_width0; + AutoBuffer _buffer( buffer_size ); uchar* buffer = _buffer; ushort* buffer16 = (ushort*)buffer; float* buffer32 = (float*)buffer; @@ -311,9 +314,9 @@ bool TiffDecoder::readData( Mat& img ) case 16: { if( !is_tiled ) - ok = (int)TIFFReadEncodedStrip( tif, tileidx, (uint32*)buffer, (tsize_t)-1 ) >= 0; + ok = (int)TIFFReadEncodedStrip( tif, tileidx, (uint32*)buffer, buffer_size ) >= 0; else - ok = (int)TIFFReadEncodedTile( tif, tileidx, (uint32*)buffer, (tsize_t)-1 ) >= 0; + ok = (int)TIFFReadEncodedTile( tif, tileidx, (uint32*)buffer, buffer_size ) >= 0; if( !ok ) { @@ -382,9 +385,9 @@ bool TiffDecoder::readData( Mat& img ) case 64: { if( !is_tiled ) - ok = (int)TIFFReadEncodedStrip( tif, tileidx, buffer, (tsize_t)-1 ) >= 0; + ok = (int)TIFFReadEncodedStrip( tif, tileidx, buffer, buffer_size ) >= 0; else - ok = (int)TIFFReadEncodedTile( tif, tileidx, buffer, (tsize_t)-1 ) >= 0; + ok = (int)TIFFReadEncodedTile( tif, tileidx, buffer, buffer_size ) >= 0; if( !ok || ncn != 1 ) { diff --git a/modules/imgcodecs/test/test_grfmt.cpp b/modules/imgcodecs/test/test_grfmt.cpp index 92238a95f..ae0b428ec 100644 --- a/modules/imgcodecs/test/test_grfmt.cpp +++ b/modules/imgcodecs/test/test_grfmt.cpp @@ -42,6 +42,8 @@ #include "test_precomp.hpp" +#include + using namespace cv; using namespace std; @@ -673,6 +675,36 @@ TEST(Imgcodecs_Tiff, decode_tile_remainder) CV_GrfmtReadTifTiledWithNotFullTiles test; test.safe_run(); } +TEST(Imgcodecs_Tiff, decode_infinite_rowsperstrip) +{ + const uchar sample_data[142] = { + 0x49, 0x49, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x56, 0x54, + 0x56, 0x5a, 0x59, 0x55, 0x5a, 0x00, 0x0a, 0x00, 0x00, 0x01, + 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x02, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x03, 0x01, 0x03, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x01, + 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x15, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x16, 0x01, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x17, 0x01, 0x04, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1c, 0x01, 0x03, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + }; + + const string filename = cv::tempfile(".tiff"); + std::ofstream outfile(filename.c_str(), std::ofstream::binary); + outfile.write(reinterpret_cast(sample_data), sizeof sample_data); + outfile.close(); + + EXPECT_NO_THROW(cv::imread(filename, IMREAD_UNCHANGED)); + + remove(filename.c_str()); +} + class CV_GrfmtReadTifMultiPage : public cvtest::BaseTest { private: diff --git a/modules/imgproc/src/floodfill.cpp b/modules/imgproc/src/floodfill.cpp index 54a1fc976..6d8491a2a 100644 --- a/modules/imgproc/src/floodfill.cpp +++ b/modules/imgproc/src/floodfill.cpp @@ -484,6 +484,11 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask, int depth = img.depth(); int cn = img.channels(); + if ( (cn != 1) && (cn != 3) ) + { + CV_Error( CV_StsBadArg, "Number of channels in input image must be 1 or 3" ); + } + if( connectivity == 0 ) connectivity = 4; else if( connectivity != 4 && connectivity != 8 ) diff --git a/modules/superres/test/test_precomp.hpp b/modules/superres/test/test_precomp.hpp index 9e89b428e..b1c825746 100644 --- a/modules/superres/test/test_precomp.hpp +++ b/modules/superres/test/test_precomp.hpp @@ -59,4 +59,17 @@ #include "cvconfig.h" #include "../src/input_array_utility.hpp" +#if defined(HAVE_XINE) || \ + defined(HAVE_GSTREAMER) || \ + defined(HAVE_QUICKTIME) || \ + defined(HAVE_QTKIT) || \ + defined(HAVE_AVFOUNDATION) || \ + defined(HAVE_FFMPEG) || \ + defined(HAVE_MSMF) || \ + defined(HAVE_VFW) +# define BUILD_WITH_VIDEO_INPUT_SUPPORT 1 +#else +# define BUILD_WITH_VIDEO_INPUT_SUPPORT 0 +#endif + #endif diff --git a/modules/superres/test/test_superres.cpp b/modules/superres/test/test_superres.cpp index 74a90bdc2..56e9f542f 100644 --- a/modules/superres/test/test_superres.cpp +++ b/modules/superres/test/test_superres.cpp @@ -43,6 +43,8 @@ #include "test_precomp.hpp" #include "opencv2/ts/ocl_test.hpp" +#if BUILD_WITH_VIDEO_INPUT_SUPPORT + class AllignedFrameSource : public cv::superres::FrameSource { public: @@ -292,3 +294,5 @@ OCL_TEST_F(SuperResolution, BTVL1) } } // namespace cvtest::ocl #endif + +#endif // BUILD_WITH_VIDEO_INPUT_SUPPORT diff --git a/modules/videoio/src/cap_dshow.cpp b/modules/videoio/src/cap_dshow.cpp index c8c63fcb7..88814c83e 100644 --- a/modules/videoio/src/cap_dshow.cpp +++ b/modules/videoio/src/cap_dshow.cpp @@ -1839,6 +1839,8 @@ bool videoInput::setVideoSettingCamera(int deviceID, long Property, long lValue, hr = VDList[deviceID]->pVideoInputFilter->QueryInterface(IID_IAMCameraControl, (void**)&pIAMCameraControl); if (FAILED(hr)) { DebugPrintOut("Error\n"); + if(VDList[deviceID]->pVideoInputFilter)VDList[deviceID]->pVideoInputFilter->Release(); + if(VDList[deviceID]->pVideoInputFilter)VDList[deviceID]->pVideoInputFilter = NULL; return false; } else @@ -1857,6 +1859,8 @@ bool videoInput::setVideoSettingCamera(int deviceID, long Property, long lValue, pIAMCameraControl->Set(Property, lValue, Flags); } pIAMCameraControl->Release(); + if(VDList[deviceID]->pVideoInputFilter)VDList[deviceID]->pVideoInputFilter->Release(); + if(VDList[deviceID]->pVideoInputFilter)VDList[deviceID]->pVideoInputFilter = NULL; return true; } } diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp index f49301a8a..1504d2ae6 100644 --- a/modules/videoio/src/cap_ffmpeg_impl.hpp +++ b/modules/videoio/src/cap_ffmpeg_impl.hpp @@ -270,6 +270,10 @@ struct CvCapture_FFMPEG and so the filename is needed to reopen the file on backward seeking. */ char * filename; + +#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) + AVDictionary *dict; +#endif }; void CvCapture_FFMPEG::init() @@ -290,6 +294,10 @@ void CvCapture_FFMPEG::init() avcodec = 0; frame_number = 0; eps_zero = 0.000025; + +#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) + dict = NULL; +#endif } @@ -347,6 +355,11 @@ void CvCapture_FFMPEG::close() packet.data = NULL; } +#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) + if (dict != NULL) + av_dict_free(&dict); +#endif + init(); } @@ -554,6 +567,7 @@ bool CvCapture_FFMPEG::open( const char* _filename ) close(); #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) + av_dict_set(&dict, "rtsp_transport", "tcp", 0); int err = avformat_open_input(&ic, _filename, NULL, NULL); #else int err = av_open_input_file(&ic, _filename, NULL, 0, NULL); @@ -649,7 +663,7 @@ bool CvCapture_FFMPEG::grabFrame() int got_picture; int count_errs = 0; - const int max_number_of_attempts = 1 << 16; + const int max_number_of_attempts = 1 << 9; if( !ic || !video_st ) return false;