1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merged the trunk r8345:8376

This commit is contained in:
Andrey Kamaev
2012-05-18 13:18:37 +00:00
parent 70166820ea
commit e1c4fd9e1f
52 changed files with 1750 additions and 622 deletions
+5 -4
View File
@@ -2324,6 +2324,7 @@ The class provides the following features for all derived classes:
Here is example of SIFT use in your application via Algorithm interface: ::
#include "opencv2/opencv.hpp"
#include "opencv2/nonfree/nonfree.hpp"
...
@@ -2334,22 +2335,22 @@ Here is example of SIFT use in your application via Algorithm interface: ::
FileStorage fs("sift_params.xml", FileStorage::READ);
if( fs.isOpened() ) // if we have file with parameters, read them
{
sift.read(fs["sift_params"]);
sift->read(fs["sift_params"]);
fs.release();
}
else // else modify the parameters and store them; user can later edit the file to use different parameters
{
sift.set("contrastThreshold", 0.01f); // lower the contrast threshold, compared to the default value
sift->set("contrastThreshold", 0.01f); // lower the contrast threshold, compared to the default value
{
WriteStructContext ws(fs, "sift_params", CV_NODE_MAP);
sift.write(fs);
sift->write(fs);
}
}
Mat image = imread("myimage.png", 0), descriptors;
vector<KeyPoint> keypoints;
sift(image, noArray(), keypoints, descriptors);
(*sift)(image, noArray(), keypoints, descriptors);
Algorithm::get
+9 -1
View File
@@ -2897,8 +2897,16 @@ cvKMeans2( const CvArr* _samples, int cluster_count, CvArr* _labels,
namespace cv
{
Mat Mat::reshape(int, int, const int*) const
Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const
{
if(_newndims == dims)
{
if(_newsz == 0)
return reshape(_cn);
if(_newndims == 2)
return reshape(_cn, _newsz[0]);
}
CV_Error(CV_StsNotImplemented, "");
// TBD
return Mat();
+11
View File
@@ -861,3 +861,14 @@ TEST(Core_IOArray, submat_create)
EXPECT_THROW( OutputArray_create1(A.row(0)), cv::Exception );
EXPECT_THROW( OutputArray_create2(A.row(0)), cv::Exception );
}
TEST(Core_Mat, reshape_1942)
{
cv::Mat A = (cv::Mat_<float>(2,3) << 3.4884074, 1.4159607, 0.78737736, 2.3456569, -0.88010466, 0.3009364);
int cn = 0;
ASSERT_NO_THROW(
cv::Mat_<float> M = A.reshape(3);
cn = M.channels();
);
ASSERT_EQ(1, cn);
}
+9 -4
View File
@@ -381,9 +381,12 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) {
//TODO: add new interface for setting fps and capturing resolution.
[mCaptureDecompressedVideoOutput setVideoSettings:pixelBufferOptions];
mCaptureDecompressedVideoOutput.alwaysDiscardsLateVideoFrames = YES;
mCaptureDecompressedVideoOutput.minFrameDuration = CMTimeMake(1, 30);
mCaptureDecompressedVideoOutput.alwaysDiscardsLateVideoFrames = YES;
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
mCaptureDecompressedVideoOutput.minFrameDuration = CMTimeMake(1, 30);
#endif
//Slow. 1280*720 for iPhone4, iPod back camera. 640*480 for front camera
//mCaptureSession.sessionPreset = AVCaptureSessionPresetHigh; // fps ~= 5 slow for OpenCV
@@ -1150,9 +1153,11 @@ CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(const char* filename, int
fileType = [AVFileTypeMPEG4 copy];
}else if ([fileExt isEqualToString:@"m4v"]){
fileType = [AVFileTypeAppleM4V copy];
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
}else if ([fileExt isEqualToString:@"3gp"] || [fileExt isEqualToString:@"3gpp"] || [fileExt isEqualToString:@"sdv"] ){
fileType = [AVFileType3GPP copy];
}else{
#endif
} else{
fileType = [AVFileTypeMPEG4 copy]; //default mp4
}
[fileExt release];
+45 -9
View File
@@ -47,6 +47,18 @@
#pragma warning( disable: 4710 )
#endif
#define COMPILE_MULTIMON_STUBS // Required for multi-monitor support
#if defined SM_CMONITORS && !defined MONITOR_DEFAULTTONEAREST
# define MONITOR_DEFAULTTONULL 0x00000000
# define MONITOR_DEFAULTTOPRIMARY 0x00000001
# define MONITOR_DEFAULTTONEAREST 0x00000002
# define MONITORINFOF_PRIMARY 0x00000001
#endif
#ifndef __inout
# define __inout
#endif
#include <MultiMon.h>
#include <commctrl.h>
#include <winuser.h>
#include <stdlib.h>
@@ -420,7 +432,6 @@ double cvGetModeWindow_W32(const char* name)//YV
return result;
}
#ifdef MONITOR_DEFAULTTONEAREST
void cvSetModeWindow_W32( const char* name, double prop_value)//Yannick Verdie
{
CV_FUNCNAME( "cvSetModeWindow_W32" );
@@ -484,11 +495,6 @@ void cvSetModeWindow_W32( const char* name, double prop_value)//Yannick Verdie
__END__;
}
#else
void cvSetModeWindow_W32( const char*, double)
{
}
#endif
double cvGetPropWindowAutoSize_W32(const char* name)
{
@@ -1065,7 +1071,7 @@ CV_IMPL int cvNamedWindow( const char* name, int flags )
icvSetWindowLongPtr( hWnd, CV_USERDATA, window );
icvSetWindowLongPtr( mainhWnd, CV_USERDATA, window );
// Recalculate window position
// Recalculate window pos
icvUpdateWindowPos( window );
result = 1;
@@ -1633,7 +1639,7 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
WINDOWPOS* pos = (WINDOWPOS*)lParam;
// Update the toolbar position/size
// Update the toolbar pos/size
if(window->toolbar.toolbar)
{
RECT rect;
@@ -1647,6 +1653,36 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
break;
}
case WM_WINDOWPOSCHANGING:
{
// Snap window to screen edges with multi-monitor support. // Adi Shavit
LPWINDOWPOS pos = (LPWINDOWPOS)lParam;
RECT rect;
GetWindowRect(window->frame, &rect);
HMONITOR hMonitor;
hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
MONITORINFO mi;
mi.cbSize = sizeof(mi);
GetMonitorInfo(hMonitor, &mi);
const int SNAP_DISTANCE = 15;
if (abs(pos->x - mi.rcMonitor.left) <= SNAP_DISTANCE)
pos->x = mi.rcMonitor.left; // snap to left edge
else
if (abs(pos->x + pos->cx - mi.rcMonitor.right) <= SNAP_DISTANCE)
pos->x = mi.rcMonitor.right - pos->cx; // snap to right edge
if (abs(pos->y - mi.rcMonitor.top) <= SNAP_DISTANCE)
pos->y = mi.rcMonitor.top; // snap to top edge
else
if (abs(pos->y + pos->cy - mi.rcMonitor.bottom) <= SNAP_DISTANCE)
pos->y = mi.rcMonitor.bottom - pos->cy; // snap to bottom edge
}
case WM_ACTIVATE:
if(LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE)
SetFocus(window->hwnd);
@@ -2199,7 +2235,7 @@ icvCreateTrackbar( const char* trackbar_name, const char* window_name,
SendMessage(window->toolbar.toolbar, TB_SETBUTTONINFO,
(WPARAM)tbs.idCommand, (LPARAM)&tbis);
/* Get button position */
/* Get button pos */
SendMessage(window->toolbar.toolbar, TB_GETITEMRECT,
(WPARAM)tbs.idCommand, (LPARAM)&rect);
+1 -1
View File
@@ -272,7 +272,7 @@ accW_( const T* src, AT* dst, const uchar* mask, int len, int cn, double alpha )
if( mask[i] )
{
for( int k = 0; k < cn; k++ )
dst[k] += src[k]*a + dst[k]*b;
dst[k] = src[k]*a + dst[k]*b;
}
}
}
+1 -1
View File
@@ -556,7 +556,7 @@ cv::Point2d cv::phaseCorrelate(InputArray _src1, InputArray _src2, InputArray _w
t = weightedCentroid(C, peakLoc, Size(5, 5));
// adjust shift relative to image center...
Point2d center((double)src1.cols / 2.0, (double)src1.rows / 2.0);
Point2d center((double)padded1.cols / 2.0, (double)padded1.rows / 2.0);
return (center - t);
}
+10 -3
View File
@@ -203,9 +203,6 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
Mat src = _src.getMat();
CV_Assert( top >= 0 && bottom >= 0 && left >= 0 && right >= 0 );
_dst.create( src.rows + top + bottom, src.cols + left + right, src.type() );
Mat dst = _dst.getMat();
if( src.isSubmatrix() && (borderType & BORDER_ISOLATED) == 0 )
{
Size wholeSize;
@@ -221,6 +218,16 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
bottom -= dbottom;
right -= dright;
}
_dst.create( src.rows + top + bottom, src.cols + left + right, src.type() );
Mat dst = _dst.getMat();
if(top == 0 && left == 0 && bottom == 0 && right == 0)
{
if(src.data != dst.data)
src.copyTo(dst);
return;
}
borderType &= ~BORDER_ISOLATED;
+2 -2
View File
@@ -63,8 +63,8 @@ void CV_PhaseCorrelatorTest::run( int )
{
ts->set_failed_test_info(cvtest::TS::OK);
Mat r1 = Mat::ones(Size(128, 128), CV_64F);
Mat r2 = Mat::ones(Size(128, 128), CV_64F);
Mat r1 = Mat::ones(Size(129, 128), CV_64F);
Mat r2 = Mat::ones(Size(129, 128), CV_64F);
double expectedShiftX = -10.0;
double expectedShiftY = -20.0;
@@ -48,7 +48,7 @@
#define __OPENCV_TRACKING_HPP__
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgproc/imgproc.hpp"
#ifdef __cplusplus
extern "C" {
@@ -303,16 +303,19 @@ enum
OPTFLOW_FARNEBACK_GAUSSIAN = 256
};
//! constructs a pyramid which can be used as input for calcOpticalFlowPyrLK
CV_EXPORTS_W int buildOpticalFlowPyramid(InputArray _img, OutputArrayOfArrays pyramid,
Size winSize, int maxLevel, bool withDerivatives = true,
int pyrBorder = BORDER_REFLECT_101, int derivBorder = BORDER_CONSTANT,
bool tryReuseInputImage = true);
//! computes sparse optical flow using multi-scale Lucas-Kanade algorithm
CV_EXPORTS_W void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg,
InputArray prevPts, CV_OUT InputOutputArray nextPts,
OutputArray status, OutputArray err,
Size winSize=Size(21,21), int maxLevel=3,
TermCriteria criteria=TermCriteria(
TermCriteria::COUNT+TermCriteria::EPS,
30, 0.01),
int flags=0,
double minEigThreshold=1e-4);
TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01),
int flags=0, double minEigThreshold=1e-4);
//! computes dense optical flow using Farneback algorithm
CV_EXPORTS_W void calcOpticalFlowFarneback( InputArray prev, InputArray next,
+2 -2
View File
@@ -33,7 +33,7 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize, OpticalFlowPyrLK, testing::Combine(
testing::Range(0, 3),
testing::Values(1, 3, 4),
testing::Values(make_tuple(9, 9), make_tuple(15, 15)),
testing::Values(11, 21, 25)
testing::Values(7, 11, 21, 25)
)
)
{
@@ -49,7 +49,7 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize, OpticalFlowPyrLK, testing::Combine(
int nPointsY = min(get<1>(get<3>(GetParam())), img1.rows);
int winSize = get<4>(GetParam());
int maxLevel = 2;
TermCriteria criteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS, 5, 0.01);
TermCriteria criteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS, 7, 0.001);
int flags = 0;
double minEigThreshold = 1e-4;
+1 -1
View File
@@ -571,7 +571,7 @@ void BackgroundSubtractorMOG2::operator()(InputArray _image, OutputArray _fgmask
bgmodelUsedModes.data, nmixtures, (float)learningRate,
(float)varThreshold,
backgroundRatio, varThresholdGen,
fVarInit, fVarMin, fVarMax, fCT, fTau,
fVarInit, fVarMin, fVarMax, -learningRate*fCT, fTau,
bShadowDetection, nShadowDetection));
}
}
+184 -45
View File
@@ -493,6 +493,103 @@ struct LKTrackerInvoker
}
int cv::buildOpticalFlowPyramid(InputArray _img, OutputArrayOfArrays pyramid, Size winSize, int maxLevel, bool withDerivatives,
int pyrBorder, int derivBorder, bool tryReuseInputImage)
{
Mat img = _img.getMat();
CV_Assert(img.depth() == CV_8U && winSize.width > 2 && winSize.height > 2 );
int pyrstep = withDerivatives ? 2 : 1;
pyramid.create(1, (maxLevel + 1) * pyrstep, 0 /*type*/, -1, true, 0);
int derivType = CV_MAKETYPE(DataType<deriv_type>::depth, img.channels() * 2);
//level 0
bool lvl0IsSet = false;
if(tryReuseInputImage && img.isSubmatrix() && (pyrBorder & BORDER_ISOLATED) == 0)
{
Size wholeSize;
Point ofs;
img.locateROI(wholeSize, ofs);
if (ofs.x >= winSize.width && ofs.y >= winSize.height
&& ofs.x + img.cols + winSize.width <= wholeSize.width
&& ofs.y + img.rows + winSize.height <= wholeSize.height)
{
pyramid.getMatRef(0) = img;
lvl0IsSet = true;
}
}
if(!lvl0IsSet)
{
Mat& temp = pyramid.getMatRef(0);
if(!temp.empty())
temp.adjustROI(winSize.height, winSize.height, winSize.width, winSize.width);
if(temp.type() != img.type() || temp.cols != winSize.width*2 + img.cols || temp.rows != winSize.height * 2 + img.rows)
temp.create(img.rows + winSize.height*2, img.cols + winSize.width*2, img.type());
if(pyrBorder == BORDER_TRANSPARENT)
img.copyTo(temp(Rect(winSize.width, winSize.height, img.cols, img.rows)));
else
copyMakeBorder(img, temp, winSize.height, winSize.height, winSize.width, winSize.width, pyrBorder);
temp.adjustROI(-winSize.height, -winSize.height, -winSize.width, -winSize.width);
}
Size sz = img.size();
Mat prevLevel = pyramid.getMatRef(0);
Mat thisLevel = prevLevel;
for(int level = 0; level <= maxLevel; ++level)
{
if (level != 0)
{
Mat& temp = pyramid.getMatRef(level * pyrstep);
if(!temp.empty())
temp.adjustROI(winSize.height, winSize.height, winSize.width, winSize.width);
if(temp.type() != img.type() || temp.cols != winSize.width*2 + sz.width || temp.rows != winSize.height * 2 + sz.height)
temp.create(sz.height + winSize.height*2, sz.width + winSize.width*2, img.type());
thisLevel = temp(Rect(winSize.width, winSize.height, sz.width, sz.height));
pyrDown(prevLevel, thisLevel, sz);
if(pyrBorder != BORDER_TRANSPARENT)
copyMakeBorder(thisLevel, temp, winSize.height, winSize.height, winSize.width, winSize.width, pyrBorder|BORDER_ISOLATED);
temp.adjustROI(-winSize.height, -winSize.height, -winSize.width, -winSize.width);
}
if(withDerivatives)
{
Mat& deriv = pyramid.getMatRef(level * pyrstep + 1);
if(!deriv.empty())
deriv.adjustROI(winSize.height, winSize.height, winSize.width, winSize.width);
if(deriv.type() != derivType || deriv.cols != winSize.width*2 + sz.width || deriv.rows != winSize.height * 2 + sz.height)
deriv.create(sz.height + winSize.height*2, sz.width + winSize.width*2, derivType);
Mat derivI = deriv(Rect(winSize.width, winSize.height, sz.width, sz.height));
calcSharrDeriv(thisLevel, derivI);
if(derivBorder != BORDER_TRANSPARENT)
copyMakeBorder(derivI, deriv, winSize.height, winSize.height, winSize.width, winSize.width, derivBorder|BORDER_ISOLATED);
deriv.adjustROI(-winSize.height, -winSize.height, -winSize.width, -winSize.width);
}
sz = Size((sz.width+1)/2, (sz.height+1)/2);
if( sz.width <= winSize.width || sz.height <= winSize.height )
{
pyramid.create(1, (level + 1) * pyrstep, 0 /*type*/, -1, true, 0);//check this
return level;
}
prevLevel = thisLevel;
}
return maxLevel;
}
void cv::calcOpticalFlowPyrLK( InputArray _prevImg, InputArray _nextImg,
InputArray _prevPts, InputOutputArray _nextPts,
OutputArray _status, OutputArray _err,
@@ -504,14 +601,12 @@ void cv::calcOpticalFlowPyrLK( InputArray _prevImg, InputArray _nextImg,
if (tegra::calcOpticalFlowPyrLK(_prevImg, _nextImg, _prevPts, _nextPts, _status, _err, winSize, maxLevel, criteria, flags, minEigThreshold))
return;
#endif
Mat prevImg = _prevImg.getMat(), nextImg = _nextImg.getMat(), prevPtsMat = _prevPts.getMat();
Mat prevPtsMat = _prevPts.getMat();
const int derivDepth = DataType<deriv_type>::depth;
CV_Assert( maxLevel >= 0 && winSize.width > 2 && winSize.height > 2 );
CV_Assert( prevImg.size() == nextImg.size() &&
prevImg.type() == nextImg.type() );
int level=0, i, k, npoints, cn = prevImg.channels(), cn2 = cn*2;
int level=0, i, npoints;
CV_Assert( (npoints = prevPtsMat.checkVector(2, CV_32F, true)) >= 0 );
if( npoints == 0 )
@@ -548,43 +643,73 @@ void cv::calcOpticalFlowPyrLK( InputArray _prevImg, InputArray _nextImg,
err = (float*)errMat.data;
}
vector<Mat> prevPyr(maxLevel+1), nextPyr(maxLevel+1);
// build the image pyramids.
// we pad each level with +/-winSize.{width|height}
// pixels to simplify the further patch extraction.
// Thanks to the reference counting, "temp" mat (the pyramid layer + border)
// will not be deallocated, since {prevPyr|nextPyr}[level] will be a ROI in "temp".
for( k = 0; k < 2; k++ )
vector<Mat> prevPyr, nextPyr;
int levels1 = -1;
int lvlStep1 = 1;
int levels2 = -1;
int lvlStep2 = 1;
if(_prevImg.kind() == _InputArray::STD_VECTOR_MAT)
{
Size sz = prevImg.size();
vector<Mat>& pyr = k == 0 ? prevPyr : nextPyr;
Mat& img0 = k == 0 ? prevImg : nextImg;
for( level = 0; level <= maxLevel; level++ )
_prevImg.getMatVector(prevPyr);
levels1 = int(prevPyr.size()) - 1;
CV_Assert(levels1 >= 0);
if (levels1 % 2 == 1 && prevPyr[0].channels() * 2 == prevPyr[1].channels() && prevPyr[1].depth() == derivDepth)
{
Mat temp(sz.height + winSize.height*2,
sz.width + winSize.width*2,
img0.type());
pyr[level] = temp(Rect(winSize.width, winSize.height, sz.width, sz.height));
if( level == 0 )
img0.copyTo(pyr[level]);
else
pyrDown(pyr[level-1], pyr[level], pyr[level].size());
copyMakeBorder(pyr[level], temp, winSize.height, winSize.height,
winSize.width, winSize.width, BORDER_REFLECT_101|BORDER_ISOLATED);
sz = Size((sz.width+1)/2, (sz.height+1)/2);
if( sz.width <= winSize.width || sz.height <= winSize.height )
{
maxLevel = level;
break;
}
lvlStep1 = 2;
levels1 /= 2;
}
// ensure that pyramid has reqired padding
if(levels1 > 0)
{
Size fullSize;
Point ofs;
prevPyr[lvlStep1].locateROI(fullSize, ofs);
CV_Assert(ofs.x >= winSize.width && ofs.y >= winSize.height
&& ofs.x + prevPyr[lvlStep1].cols + winSize.width <= fullSize.width
&& ofs.y + prevPyr[lvlStep1].rows + winSize.height <= fullSize.height);
}
}
// dI/dx ~ Ix, dI/dy ~ Iy
Mat derivIBuf((prevImg.rows + winSize.height*2),
(prevImg.cols + winSize.width*2),
CV_MAKETYPE(derivDepth, cn2));
if(_nextImg.kind() == _InputArray::STD_VECTOR_MAT)
{
_nextImg.getMatVector(nextPyr);
levels2 = int(nextPyr.size()) - 1;
CV_Assert(levels2 >= 0);
if (levels2 % 2 == 1 && nextPyr[0].channels() * 2 == nextPyr[1].channels() && nextPyr[1].depth() == derivDepth)
{
lvlStep2 = 2;
levels2 /= 2;
}
// ensure that pyramid has reqired padding
if(levels2 > 0)
{
Size fullSize;
Point ofs;
nextPyr[lvlStep2].locateROI(fullSize, ofs);
CV_Assert(ofs.x >= winSize.width && ofs.y >= winSize.height
&& ofs.x + nextPyr[lvlStep2].cols + winSize.width <= fullSize.width
&& ofs.y + nextPyr[lvlStep2].rows + winSize.height <= fullSize.height);
}
}
if(levels1 >= 0 || levels2 >= 0)
maxLevel = std::max(levels1, levels2);
if (levels1 < 0)
maxLevel = levels1 = buildOpticalFlowPyramid(_prevImg, prevPyr, winSize, maxLevel, false);
if (levels2 < 0)
levels2 = buildOpticalFlowPyramid(_nextImg, nextPyr, winSize, maxLevel, false);
CV_Assert(levels1 == levels2);
if( (criteria.type & TermCriteria::COUNT) == 0 )
criteria.maxCount = 30;
@@ -596,17 +721,31 @@ void cv::calcOpticalFlowPyrLK( InputArray _prevImg, InputArray _nextImg,
criteria.epsilon = std::min(std::max(criteria.epsilon, 0.), 10.);
criteria.epsilon *= criteria.epsilon;
// dI/dx ~ Ix, dI/dy ~ Iy
Mat derivIBuf;
if(lvlStep1 == 1)
derivIBuf.create(prevPyr[0].rows + winSize.height*2, prevPyr[0].cols + winSize.width*2, CV_MAKETYPE(derivDepth, prevPyr[0].channels() * 2));
for( level = maxLevel; level >= 0; level-- )
{
Size imgSize = prevPyr[level].size();
Mat _derivI( imgSize.height + winSize.height*2,
imgSize.width + winSize.width*2, derivIBuf.type(), derivIBuf.data );
Mat derivI = _derivI(Rect(winSize.width, winSize.height, imgSize.width, imgSize.height));
calcSharrDeriv(prevPyr[level], derivI);
copyMakeBorder(derivI, _derivI, winSize.height, winSize.height, winSize.width, winSize.width, BORDER_CONSTANT|BORDER_ISOLATED);
Mat derivI;
if(lvlStep1 == 1)
{
Size imgSize = prevPyr[level * lvlStep1].size();
Mat _derivI( imgSize.height + winSize.height*2,
imgSize.width + winSize.width*2, derivIBuf.type(), derivIBuf.data );
derivI = _derivI(Rect(winSize.width, winSize.height, imgSize.width, imgSize.height));
calcSharrDeriv(prevPyr[level * lvlStep1], derivI);
copyMakeBorder(derivI, _derivI, winSize.height, winSize.height, winSize.width, winSize.width, BORDER_CONSTANT|BORDER_ISOLATED);
}
else
derivI = prevPyr[level * lvlStep1 + 1];
parallel_for(BlockedRange(0, npoints), LKTrackerInvoker(prevPyr[level], derivI,
nextPyr[level], prevPts, nextPts,
CV_Assert(prevPyr[level * lvlStep1].size() == nextPyr[level * lvlStep2].size());
CV_Assert(prevPyr[level * lvlStep1].type() == nextPyr[level * lvlStep2].type());
parallel_for(BlockedRange(0, npoints), LKTrackerInvoker(prevPyr[level * lvlStep1], derivI,
nextPyr[level * lvlStep2], prevPts, nextPts,
status, err,
winSize, criteria, level, maxLevel,
flags, (float)minEigThreshold));
+1 -1
View File
@@ -53,7 +53,7 @@
#include "opencv2/video/tracking.hpp"
#include "opencv2/video/background_segm.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/core/internal.hpp"
#ifdef HAVE_TEGRA_OPTIMIZATION