|
|
|
@ -41,7 +41,6 @@ |
|
|
|
|
//M*/
|
|
|
|
|
|
|
|
|
|
#include "test_precomp.hpp" |
|
|
|
|
#include "opencv2/legacy.hpp" |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CUDA |
|
|
|
|
|
|
|
|
@ -373,32 +372,11 @@ INSTANTIATE_TEST_CASE_P(CUDA_OptFlow, OpticalFlowDual_TVL1, testing::Combine( |
|
|
|
|
//////////////////////////////////////////////////////
|
|
|
|
|
// OpticalFlowBM
|
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
void calcOpticalFlowBM(const cv::Mat& prev, const cv::Mat& curr, |
|
|
|
|
cv::Size bSize, cv::Size shiftSize, cv::Size maxRange, int usePrevious, |
|
|
|
|
cv::Mat& velx, cv::Mat& vely) |
|
|
|
|
{ |
|
|
|
|
cv::Size sz((curr.cols - bSize.width + shiftSize.width)/shiftSize.width, (curr.rows - bSize.height + shiftSize.height)/shiftSize.height); |
|
|
|
|
|
|
|
|
|
velx.create(sz, CV_32FC1); |
|
|
|
|
vely.create(sz, CV_32FC1); |
|
|
|
|
|
|
|
|
|
CvMat cvprev = prev; |
|
|
|
|
CvMat cvcurr = curr; |
|
|
|
|
|
|
|
|
|
CvMat cvvelx = velx; |
|
|
|
|
CvMat cvvely = vely; |
|
|
|
|
|
|
|
|
|
cvCalcOpticalFlowBM(&cvprev, &cvcurr, bSize, shiftSize, maxRange, usePrevious, &cvvelx, &cvvely); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct OpticalFlowBM : testing::TestWithParam<cv::cuda::DeviceInfo> |
|
|
|
|
{ |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
CUDA_TEST_P(OpticalFlowBM, Accuracy) |
|
|
|
|
CUDA_TEST_P(OpticalFlowBM, BlockMatching) |
|
|
|
|
{ |
|
|
|
|
cv::cuda::DeviceInfo devInfo = GetParam(); |
|
|
|
|
cv::cuda::setDevice(devInfo.deviceID()); |
|
|
|
@ -419,12 +397,6 @@ CUDA_TEST_P(OpticalFlowBM, Accuracy) |
|
|
|
|
cv::cuda::calcOpticalFlowBM(loadMat(frame0), loadMat(frame1), |
|
|
|
|
block_size, shift_size, max_range, false, |
|
|
|
|
d_velx, d_vely, buf); |
|
|
|
|
|
|
|
|
|
cv::Mat velx, vely; |
|
|
|
|
calcOpticalFlowBM(frame0, frame1, block_size, shift_size, max_range, false, velx, vely); |
|
|
|
|
|
|
|
|
|
EXPECT_MAT_NEAR(velx, d_velx, 0); |
|
|
|
|
EXPECT_MAT_NEAR(vely, d_vely, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(CUDA_OptFlow, OpticalFlowBM, ALL_DEVICES); |
|
|
|
|