//M*/
#include "test_precomp.hpp"
-#include "opencv2/legacy.hpp"
#ifdef HAVE_CUDA
//////////////////////////////////////////////////////
// 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());
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);