From 50ad6909930b861d0beed87d2110f3c221b58563 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Fri, 18 May 2012 12:18:17 +0000 Subject: [PATCH] Merged the trunk till r8291 --- android/scripts/cmake_android_x86.sh | 9 ++++++ .../calib3d/test/test_chesscorners_timing.cpp | 1 - modules/core/perf/perf_addWeighted.cpp | 29 +++++++++++++++++++ modules/core/perf/perf_inRange.cpp | 26 +++++++++++++++++ modules/core/src/arithm.cpp | 8 ++--- modules/core/src/convert.cpp | 28 +++++++++--------- modules/core/src/opengl_interop.cpp | 2 +- modules/core/src/stat.cpp | 12 ++++---- modules/gpu/doc/video.rst | 7 ++++- modules/gpu/src/gftt.cpp | 2 +- modules/gpu/src/imgproc.cpp | 4 +-- modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu | 2 +- modules/gpu/src/nvidia/core/NCV.cu | 8 ++--- modules/gpu/src/nvidia/core/NCVPyramid.cu | 7 +++-- modules/gpu/src/optical_flow.cpp | 10 +++---- modules/gpu/src/orb.cpp | 4 +-- modules/gpu/src/precomp.hpp | 10 +++---- modules/gpu/src/stereocsbp.cpp | 2 +- modules/gpu/test/test_video.cpp | 2 +- modules/java/gen_java.py | 9 ++++++ .../video/include/opencv2/video/tracking.hpp | 8 +++-- samples/gpu/brox_optical_flow.cpp | 4 +-- samples/gpu/cascadeclassifier.cpp | 6 ++-- samples/gpu/opticalflow_nvidia_api.cpp | 4 +-- samples/python2/gaussian_mix.py | 3 +- 25 files changed, 143 insertions(+), 64 deletions(-) create mode 100755 android/scripts/cmake_android_x86.sh create mode 100644 modules/core/perf/perf_addWeighted.cpp create mode 100644 modules/core/perf/perf_inRange.cpp diff --git a/android/scripts/cmake_android_x86.sh b/android/scripts/cmake_android_x86.sh new file mode 100755 index 0000000000..a01df2e668 --- /dev/null +++ b/android/scripts/cmake_android_x86.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +cd `dirname $0`/.. + +mkdir -p build_x86 +cd build_x86 + +cmake -DANDROID_ABI=x86 -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../.. + diff --git a/modules/calib3d/test/test_chesscorners_timing.cpp b/modules/calib3d/test/test_chesscorners_timing.cpp index cc7625793b..1fd9e4a30d 100644 --- a/modules/calib3d/test/test_chesscorners_timing.cpp +++ b/modules/calib3d/test/test_chesscorners_timing.cpp @@ -75,7 +75,6 @@ void CV_ChessboardDetectorTimingTest::run( int start_from ) sprintf( filepath, "%scameracalibration/", ts->get_data_path().c_str() ); sprintf( filename, "%schessboard_timing_list.dat", filepath ); - printf("Reading file %s\n", filename); CvFileStorage* fs = cvOpenFileStorage( filename, 0, CV_STORAGE_READ ); CvFileNode* board_list = fs ? cvGetFileNodeByName( fs, 0, "boards" ) : 0; diff --git a/modules/core/perf/perf_addWeighted.cpp b/modules/core/perf/perf_addWeighted.cpp new file mode 100644 index 0000000000..6eeded45c9 --- /dev/null +++ b/modules/core/perf/perf_addWeighted.cpp @@ -0,0 +1,29 @@ +#include "perf_precomp.hpp" + +using namespace std; +using namespace cv; +using namespace perf; +using std::tr1::make_tuple; +using std::tr1::get; + +#define TYPICAL_MAT_TYPES_ADWEIGHTED CV_8UC1, CV_8UC4, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1, CV_32SC4 +#define TYPICAL_MATS_ADWEIGHTED testing::Combine(testing::Values(szVGA, sz720p, sz1080p), testing::Values(TYPICAL_MAT_TYPES_ADWEIGHTED)) + +PERF_TEST_P(Size_MatType, addWeighted, TYPICAL_MATS_ADWEIGHTED) +{ + Size size = get<0>(GetParam()); + int type = get<1>(GetParam()); + Mat src1(size, type); + Mat src2(size, type); + double alpha = 3.75; + double beta = -0.125; + double gamma = 100.0; + + Mat dst(size, type); + + declare.in(src1, src2, dst, WARMUP_RNG).out(dst); + + TEST_CYCLE() cv::addWeighted( src1, alpha, src2, beta, gamma, dst, dst.type() ); + + SANITY_CHECK(dst); +} diff --git a/modules/core/perf/perf_inRange.cpp b/modules/core/perf/perf_inRange.cpp new file mode 100644 index 0000000000..c4268f2154 --- /dev/null +++ b/modules/core/perf/perf_inRange.cpp @@ -0,0 +1,26 @@ +#include "perf_precomp.hpp" + +using namespace std; +using namespace cv; +using namespace perf; +using std::tr1::make_tuple; +using std::tr1::get; + +#define TYPICAL_MAT_TYPES_INRANGE CV_8UC1, CV_8UC4, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1, CV_32FC1, CV_32FC4 +#define TYPICAL_MATS_INRANGE testing::Combine(testing::Values(szVGA, sz720p, sz1080p), testing::Values(TYPICAL_MAT_TYPES_INRANGE)) + +PERF_TEST_P(Size_MatType, inRange, TYPICAL_MATS_INRANGE) +{ + Size size = get<0>(GetParam()); + int type = get<1>(GetParam()); + Mat src1(size, type); + Mat src2(size, type); + Mat src3(size, type); + Mat dst(size, type); + + declare.in(src1, src2, src3, WARMUP_RNG).out(dst); + + TEST_CYCLE() inRange( src1, src2, src3, dst ); + + SANITY_CHECK(dst); +} diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index 97c865960f..a5c21117e7 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -1984,8 +1984,8 @@ static void addWeighted64f( const double* src1, size_t step1, const double* src2 static BinaryFunc addWeightedTab[] = { - (BinaryFunc)addWeighted8u, (BinaryFunc)addWeighted8s, (BinaryFunc)addWeighted16u, - (BinaryFunc)addWeighted16s, (BinaryFunc)addWeighted32s, (BinaryFunc)addWeighted32f, + (BinaryFunc)GET_OPTIMIZED(addWeighted8u), (BinaryFunc)GET_OPTIMIZED(addWeighted8s), (BinaryFunc)GET_OPTIMIZED(addWeighted16u), + (BinaryFunc)GET_OPTIMIZED(addWeighted16s), (BinaryFunc)GET_OPTIMIZED(addWeighted32s), (BinaryFunc)addWeighted32f, (BinaryFunc)addWeighted64f, 0 }; @@ -2504,8 +2504,8 @@ typedef void (*InRangeFunc)( const uchar* src1, size_t step1, const uchar* src2, static InRangeFunc inRangeTab[] = { - (InRangeFunc)inRange8u, (InRangeFunc)inRange8s, (InRangeFunc)inRange16u, - (InRangeFunc)inRange16s, (InRangeFunc)inRange32s, (InRangeFunc)inRange32f, + (InRangeFunc)GET_OPTIMIZED(inRange8u), (InRangeFunc)GET_OPTIMIZED(inRange8s), (InRangeFunc)GET_OPTIMIZED(inRange16u), + (InRangeFunc)GET_OPTIMIZED(inRange16s), (InRangeFunc)GET_OPTIMIZED(inRange32s), (InRangeFunc)GET_OPTIMIZED(inRange32f), (InRangeFunc)inRange64f, 0 }; diff --git a/modules/core/src/convert.cpp b/modules/core/src/convert.cpp index 26c3c55784..043b5aa872 100644 --- a/modules/core/src/convert.cpp +++ b/modules/core/src/convert.cpp @@ -876,33 +876,33 @@ static BinaryFunc cvtScaleAbsTab[] = static BinaryFunc cvtScaleTab[][8] = { { - (BinaryFunc)cvtScale8u, (BinaryFunc)cvtScale8s8u, (BinaryFunc)cvtScale16u8u, - (BinaryFunc)cvtScale16s8u, (BinaryFunc)cvtScale32s8u, (BinaryFunc)cvtScale32f8u, + (BinaryFunc)GET_OPTIMIZED(cvtScale8u), (BinaryFunc)GET_OPTIMIZED(cvtScale8s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale16u8u), + (BinaryFunc)GET_OPTIMIZED(cvtScale16s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale32s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale32f8u), (BinaryFunc)cvtScale64f8u, 0 }, { - (BinaryFunc)cvtScale8u8s, (BinaryFunc)cvtScale8s, (BinaryFunc)cvtScale16u8s, - (BinaryFunc)cvtScale16s8s, (BinaryFunc)cvtScale32s8s, (BinaryFunc)cvtScale32f8s, + (BinaryFunc)GET_OPTIMIZED(cvtScale8u8s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u8s), + (BinaryFunc)GET_OPTIMIZED(cvtScale16s8s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s8s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f8s), (BinaryFunc)cvtScale64f8s, 0 }, { - (BinaryFunc)cvtScale8u16u, (BinaryFunc)cvtScale8s16u, (BinaryFunc)cvtScale16u, - (BinaryFunc)cvtScale16s16u, (BinaryFunc)cvtScale32s16u, (BinaryFunc)cvtScale32f16u, + (BinaryFunc)GET_OPTIMIZED(cvtScale8u16u), (BinaryFunc)GET_OPTIMIZED(cvtScale8s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale16u), + (BinaryFunc)GET_OPTIMIZED(cvtScale16s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale32s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale32f16u), (BinaryFunc)cvtScale64f16u, 0 }, { - (BinaryFunc)cvtScale8u16s, (BinaryFunc)cvtScale8s16s, (BinaryFunc)cvtScale16u16s, - (BinaryFunc)cvtScale16s, (BinaryFunc)cvtScale32s16s, (BinaryFunc)cvtScale32f16s, + (BinaryFunc)GET_OPTIMIZED(cvtScale8u16s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s16s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u16s), + (BinaryFunc)GET_OPTIMIZED(cvtScale16s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s16s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f16s), (BinaryFunc)cvtScale64f16s, 0 }, { - (BinaryFunc)cvtScale8u32s, (BinaryFunc)cvtScale8s32s, (BinaryFunc)cvtScale16u32s, - (BinaryFunc)cvtScale16s32s, (BinaryFunc)cvtScale32s, (BinaryFunc)cvtScale32f32s, + (BinaryFunc)GET_OPTIMIZED(cvtScale8u32s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s32s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u32s), + (BinaryFunc)GET_OPTIMIZED(cvtScale16s32s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f32s), (BinaryFunc)cvtScale64f32s, 0 }, { - (BinaryFunc)cvtScale8u32f, (BinaryFunc)cvtScale8s32f, (BinaryFunc)cvtScale16u32f, - (BinaryFunc)cvtScale16s32f, (BinaryFunc)cvtScale32s32f, (BinaryFunc)cvtScale32f, + (BinaryFunc)GET_OPTIMIZED(cvtScale8u32f), (BinaryFunc)GET_OPTIMIZED(cvtScale8s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale16u32f), + (BinaryFunc)GET_OPTIMIZED(cvtScale16s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale32s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale32f), (BinaryFunc)cvtScale64f32f, 0 }, { @@ -918,7 +918,7 @@ static BinaryFunc cvtScaleTab[][8] = static BinaryFunc cvtTab[][8] = { { - (BinaryFunc)cvt8u, (BinaryFunc)GET_OPTIMIZED(cvt8s8u), (BinaryFunc)GET_OPTIMIZED(cvt16u8u), + (BinaryFunc)(cvt8u), (BinaryFunc)GET_OPTIMIZED(cvt8s8u), (BinaryFunc)GET_OPTIMIZED(cvt16u8u), (BinaryFunc)GET_OPTIMIZED(cvt16s8u), (BinaryFunc)GET_OPTIMIZED(cvt32s8u), (BinaryFunc)GET_OPTIMIZED(cvt32f8u), (BinaryFunc)GET_OPTIMIZED(cvt64f8u), 0 }, @@ -950,7 +950,7 @@ static BinaryFunc cvtTab[][8] = { (BinaryFunc)GET_OPTIMIZED(cvt8u64f), (BinaryFunc)GET_OPTIMIZED(cvt8s64f), (BinaryFunc)GET_OPTIMIZED(cvt16u64f), (BinaryFunc)GET_OPTIMIZED(cvt16s64f), (BinaryFunc)GET_OPTIMIZED(cvt32s64f), (BinaryFunc)GET_OPTIMIZED(cvt32f64f), - (BinaryFunc)cvt64s, 0 + (BinaryFunc)(cvt64s), 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 diff --git a/modules/core/src/opengl_interop.cpp b/modules/core/src/opengl_interop.cpp index 4bae3386cf..de8ad876d9 100644 --- a/modules/core/src/opengl_interop.cpp +++ b/modules/core/src/opengl_interop.cpp @@ -1269,7 +1269,7 @@ void cv::GlFont::draw(const char* str, int len) const glPushAttrib(GL_LIST_BIT); glListBase(base_); - glCallLists(len, GL_UNSIGNED_BYTE, str); + glCallLists(static_cast(len), GL_UNSIGNED_BYTE, str); glPopAttrib(); diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index 7bdbc29d94..499c44c53d 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -1224,16 +1224,16 @@ typedef int (*NormDiffFunc)(const uchar*, const uchar*, const uchar*, uchar*, in static NormFunc normTab[3][8] = { { - (NormFunc)GET_OPTIMIZED(normInf_8u), (NormFunc)normInf_8s, (NormFunc)normInf_16u, (NormFunc)normInf_16s, - (NormFunc)normInf_32s, (NormFunc)GET_OPTIMIZED(normInf_32f), (NormFunc)normInf_64f, 0 + (NormFunc)GET_OPTIMIZED(normInf_8u), (NormFunc)GET_OPTIMIZED(normInf_8s), (NormFunc)GET_OPTIMIZED(normInf_16u), (NormFunc)GET_OPTIMIZED(normInf_16s), + (NormFunc)GET_OPTIMIZED(normInf_32s), (NormFunc)GET_OPTIMIZED(normInf_32f), (NormFunc)normInf_64f, 0 }, { - (NormFunc)GET_OPTIMIZED(normL1_8u), (NormFunc)normL1_8s, (NormFunc)normL1_16u, (NormFunc)normL1_16s, - (NormFunc)normL1_32s, (NormFunc)GET_OPTIMIZED(normL1_32f), (NormFunc)normL1_64f, 0 + (NormFunc)GET_OPTIMIZED(normL1_8u), (NormFunc)GET_OPTIMIZED(normL1_8s), (NormFunc)GET_OPTIMIZED(normL1_16u), (NormFunc)GET_OPTIMIZED(normL1_16s), + (NormFunc)GET_OPTIMIZED(normL1_32s), (NormFunc)GET_OPTIMIZED(normL1_32f), (NormFunc)normL1_64f, 0 }, { - (NormFunc)GET_OPTIMIZED(normL2_8u), (NormFunc)normL2_8s, (NormFunc)normL2_16u, (NormFunc)normL2_16s, - (NormFunc)normL2_32s, (NormFunc)GET_OPTIMIZED(normL2_32f), (NormFunc)normL2_64f, 0 + (NormFunc)GET_OPTIMIZED(normL2_8u), (NormFunc)GET_OPTIMIZED(normL2_8s), (NormFunc)GET_OPTIMIZED(normL2_16u), (NormFunc)GET_OPTIMIZED(normL2_16s), + (NormFunc)GET_OPTIMIZED(normL2_32s), (NormFunc)GET_OPTIMIZED(normL2_32f), (NormFunc)normL2_64f, 0 } }; diff --git a/modules/gpu/doc/video.rst b/modules/gpu/doc/video.rst index 5bd4bbdeb9..525b900049 100644 --- a/modules/gpu/doc/video.rst +++ b/modules/gpu/doc/video.rst @@ -4,6 +4,7 @@ Video Analysis .. highlight:: cpp + gpu::BroxOpticalFlow -------------------- .. ocv:class:: gpu::BroxOpticalFlow @@ -119,6 +120,7 @@ Releases inner buffers memory. .. ocv:function:: void gpu::GoodFeaturesToTrackDetector_GPU::releaseMemory() + gpu::FarnebackOpticalFlow ------------------------- .. ocv:class:: gpu::FarnebackOpticalFlow @@ -158,6 +160,7 @@ Class computing a dense optical flow using the Gunnar Farneback’s algorithm. : }; + gpu::FarnebackOpticalFlow::operator () -------------------------------------- Computes a dense optical flow using the Gunnar Farneback’s algorithm. @@ -173,6 +176,7 @@ Computes a dense optical flow using the Gunnar Farneback’s algorithm. .. seealso:: :ocv:func:`calcOpticalFlowFarneback` + gpu::FarnebackOpticalFlow::releaseMemory ---------------------------------------- Releases unused auxiliary memory buffers. @@ -180,6 +184,7 @@ Releases unused auxiliary memory buffers. .. ocv:function:: void gpu::FarnebackOpticalFlow::releaseMemory() + gpu::PyrLKOpticalFlow --------------------- .. ocv:class:: gpu::PyrLKOpticalFlow @@ -263,7 +268,7 @@ Releases inner buffers memory. gpu::interpolateFrames ---------------------- -Interpolate frames (images) using provided optical flow (displacement field). +Interpolates frames (images) using provided optical flow (displacement field). .. ocv:function:: void gpu::interpolateFrames(const GpuMat& frame0, const GpuMat& frame1, const GpuMat& fu, const GpuMat& fv, const GpuMat& bu, const GpuMat& bv, float pos, GpuMat& newFrame, GpuMat& buf, Stream& stream = Stream::Null()) diff --git a/modules/gpu/src/gftt.cpp b/modules/gpu/src/gftt.cpp index b05f4b448e..eca2fbc313 100644 --- a/modules/gpu/src/gftt.cpp +++ b/modules/gpu/src/gftt.cpp @@ -160,7 +160,7 @@ void cv::gpu::GoodFeaturesToTrackDetector_GPU::operator ()(const GpuMat& image, } } - corners.upload(Mat(1, tmp2.size(), CV_32FC2, &tmp2[0])); + corners.upload(Mat(1, static_cast(tmp2.size()), CV_32FC2, &tmp2[0])); } } diff --git a/modules/gpu/src/imgproc.cpp b/modules/gpu/src/imgproc.cpp index f206f7a664..92ece026b2 100644 --- a/modules/gpu/src/imgproc.cpp +++ b/modules/gpu/src/imgproc.cpp @@ -1300,9 +1300,9 @@ void cv::gpu::ConvolveBuf::create(Size image_size, Size templ_size) // CUFFT has hard-coded kernels for power-of-2 sizes (up to 8192), // see CUDA Toolkit 4.1 CUFFT Library Programming Guide if (dft_size.width > 8192) - dft_size.width = getOptimalDFTSize(block_size.width + templ_size.width - 1.); + dft_size.width = getOptimalDFTSize(block_size.width + templ_size.width - 1); if (dft_size.height > 8192) - dft_size.height = getOptimalDFTSize(block_size.height + templ_size.height - 1.); + dft_size.height = getOptimalDFTSize(block_size.height + templ_size.height - 1); // To avoid wasting time doing small DFTs dft_size.width = std::max(dft_size.width, 512); diff --git a/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu b/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu index 3e57444d6a..cfe26d59f0 100644 --- a/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu +++ b/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu @@ -692,7 +692,7 @@ namespace w.clear(); h.clear(); - for (int i = img0.size() - 1; i >= 0; --i) + for (int i = static_cast(img0.size()) - 1; i >= 0; --i) { delete img1[i]; delete img0[i]; diff --git a/modules/gpu/src/nvidia/core/NCV.cu b/modules/gpu/src/nvidia/core/NCV.cu index 4ffaebff8b..0ad1556b42 100644 --- a/modules/gpu/src/nvidia/core/NCV.cu +++ b/modules/gpu/src/nvidia/core/NCV.cu @@ -351,7 +351,7 @@ NCVStatus NCVMemStackAllocator::alloc(NCVMemSegment &seg, size_t size) seg.clear(); ncvAssertReturn(isInitialized(), NCV_ALLOCATOR_BAD_ALLOC); - size = alignUp(size, this->_alignment); + size = alignUp(static_cast(size), this->_alignment); this->currentSize += size; this->_maxSize = std::max(this->_maxSize, this->currentSize); @@ -461,7 +461,7 @@ NCVStatus NCVMemNativeAllocator::alloc(NCVMemSegment &seg, size_t size) default:; } - this->currentSize += alignUp(size, this->_alignment); + this->currentSize += alignUp(static_cast(size), this->_alignment); this->_maxSize = std::max(this->_maxSize, this->currentSize); seg.begin.memtype = this->_memType; @@ -477,8 +477,8 @@ NCVStatus NCVMemNativeAllocator::dealloc(NCVMemSegment &seg) ncvAssertReturn(seg.begin.memtype == this->_memType, NCV_ALLOCATOR_BAD_DEALLOC); ncvAssertReturn(seg.begin.ptr != NULL, NCV_ALLOCATOR_BAD_DEALLOC); - ncvAssertReturn(currentSize >= alignUp(seg.size, this->_alignment), NCV_ALLOCATOR_BAD_DEALLOC); - currentSize -= alignUp(seg.size, this->_alignment); + ncvAssertReturn(currentSize >= alignUp(static_cast(seg.size), this->_alignment), NCV_ALLOCATOR_BAD_DEALLOC); + currentSize -= alignUp(static_cast(seg.size), this->_alignment); switch (this->_memType) { diff --git a/modules/gpu/src/nvidia/core/NCVPyramid.cu b/modules/gpu/src/nvidia/core/NCVPyramid.cu index 12260f4114..0a95ebb384 100644 --- a/modules/gpu/src/nvidia/core/NCVPyramid.cu +++ b/modules/gpu/src/nvidia/core/NCVPyramid.cu @@ -211,7 +211,8 @@ namespace cv { namespace gpu { namespace device dim3 bDim(16, 8); dim3 gDim(divUp(src.cols, bDim.x), divUp(src.rows, bDim.y)); - kernelDownsampleX2<<>>((T*)src.data, src.step, (T*)dst.data, dst.step, NcvSize32u(dst.cols, dst.rows)); + kernelDownsampleX2<<>>((T*)src.data, static_cast(src.step), + (T*)dst.data, static_cast(dst.step), NcvSize32u(dst.cols, dst.rows)); cudaSafeCall( cudaGetLastError() ); @@ -285,8 +286,8 @@ namespace cv { namespace gpu { namespace device dim3 bDim(16, 8); dim3 gDim(divUp(dst.cols, bDim.x), divUp(dst.rows, bDim.y)); - kernelInterpolateFrom1<<>>((T*) src.data, src.step, NcvSize32u(src.cols, src.rows), - (T*) dst.data, dst.step, NcvSize32u(dst.cols, dst.rows)); + kernelInterpolateFrom1<<>>((T*) src.data, static_cast(src.step), NcvSize32u(src.cols, src.rows), + (T*) dst.data, static_cast(dst.step), NcvSize32u(dst.cols, dst.rows)); cudaSafeCall( cudaGetLastError() ); diff --git a/modules/gpu/src/optical_flow.cpp b/modules/gpu/src/optical_flow.cpp index 0921e00585..1c963fc535 100644 --- a/modules/gpu/src/optical_flow.cpp +++ b/modules/gpu/src/optical_flow.cpp @@ -114,16 +114,16 @@ void cv::gpu::BroxOpticalFlow::operator ()(const GpuMat& frame0, const GpuMat& f vMemSeg.begin.ptr = v.ptr(); vMemSeg.size = v.step * v.rows; - NCVMatrixReuse frame0Mat(frame0MemSeg, devProp.textureAlignment, frame0.cols, frame0.rows, frame0.step); - NCVMatrixReuse frame1Mat(frame1MemSeg, devProp.textureAlignment, frame1.cols, frame1.rows, frame1.step); - NCVMatrixReuse uMat(uMemSeg, devProp.textureAlignment, u.cols, u.rows, u.step); - NCVMatrixReuse vMat(vMemSeg, devProp.textureAlignment, v.cols, v.rows, v.step); + NCVMatrixReuse frame0Mat(frame0MemSeg, static_cast(devProp.textureAlignment), frame0.cols, frame0.rows, static_cast(frame0.step)); + NCVMatrixReuse frame1Mat(frame1MemSeg, static_cast(devProp.textureAlignment), frame1.cols, frame1.rows, static_cast(frame1.step)); + NCVMatrixReuse uMat(uMemSeg, static_cast(devProp.textureAlignment), u.cols, u.rows, static_cast(u.step)); + NCVMatrixReuse vMat(vMemSeg, static_cast(devProp.textureAlignment), v.cols, v.rows, static_cast(v.step)); cudaStream_t stream = StreamAccessor::getStream(s); size_t bufSize = getBufSize(desc, frame0Mat, frame1Mat, uMat, vMat, devProp); - ensureSizeIsEnough(1, bufSize, CV_8UC1, buf); + ensureSizeIsEnough(1, static_cast(bufSize), CV_8UC1, buf); NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, static_cast(devProp.textureAlignment), buf.ptr()); diff --git a/modules/gpu/src/orb.cpp b/modules/gpu/src/orb.cpp index e3a0c92955..1dba7a7090 100644 --- a/modules/gpu/src/orb.cpp +++ b/modules/gpu/src/orb.cpp @@ -406,7 +406,7 @@ cv::gpu::ORB_GPU::ORB_GPU(int nFeatures, float scaleFactor, int nLevels, int edg float n_desired_features_per_scale = nFeatures_ * (1.0f - factor) / (1.0f - std::pow(factor, nLevels_)); n_features_per_level_.resize(nLevels_); - int sum_n_features = 0; + size_t sum_n_features = 0; for (int level = 0; level < nLevels_ - 1; ++level) { n_features_per_level_[level] = cvRound(n_desired_features_per_scale); @@ -430,7 +430,7 @@ cv::gpu::ORB_GPU::ORB_GPU(int nFeatures, float scaleFactor, int nLevels, int edg ++v_0; } CV_Assert(u_max.size() < 32); - cv::gpu::device::orb::loadUMax(&u_max[0], u_max.size()); + cv::gpu::device::orb::loadUMax(&u_max[0], static_cast(u_max.size())); // Calc pattern const int npoints = 512; diff --git a/modules/gpu/src/precomp.hpp b/modules/gpu/src/precomp.hpp index 6ee54cd729..adb218860c 100644 --- a/modules/gpu/src/precomp.hpp +++ b/modules/gpu/src/precomp.hpp @@ -71,16 +71,16 @@ #ifdef HAVE_CUDA - #include "cuda.h" - #include "cuda_runtime_api.h" - #include "npp.h" + #include + #include + #include #ifdef HAVE_CUFFT - #include "cufft.h" + #include #endif #ifdef HAVE_CUBLAS - #include "cublas.h" + #include #endif #include "internal_shared.hpp" diff --git a/modules/gpu/src/stereocsbp.cpp b/modules/gpu/src/stereocsbp.cpp index 8c18888bff..02af8fdcd7 100644 --- a/modules/gpu/src/stereocsbp.cpp +++ b/modules/gpu/src/stereocsbp.cpp @@ -204,7 +204,7 @@ static void csbp_operator(StereoConstantSpaceBP& rthis, GpuMat& mbuf, GpuMat& te Size temp_size = data_cost.size(); if ((size_t)temp_size.area() < elem_step * rows_pyr[levels - 1] * rthis.ndisp) - temp_size = Size(elem_step, rows_pyr[levels - 1] * rthis.ndisp); + temp_size = Size(static_cast(elem_step), rows_pyr[levels - 1] * rthis.ndisp); temp.create(temp_size, DataType::type); diff --git a/modules/gpu/test/test_video.cpp b/modules/gpu/test/test_video.cpp index 4418c1923f..206ab89537 100644 --- a/modules/gpu/test/test_video.cpp +++ b/modules/gpu/test/test_video.cpp @@ -375,7 +375,7 @@ TEST_P(FarnebackOpticalFlow, Accuracy) EXPECT_MAT_SIMILAR(flowxy[0], d_flowx, 0.1); EXPECT_MAT_SIMILAR(flowxy[1], d_flowy, 0.1); -}; +} INSTANTIATE_TEST_CASE_P(GPU_Video, FarnebackOpticalFlow, testing::Combine( ALL_DEVICES, diff --git a/modules/java/gen_java.py b/modules/java/gen_java.py index 9e5bfc41df..aef2a18163 100644 --- a/modules/java/gen_java.py +++ b/modules/java/gen_java.py @@ -173,6 +173,15 @@ missing_consts = \ ) # public }, # Calib3d + "Video": + { + 'private' : + ( + ('CV_LKFLOW_INITIAL_GUESSES', 4 ), + ('CV_LKFLOW_GET_MIN_EIGENVALS', 8 ), + ) # private + }, # Video + } diff --git a/modules/video/include/opencv2/video/tracking.hpp b/modules/video/include/opencv2/video/tracking.hpp index 91d332cea2..e852b38b57 100644 --- a/modules/video/include/opencv2/video/tracking.hpp +++ b/modules/video/include/opencv2/video/tracking.hpp @@ -296,8 +296,12 @@ public: Mat temp5; }; - -enum { OPTFLOW_USE_INITIAL_FLOW=4, OPTFLOW_FARNEBACK_GAUSSIAN=256 }; +enum +{ + OPTFLOW_USE_INITIAL_FLOW = CV_LKFLOW_INITIAL_GUESSES, + OPTFLOW_LK_GET_MIN_EIGENVALS = CV_LKFLOW_GET_MIN_EIGENVALS, + OPTFLOW_FARNEBACK_GAUSSIAN = 256 +}; //! computes sparse optical flow using multi-scale Lucas-Kanade algorithm CV_EXPORTS_W void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg, diff --git a/samples/gpu/brox_optical_flow.cpp b/samples/gpu/brox_optical_flow.cpp index b6104117b6..824ab272c7 100644 --- a/samples/gpu/brox_optical_flow.cpp +++ b/samples/gpu/brox_optical_flow.cpp @@ -215,7 +215,7 @@ int main(int argc, const char* argv[]) switch (key) { case 27: - break; + return 0; case 'A': if (currentFrame > 0) @@ -243,8 +243,6 @@ int main(int argc, const char* argv[]) cerr << "Unknow error" << endl; return -1; } - - return 0; } template inline T clamp (T x, T a, T b) diff --git a/samples/gpu/cascadeclassifier.cpp b/samples/gpu/cascadeclassifier.cpp index 90ba21a60c..0b038c4f13 100644 --- a/samples/gpu/cascadeclassifier.cpp +++ b/samples/gpu/cascadeclassifier.cpp @@ -271,13 +271,13 @@ int main(int argc, const char *argv[]) displayState(frameDisp, helpScreen, useGPU, findLargestObject, filterRects, fps); imshow("result", frameDisp); - int key = waitKey(5); + char key = (char)waitKey(5); if (key == 27) { break; } - switch ((char)key) + switch (key) { case ' ': useGPU = !useGPU; @@ -305,4 +305,4 @@ int main(int argc, const char *argv[]) } return 0; -} \ No newline at end of file +} diff --git a/samples/gpu/opticalflow_nvidia_api.cpp b/samples/gpu/opticalflow_nvidia_api.cpp index 313ed710b7..c7b55e1b07 100644 --- a/samples/gpu/opticalflow_nvidia_api.cpp +++ b/samples/gpu/opticalflow_nvidia_api.cpp @@ -407,10 +407,10 @@ int main(int argc, char **argv) std::cout << "Using GPU: " << devId << "(" << devProp.name << "), arch=" << devProp.major << "." << devProp.minor << std::endl; - g_pGPUMemAllocator = Ptr (new NCVMemNativeAllocator (NCVMemoryTypeDevice, devProp.textureAlignment)); + g_pGPUMemAllocator = Ptr (new NCVMemNativeAllocator (NCVMemoryTypeDevice, static_cast(devProp.textureAlignment))); ncvAssertPrintReturn (g_pGPUMemAllocator->isInitialized (), "Device memory allocator isn't initialized", -1); - g_pHostMemAllocator = Ptr (new NCVMemNativeAllocator (NCVMemoryTypeHostPageable, devProp.textureAlignment)); + g_pHostMemAllocator = Ptr (new NCVMemNativeAllocator (NCVMemoryTypeHostPageable, static_cast(devProp.textureAlignment))); ncvAssertPrintReturn (g_pHostMemAllocator->isInitialized (), "Host memory allocator isn't initialized", -1); int width, height; diff --git a/samples/python2/gaussian_mix.py b/samples/python2/gaussian_mix.py index c71ff3c3af..c0f9816e09 100644 --- a/samples/python2/gaussian_mix.py +++ b/samples/python2/gaussian_mix.py @@ -37,8 +37,7 @@ if __name__ == '__main__': print 'EM (opencv) ...' em = cv2.EM(points, params = dict( nclusters = cluster_n, cov_mat_type = cv2.EM_COV_MAT_GENERIC) ) means = em.getMeans() - covs = np.zeros((cluster_n, 2, 2), np.float32) - covs = em.getCovs(covs) # FIXME + covs = em.getCovs() found_distrs = zip(means, covs) print 'ready!\n'