Commit 50ad6909 authored by Andrey Kamaev's avatar Andrey Kamaev

Merged the trunk till r8291

parent caddd398
#!/bin/sh
cd `dirname $0`/..
mkdir -p build_x86
cd build_x86
cmake -DANDROID_ABI=x86 -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../..
...@@ -75,7 +75,6 @@ void CV_ChessboardDetectorTimingTest::run( int start_from ) ...@@ -75,7 +75,6 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
sprintf( filepath, "%scameracalibration/", ts->get_data_path().c_str() ); sprintf( filepath, "%scameracalibration/", ts->get_data_path().c_str() );
sprintf( filename, "%schessboard_timing_list.dat", filepath ); sprintf( filename, "%schessboard_timing_list.dat", filepath );
printf("Reading file %s\n", filename);
CvFileStorage* fs = cvOpenFileStorage( filename, 0, CV_STORAGE_READ ); CvFileStorage* fs = cvOpenFileStorage( filename, 0, CV_STORAGE_READ );
CvFileNode* board_list = fs ? cvGetFileNodeByName( fs, 0, "boards" ) : 0; CvFileNode* board_list = fs ? cvGetFileNodeByName( fs, 0, "boards" ) : 0;
......
#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);
}
#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);
}
...@@ -1984,8 +1984,8 @@ static void addWeighted64f( const double* src1, size_t step1, const double* src2 ...@@ -1984,8 +1984,8 @@ static void addWeighted64f( const double* src1, size_t step1, const double* src2
static BinaryFunc addWeightedTab[] = static BinaryFunc addWeightedTab[] =
{ {
(BinaryFunc)addWeighted8u, (BinaryFunc)addWeighted8s, (BinaryFunc)addWeighted16u, (BinaryFunc)GET_OPTIMIZED(addWeighted8u), (BinaryFunc)GET_OPTIMIZED(addWeighted8s), (BinaryFunc)GET_OPTIMIZED(addWeighted16u),
(BinaryFunc)addWeighted16s, (BinaryFunc)addWeighted32s, (BinaryFunc)addWeighted32f, (BinaryFunc)GET_OPTIMIZED(addWeighted16s), (BinaryFunc)GET_OPTIMIZED(addWeighted32s), (BinaryFunc)addWeighted32f,
(BinaryFunc)addWeighted64f, 0 (BinaryFunc)addWeighted64f, 0
}; };
...@@ -2504,8 +2504,8 @@ typedef void (*InRangeFunc)( const uchar* src1, size_t step1, const uchar* src2, ...@@ -2504,8 +2504,8 @@ typedef void (*InRangeFunc)( const uchar* src1, size_t step1, const uchar* src2,
static InRangeFunc inRangeTab[] = static InRangeFunc inRangeTab[] =
{ {
(InRangeFunc)inRange8u, (InRangeFunc)inRange8s, (InRangeFunc)inRange16u, (InRangeFunc)GET_OPTIMIZED(inRange8u), (InRangeFunc)GET_OPTIMIZED(inRange8s), (InRangeFunc)GET_OPTIMIZED(inRange16u),
(InRangeFunc)inRange16s, (InRangeFunc)inRange32s, (InRangeFunc)inRange32f, (InRangeFunc)GET_OPTIMIZED(inRange16s), (InRangeFunc)GET_OPTIMIZED(inRange32s), (InRangeFunc)GET_OPTIMIZED(inRange32f),
(InRangeFunc)inRange64f, 0 (InRangeFunc)inRange64f, 0
}; };
......
...@@ -876,33 +876,33 @@ static BinaryFunc cvtScaleAbsTab[] = ...@@ -876,33 +876,33 @@ static BinaryFunc cvtScaleAbsTab[] =
static BinaryFunc cvtScaleTab[][8] = static BinaryFunc cvtScaleTab[][8] =
{ {
{ {
(BinaryFunc)cvtScale8u, (BinaryFunc)cvtScale8s8u, (BinaryFunc)cvtScale16u8u, (BinaryFunc)GET_OPTIMIZED(cvtScale8u), (BinaryFunc)GET_OPTIMIZED(cvtScale8s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale16u8u),
(BinaryFunc)cvtScale16s8u, (BinaryFunc)cvtScale32s8u, (BinaryFunc)cvtScale32f8u, (BinaryFunc)GET_OPTIMIZED(cvtScale16s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale32s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale32f8u),
(BinaryFunc)cvtScale64f8u, 0 (BinaryFunc)cvtScale64f8u, 0
}, },
{ {
(BinaryFunc)cvtScale8u8s, (BinaryFunc)cvtScale8s, (BinaryFunc)cvtScale16u8s, (BinaryFunc)GET_OPTIMIZED(cvtScale8u8s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u8s),
(BinaryFunc)cvtScale16s8s, (BinaryFunc)cvtScale32s8s, (BinaryFunc)cvtScale32f8s, (BinaryFunc)GET_OPTIMIZED(cvtScale16s8s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s8s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f8s),
(BinaryFunc)cvtScale64f8s, 0 (BinaryFunc)cvtScale64f8s, 0
}, },
{ {
(BinaryFunc)cvtScale8u16u, (BinaryFunc)cvtScale8s16u, (BinaryFunc)cvtScale16u, (BinaryFunc)GET_OPTIMIZED(cvtScale8u16u), (BinaryFunc)GET_OPTIMIZED(cvtScale8s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale16u),
(BinaryFunc)cvtScale16s16u, (BinaryFunc)cvtScale32s16u, (BinaryFunc)cvtScale32f16u, (BinaryFunc)GET_OPTIMIZED(cvtScale16s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale32s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale32f16u),
(BinaryFunc)cvtScale64f16u, 0 (BinaryFunc)cvtScale64f16u, 0
}, },
{ {
(BinaryFunc)cvtScale8u16s, (BinaryFunc)cvtScale8s16s, (BinaryFunc)cvtScale16u16s, (BinaryFunc)GET_OPTIMIZED(cvtScale8u16s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s16s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u16s),
(BinaryFunc)cvtScale16s, (BinaryFunc)cvtScale32s16s, (BinaryFunc)cvtScale32f16s, (BinaryFunc)GET_OPTIMIZED(cvtScale16s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s16s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f16s),
(BinaryFunc)cvtScale64f16s, 0 (BinaryFunc)cvtScale64f16s, 0
}, },
{ {
(BinaryFunc)cvtScale8u32s, (BinaryFunc)cvtScale8s32s, (BinaryFunc)cvtScale16u32s, (BinaryFunc)GET_OPTIMIZED(cvtScale8u32s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s32s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u32s),
(BinaryFunc)cvtScale16s32s, (BinaryFunc)cvtScale32s, (BinaryFunc)cvtScale32f32s, (BinaryFunc)GET_OPTIMIZED(cvtScale16s32s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f32s),
(BinaryFunc)cvtScale64f32s, 0 (BinaryFunc)cvtScale64f32s, 0
}, },
{ {
(BinaryFunc)cvtScale8u32f, (BinaryFunc)cvtScale8s32f, (BinaryFunc)cvtScale16u32f, (BinaryFunc)GET_OPTIMIZED(cvtScale8u32f), (BinaryFunc)GET_OPTIMIZED(cvtScale8s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale16u32f),
(BinaryFunc)cvtScale16s32f, (BinaryFunc)cvtScale32s32f, (BinaryFunc)cvtScale32f, (BinaryFunc)GET_OPTIMIZED(cvtScale16s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale32s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale32f),
(BinaryFunc)cvtScale64f32f, 0 (BinaryFunc)cvtScale64f32f, 0
}, },
{ {
...@@ -918,7 +918,7 @@ static BinaryFunc cvtScaleTab[][8] = ...@@ -918,7 +918,7 @@ static BinaryFunc cvtScaleTab[][8] =
static BinaryFunc cvtTab[][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(cvt16s8u), (BinaryFunc)GET_OPTIMIZED(cvt32s8u), (BinaryFunc)GET_OPTIMIZED(cvt32f8u),
(BinaryFunc)GET_OPTIMIZED(cvt64f8u), 0 (BinaryFunc)GET_OPTIMIZED(cvt64f8u), 0
}, },
...@@ -950,7 +950,7 @@ static BinaryFunc cvtTab[][8] = ...@@ -950,7 +950,7 @@ static BinaryFunc cvtTab[][8] =
{ {
(BinaryFunc)GET_OPTIMIZED(cvt8u64f), (BinaryFunc)GET_OPTIMIZED(cvt8s64f), (BinaryFunc)GET_OPTIMIZED(cvt16u64f), (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)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 0, 0, 0, 0, 0, 0, 0, 0
......
...@@ -1269,7 +1269,7 @@ void cv::GlFont::draw(const char* str, int len) const ...@@ -1269,7 +1269,7 @@ void cv::GlFont::draw(const char* str, int len) const
glPushAttrib(GL_LIST_BIT); glPushAttrib(GL_LIST_BIT);
glListBase(base_); glListBase(base_);
glCallLists(len, GL_UNSIGNED_BYTE, str); glCallLists(static_cast<GLsizei>(len), GL_UNSIGNED_BYTE, str);
glPopAttrib(); glPopAttrib();
......
...@@ -1224,16 +1224,16 @@ typedef int (*NormDiffFunc)(const uchar*, const uchar*, const uchar*, uchar*, in ...@@ -1224,16 +1224,16 @@ typedef int (*NormDiffFunc)(const uchar*, const uchar*, const uchar*, uchar*, in
static NormFunc normTab[3][8] = static NormFunc normTab[3][8] =
{ {
{ {
(NormFunc)GET_OPTIMIZED(normInf_8u), (NormFunc)normInf_8s, (NormFunc)normInf_16u, (NormFunc)normInf_16s, (NormFunc)GET_OPTIMIZED(normInf_8u), (NormFunc)GET_OPTIMIZED(normInf_8s), (NormFunc)GET_OPTIMIZED(normInf_16u), (NormFunc)GET_OPTIMIZED(normInf_16s),
(NormFunc)normInf_32s, (NormFunc)GET_OPTIMIZED(normInf_32f), (NormFunc)normInf_64f, 0 (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)GET_OPTIMIZED(normL1_8u), (NormFunc)GET_OPTIMIZED(normL1_8s), (NormFunc)GET_OPTIMIZED(normL1_16u), (NormFunc)GET_OPTIMIZED(normL1_16s),
(NormFunc)normL1_32s, (NormFunc)GET_OPTIMIZED(normL1_32f), (NormFunc)normL1_64f, 0 (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)GET_OPTIMIZED(normL2_8u), (NormFunc)GET_OPTIMIZED(normL2_8s), (NormFunc)GET_OPTIMIZED(normL2_16u), (NormFunc)GET_OPTIMIZED(normL2_16s),
(NormFunc)normL2_32s, (NormFunc)GET_OPTIMIZED(normL2_32f), (NormFunc)normL2_64f, 0 (NormFunc)GET_OPTIMIZED(normL2_32s), (NormFunc)GET_OPTIMIZED(normL2_32f), (NormFunc)normL2_64f, 0
} }
}; };
......
...@@ -4,6 +4,7 @@ Video Analysis ...@@ -4,6 +4,7 @@ Video Analysis
.. highlight:: cpp .. highlight:: cpp
gpu::BroxOpticalFlow gpu::BroxOpticalFlow
-------------------- --------------------
.. ocv:class:: gpu::BroxOpticalFlow .. ocv:class:: gpu::BroxOpticalFlow
...@@ -119,6 +120,7 @@ Releases inner buffers memory. ...@@ -119,6 +120,7 @@ Releases inner buffers memory.
.. ocv:function:: void gpu::GoodFeaturesToTrackDetector_GPU::releaseMemory() .. ocv:function:: void gpu::GoodFeaturesToTrackDetector_GPU::releaseMemory()
gpu::FarnebackOpticalFlow gpu::FarnebackOpticalFlow
------------------------- -------------------------
.. ocv:class:: gpu::FarnebackOpticalFlow .. ocv:class:: gpu::FarnebackOpticalFlow
...@@ -158,6 +160,7 @@ Class computing a dense optical flow using the Gunnar Farneback’s algorithm. : ...@@ -158,6 +160,7 @@ Class computing a dense optical flow using the Gunnar Farneback’s algorithm. :
}; };
gpu::FarnebackOpticalFlow::operator () gpu::FarnebackOpticalFlow::operator ()
-------------------------------------- --------------------------------------
Computes a dense optical flow using the Gunnar Farneback’s algorithm. 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. ...@@ -173,6 +176,7 @@ Computes a dense optical flow using the Gunnar Farneback’s algorithm.
.. seealso:: :ocv:func:`calcOpticalFlowFarneback` .. seealso:: :ocv:func:`calcOpticalFlowFarneback`
gpu::FarnebackOpticalFlow::releaseMemory gpu::FarnebackOpticalFlow::releaseMemory
---------------------------------------- ----------------------------------------
Releases unused auxiliary memory buffers. Releases unused auxiliary memory buffers.
...@@ -180,6 +184,7 @@ Releases unused auxiliary memory buffers. ...@@ -180,6 +184,7 @@ Releases unused auxiliary memory buffers.
.. ocv:function:: void gpu::FarnebackOpticalFlow::releaseMemory() .. ocv:function:: void gpu::FarnebackOpticalFlow::releaseMemory()
gpu::PyrLKOpticalFlow gpu::PyrLKOpticalFlow
--------------------- ---------------------
.. ocv:class:: gpu::PyrLKOpticalFlow .. ocv:class:: gpu::PyrLKOpticalFlow
...@@ -263,7 +268,7 @@ Releases inner buffers memory. ...@@ -263,7 +268,7 @@ Releases inner buffers memory.
gpu::interpolateFrames 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()) .. 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())
......
...@@ -160,7 +160,7 @@ void cv::gpu::GoodFeaturesToTrackDetector_GPU::operator ()(const GpuMat& image, ...@@ -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<int>(tmp2.size()), CV_32FC2, &tmp2[0]));
} }
} }
......
...@@ -1300,9 +1300,9 @@ void cv::gpu::ConvolveBuf::create(Size image_size, Size templ_size) ...@@ -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), // CUFFT has hard-coded kernels for power-of-2 sizes (up to 8192),
// see CUDA Toolkit 4.1 CUFFT Library Programming Guide // see CUDA Toolkit 4.1 CUFFT Library Programming Guide
if (dft_size.width > 8192) 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) 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 // To avoid wasting time doing small DFTs
dft_size.width = std::max(dft_size.width, 512); dft_size.width = std::max(dft_size.width, 512);
......
...@@ -692,7 +692,7 @@ namespace ...@@ -692,7 +692,7 @@ namespace
w.clear(); w.clear();
h.clear(); h.clear();
for (int i = img0.size() - 1; i >= 0; --i) for (int i = static_cast<int>(img0.size()) - 1; i >= 0; --i)
{ {
delete img1[i]; delete img1[i];
delete img0[i]; delete img0[i];
......
...@@ -351,7 +351,7 @@ NCVStatus NCVMemStackAllocator::alloc(NCVMemSegment &seg, size_t size) ...@@ -351,7 +351,7 @@ NCVStatus NCVMemStackAllocator::alloc(NCVMemSegment &seg, size_t size)
seg.clear(); seg.clear();
ncvAssertReturn(isInitialized(), NCV_ALLOCATOR_BAD_ALLOC); ncvAssertReturn(isInitialized(), NCV_ALLOCATOR_BAD_ALLOC);
size = alignUp(size, this->_alignment); size = alignUp(static_cast<Ncv32u>(size), this->_alignment);
this->currentSize += size; this->currentSize += size;
this->_maxSize = std::max(this->_maxSize, this->currentSize); this->_maxSize = std::max(this->_maxSize, this->currentSize);
...@@ -461,7 +461,7 @@ NCVStatus NCVMemNativeAllocator::alloc(NCVMemSegment &seg, size_t size) ...@@ -461,7 +461,7 @@ NCVStatus NCVMemNativeAllocator::alloc(NCVMemSegment &seg, size_t size)
default:; default:;
} }
this->currentSize += alignUp(size, this->_alignment); this->currentSize += alignUp(static_cast<Ncv32u>(size), this->_alignment);
this->_maxSize = std::max(this->_maxSize, this->currentSize); this->_maxSize = std::max(this->_maxSize, this->currentSize);
seg.begin.memtype = this->_memType; seg.begin.memtype = this->_memType;
...@@ -477,8 +477,8 @@ NCVStatus NCVMemNativeAllocator::dealloc(NCVMemSegment &seg) ...@@ -477,8 +477,8 @@ NCVStatus NCVMemNativeAllocator::dealloc(NCVMemSegment &seg)
ncvAssertReturn(seg.begin.memtype == this->_memType, NCV_ALLOCATOR_BAD_DEALLOC); ncvAssertReturn(seg.begin.memtype == this->_memType, NCV_ALLOCATOR_BAD_DEALLOC);
ncvAssertReturn(seg.begin.ptr != NULL, NCV_ALLOCATOR_BAD_DEALLOC); ncvAssertReturn(seg.begin.ptr != NULL, NCV_ALLOCATOR_BAD_DEALLOC);
ncvAssertReturn(currentSize >= alignUp(seg.size, this->_alignment), NCV_ALLOCATOR_BAD_DEALLOC); ncvAssertReturn(currentSize >= alignUp(static_cast<Ncv32u>(seg.size), this->_alignment), NCV_ALLOCATOR_BAD_DEALLOC);
currentSize -= alignUp(seg.size, this->_alignment); currentSize -= alignUp(static_cast<Ncv32u>(seg.size), this->_alignment);
switch (this->_memType) switch (this->_memType)
{ {
......
...@@ -211,7 +211,8 @@ namespace cv { namespace gpu { namespace device ...@@ -211,7 +211,8 @@ namespace cv { namespace gpu { namespace device
dim3 bDim(16, 8); dim3 bDim(16, 8);
dim3 gDim(divUp(src.cols, bDim.x), divUp(src.rows, bDim.y)); dim3 gDim(divUp(src.cols, bDim.x), divUp(src.rows, bDim.y));
kernelDownsampleX2<<<gDim, bDim, 0, stream>>>((T*)src.data, src.step, (T*)dst.data, dst.step, NcvSize32u(dst.cols, dst.rows)); kernelDownsampleX2<<<gDim, bDim, 0, stream>>>((T*)src.data, static_cast<Ncv32u>(src.step),
(T*)dst.data, static_cast<Ncv32u>(dst.step), NcvSize32u(dst.cols, dst.rows));
cudaSafeCall( cudaGetLastError() ); cudaSafeCall( cudaGetLastError() );
...@@ -285,8 +286,8 @@ namespace cv { namespace gpu { namespace device ...@@ -285,8 +286,8 @@ namespace cv { namespace gpu { namespace device
dim3 bDim(16, 8); dim3 bDim(16, 8);
dim3 gDim(divUp(dst.cols, bDim.x), divUp(dst.rows, bDim.y)); dim3 gDim(divUp(dst.cols, bDim.x), divUp(dst.rows, bDim.y));
kernelInterpolateFrom1<<<gDim, bDim, 0, stream>>>((T*) src.data, src.step, NcvSize32u(src.cols, src.rows), kernelInterpolateFrom1<<<gDim, bDim, 0, stream>>>((T*) src.data, static_cast<Ncv32u>(src.step), NcvSize32u(src.cols, src.rows),
(T*) dst.data, dst.step, NcvSize32u(dst.cols, dst.rows)); (T*) dst.data, static_cast<Ncv32u>(dst.step), NcvSize32u(dst.cols, dst.rows));
cudaSafeCall( cudaGetLastError() ); cudaSafeCall( cudaGetLastError() );
......
...@@ -114,16 +114,16 @@ void cv::gpu::BroxOpticalFlow::operator ()(const GpuMat& frame0, const GpuMat& f ...@@ -114,16 +114,16 @@ void cv::gpu::BroxOpticalFlow::operator ()(const GpuMat& frame0, const GpuMat& f
vMemSeg.begin.ptr = v.ptr(); vMemSeg.begin.ptr = v.ptr();
vMemSeg.size = v.step * v.rows; vMemSeg.size = v.step * v.rows;
NCVMatrixReuse<Ncv32f> frame0Mat(frame0MemSeg, devProp.textureAlignment, frame0.cols, frame0.rows, frame0.step); NCVMatrixReuse<Ncv32f> frame0Mat(frame0MemSeg, static_cast<Ncv32u>(devProp.textureAlignment), frame0.cols, frame0.rows, static_cast<Ncv32u>(frame0.step));
NCVMatrixReuse<Ncv32f> frame1Mat(frame1MemSeg, devProp.textureAlignment, frame1.cols, frame1.rows, frame1.step); NCVMatrixReuse<Ncv32f> frame1Mat(frame1MemSeg, static_cast<Ncv32u>(devProp.textureAlignment), frame1.cols, frame1.rows, static_cast<Ncv32u>(frame1.step));
NCVMatrixReuse<Ncv32f> uMat(uMemSeg, devProp.textureAlignment, u.cols, u.rows, u.step); NCVMatrixReuse<Ncv32f> uMat(uMemSeg, static_cast<Ncv32u>(devProp.textureAlignment), u.cols, u.rows, static_cast<Ncv32u>(u.step));
NCVMatrixReuse<Ncv32f> vMat(vMemSeg, devProp.textureAlignment, v.cols, v.rows, v.step); NCVMatrixReuse<Ncv32f> vMat(vMemSeg, static_cast<Ncv32u>(devProp.textureAlignment), v.cols, v.rows, static_cast<Ncv32u>(v.step));
cudaStream_t stream = StreamAccessor::getStream(s); cudaStream_t stream = StreamAccessor::getStream(s);
size_t bufSize = getBufSize(desc, frame0Mat, frame1Mat, uMat, vMat, devProp); size_t bufSize = getBufSize(desc, frame0Mat, frame1Mat, uMat, vMat, devProp);
ensureSizeIsEnough(1, bufSize, CV_8UC1, buf); ensureSizeIsEnough(1, static_cast<int>(bufSize), CV_8UC1, buf);
NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, static_cast<Ncv32u>(devProp.textureAlignment), buf.ptr()); NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, static_cast<Ncv32u>(devProp.textureAlignment), buf.ptr());
......
...@@ -406,7 +406,7 @@ cv::gpu::ORB_GPU::ORB_GPU(int nFeatures, float scaleFactor, int nLevels, int edg ...@@ -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_)); float n_desired_features_per_scale = nFeatures_ * (1.0f - factor) / (1.0f - std::pow(factor, nLevels_));
n_features_per_level_.resize(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) for (int level = 0; level < nLevels_ - 1; ++level)
{ {
n_features_per_level_[level] = cvRound(n_desired_features_per_scale); 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 ...@@ -430,7 +430,7 @@ cv::gpu::ORB_GPU::ORB_GPU(int nFeatures, float scaleFactor, int nLevels, int edg
++v_0; ++v_0;
} }
CV_Assert(u_max.size() < 32); 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<int>(u_max.size()));
// Calc pattern // Calc pattern
const int npoints = 512; const int npoints = 512;
......
...@@ -71,16 +71,16 @@ ...@@ -71,16 +71,16 @@
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
#include "cuda.h" #include <cuda.h>
#include "cuda_runtime_api.h" #include <cuda_runtime.h>
#include "npp.h" #include <npp.h>
#ifdef HAVE_CUFFT #ifdef HAVE_CUFFT
#include "cufft.h" #include <cufft.h>
#endif #endif
#ifdef HAVE_CUBLAS #ifdef HAVE_CUBLAS
#include "cublas.h" #include <cublas.h>
#endif #endif
#include "internal_shared.hpp" #include "internal_shared.hpp"
......
...@@ -204,7 +204,7 @@ static void csbp_operator(StereoConstantSpaceBP& rthis, GpuMat& mbuf, GpuMat& te ...@@ -204,7 +204,7 @@ static void csbp_operator(StereoConstantSpaceBP& rthis, GpuMat& mbuf, GpuMat& te
Size temp_size = data_cost.size(); Size temp_size = data_cost.size();
if ((size_t)temp_size.area() < elem_step * rows_pyr[levels - 1] * rthis.ndisp) 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<int>(elem_step), rows_pyr[levels - 1] * rthis.ndisp);
temp.create(temp_size, DataType<T>::type); temp.create(temp_size, DataType<T>::type);
......
...@@ -375,7 +375,7 @@ TEST_P(FarnebackOpticalFlow, Accuracy) ...@@ -375,7 +375,7 @@ TEST_P(FarnebackOpticalFlow, Accuracy)
EXPECT_MAT_SIMILAR(flowxy[0], d_flowx, 0.1); EXPECT_MAT_SIMILAR(flowxy[0], d_flowx, 0.1);
EXPECT_MAT_SIMILAR(flowxy[1], d_flowy, 0.1); EXPECT_MAT_SIMILAR(flowxy[1], d_flowy, 0.1);
}; }
INSTANTIATE_TEST_CASE_P(GPU_Video, FarnebackOpticalFlow, testing::Combine( INSTANTIATE_TEST_CASE_P(GPU_Video, FarnebackOpticalFlow, testing::Combine(
ALL_DEVICES, ALL_DEVICES,
......
...@@ -173,6 +173,15 @@ missing_consts = \ ...@@ -173,6 +173,15 @@ missing_consts = \
) # public ) # public
}, # Calib3d }, # Calib3d
"Video":
{
'private' :
(
('CV_LKFLOW_INITIAL_GUESSES', 4 ),
('CV_LKFLOW_GET_MIN_EIGENVALS', 8 ),
) # private
}, # Video
} }
......
...@@ -296,8 +296,12 @@ public: ...@@ -296,8 +296,12 @@ public:
Mat temp5; Mat temp5;
}; };
enum
enum { OPTFLOW_USE_INITIAL_FLOW=4, OPTFLOW_FARNEBACK_GAUSSIAN=256 }; {
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 //! computes sparse optical flow using multi-scale Lucas-Kanade algorithm
CV_EXPORTS_W void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg, CV_EXPORTS_W void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg,
......
...@@ -215,7 +215,7 @@ int main(int argc, const char* argv[]) ...@@ -215,7 +215,7 @@ int main(int argc, const char* argv[])
switch (key) switch (key)
{ {
case 27: case 27:
break; return 0;
case 'A': case 'A':
if (currentFrame > 0) if (currentFrame > 0)
...@@ -243,8 +243,6 @@ int main(int argc, const char* argv[]) ...@@ -243,8 +243,6 @@ int main(int argc, const char* argv[])
cerr << "Unknow error" << endl; cerr << "Unknow error" << endl;
return -1; return -1;
} }
return 0;
} }
template <typename T> inline T clamp (T x, T a, T b) template <typename T> inline T clamp (T x, T a, T b)
......
...@@ -271,13 +271,13 @@ int main(int argc, const char *argv[]) ...@@ -271,13 +271,13 @@ int main(int argc, const char *argv[])
displayState(frameDisp, helpScreen, useGPU, findLargestObject, filterRects, fps); displayState(frameDisp, helpScreen, useGPU, findLargestObject, filterRects, fps);
imshow("result", frameDisp); imshow("result", frameDisp);
int key = waitKey(5); char key = (char)waitKey(5);
if (key == 27) if (key == 27)
{ {
break; break;
} }
switch ((char)key) switch (key)
{ {
case ' ': case ' ':
useGPU = !useGPU; useGPU = !useGPU;
......
...@@ -407,10 +407,10 @@ int main(int argc, char **argv) ...@@ -407,10 +407,10 @@ int main(int argc, char **argv)
std::cout << "Using GPU: " << devId << "(" << devProp.name << std::cout << "Using GPU: " << devId << "(" << devProp.name <<
"), arch=" << devProp.major << "." << devProp.minor << std::endl; "), arch=" << devProp.major << "." << devProp.minor << std::endl;
g_pGPUMemAllocator = Ptr<INCVMemAllocator> (new NCVMemNativeAllocator (NCVMemoryTypeDevice, devProp.textureAlignment)); g_pGPUMemAllocator = Ptr<INCVMemAllocator> (new NCVMemNativeAllocator (NCVMemoryTypeDevice, static_cast<Ncv32u>(devProp.textureAlignment)));
ncvAssertPrintReturn (g_pGPUMemAllocator->isInitialized (), "Device memory allocator isn't initialized", -1); ncvAssertPrintReturn (g_pGPUMemAllocator->isInitialized (), "Device memory allocator isn't initialized", -1);
g_pHostMemAllocator = Ptr<INCVMemAllocator> (new NCVMemNativeAllocator (NCVMemoryTypeHostPageable, devProp.textureAlignment)); g_pHostMemAllocator = Ptr<INCVMemAllocator> (new NCVMemNativeAllocator (NCVMemoryTypeHostPageable, static_cast<Ncv32u>(devProp.textureAlignment)));
ncvAssertPrintReturn (g_pHostMemAllocator->isInitialized (), "Host memory allocator isn't initialized", -1); ncvAssertPrintReturn (g_pHostMemAllocator->isInitialized (), "Host memory allocator isn't initialized", -1);
int width, height; int width, height;
......
...@@ -37,8 +37,7 @@ if __name__ == '__main__': ...@@ -37,8 +37,7 @@ if __name__ == '__main__':
print 'EM (opencv) ...' print 'EM (opencv) ...'
em = cv2.EM(points, params = dict( nclusters = cluster_n, cov_mat_type = cv2.EM_COV_MAT_GENERIC) ) em = cv2.EM(points, params = dict( nclusters = cluster_n, cov_mat_type = cv2.EM_COV_MAT_GENERIC) )
means = em.getMeans() means = em.getMeans()
covs = np.zeros((cluster_n, 2, 2), np.float32) covs = em.getCovs()
covs = em.getCovs(covs) # FIXME
found_distrs = zip(means, covs) found_distrs = zip(means, covs)
print 'ready!\n' print 'ready!\n'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment