Merge pull request #4051 from Dikay900:2_4_to_master_2

pull/4054/head
Vadim Pisarevsky 10 years ago
commit 786d62e3e5
  1. 7
      cmake/OpenCVModule.cmake
  2. 18
      cmake/OpenCVPackaging.cmake
  3. 5
      modules/calib3d/test/test_fisheye.cpp
  4. 4
      modules/cudaarithm/include/opencv2/cudaarithm.hpp
  5. 4
      modules/features2d/src/draw.cpp
  6. 15
      modules/imgcodecs/src/grfmt_tiff.cpp
  7. 32
      modules/imgcodecs/test/test_grfmt.cpp
  8. 5
      modules/imgproc/src/floodfill.cpp
  9. 13
      modules/superres/test/test_precomp.hpp
  10. 4
      modules/superres/test/test_superres.cpp
  11. 4
      modules/videoio/src/cap_dshow.cpp
  12. 16
      modules/videoio/src/cap_ffmpeg_impl.hpp

@ -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

@ -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)

@ -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");

@ -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(.)

@ -159,10 +159,10 @@ static void _prepareImgAndDrawKeypoints( InputArray img1, const std::vector<KeyP
if( !(flags & DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS) )
{
Mat _outImg1 = outImg( Rect(0, 0, img1size.width, img1size.height) );
drawKeypoints( _outImg1, keypoints1, _outImg1, singlePointColor, flags + DrawMatchesFlags::DRAW_OVER_OUTIMG );
drawKeypoints( _outImg1, keypoints1, _outImg1, singlePointColor, flags | DrawMatchesFlags::DRAW_OVER_OUTIMG );
Mat _outImg2 = outImg( Rect(img1size.width, 0, img2size.width, img2size.height) );
drawKeypoints( _outImg2, keypoints2, _outImg2, singlePointColor, flags + DrawMatchesFlags::DRAW_OVER_OUTIMG );
drawKeypoints( _outImg2, keypoints2, _outImg2, singlePointColor, flags | DrawMatchesFlags::DRAW_OVER_OUTIMG );
}
}

@ -48,6 +48,7 @@
#include "precomp.hpp"
#include "grfmt_tiff.hpp"
#include <opencv2/imgproc.hpp>
#include <limits>
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<uint32>::max()) )
tile_height0 = m_height;
AutoBuffer<uchar> _buffer( size_t(8) * tile_height0*tile_width0);
const size_t buffer_size = bpp * ncn * tile_height0 * tile_width0;
AutoBuffer<uchar> _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 )
{

@ -42,6 +42,8 @@
#include "test_precomp.hpp"
#include <fstream>
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<const char *>(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:

@ -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 )

@ -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

@ -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

@ -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;
}
}

@ -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;

Loading…
Cancel
Save