pull/13383/head
Marina Kolpakova 13 years ago
parent 99aed4713f
commit 476c453ef6
  1. 2
      modules/gpu/src/nvidia/NPP_staging/NPP_staging.cu
  2. 31
      modules/gpu/test/test_video.cpp

@ -2508,7 +2508,7 @@ __global__ void resizeBicubic(NcvSize32u srcSize,
wsum += wx; wsum += wx;
} }
} }
dst[(ix + dstROI.x)+ (iy + dstROI.y) * dstStep] = sum / wsum; dst[(ix + dstROI.x)+ (iy + dstROI.y) * dstStep] = (!wsum)? 0 : sum / wsum;
} }

@ -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,
@ -384,4 +384,33 @@ INSTANTIATE_TEST_CASE_P(GPU_Video, FarnebackOpticalFlow, testing::Combine(
testing::Values(FarnebackOptFlowFlags(0), FarnebackOptFlowFlags(cv::OPTFLOW_FARNEBACK_GAUSSIAN)), testing::Values(FarnebackOptFlowFlags(0), FarnebackOptFlowFlags(cv::OPTFLOW_FARNEBACK_GAUSSIAN)),
testing::Values(UseInitFlow(false), UseInitFlow(true)))); testing::Values(UseInitFlow(false), UseInitFlow(true))));
struct OpticalFlowNan : public BroxOpticalFlow {};
TEST_P(OpticalFlowNan, Regression)
{
cv::Mat frame0 = readImageType("opticalflow/frame0.png", CV_32FC1);
ASSERT_FALSE(frame0.empty());
cv::Mat r_frame0, r_frame1;
cv::resize(frame0, r_frame0, cv::Size(1380,1000));
cv::Mat frame1 = readImageType("opticalflow/frame1.png", CV_32FC1);
ASSERT_FALSE(frame1.empty());
cv::resize(frame1, r_frame1, cv::Size(1380,1000));
cv::gpu::BroxOpticalFlow brox(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
5 /*inner_iterations*/, 150 /*outer_iterations*/, 10 /*solver_iterations*/);
cv::gpu::GpuMat u;
cv::gpu::GpuMat v;
brox(loadMat(r_frame0), loadMat(r_frame1), u, v);
cv::Mat h_u, h_v;
u.download(h_u);
v.download(h_v);
EXPECT_TRUE(cv::checkRange(h_u));
EXPECT_TRUE(cv::checkRange(h_v));
};
INSTANTIATE_TEST_CASE_P(GPU_Video, OpticalFlowNan, ALL_DEVICES);
} // namespace } // namespace

Loading…
Cancel
Save