Commit 6207d338 authored by Ernest Galbrun's avatar Ernest Galbrun

merged new master branch

changed tests for tvl1 optflow
correction of a bug preventing compilation with cuda (fmin changed to fminf)
parent fae69df9
...@@ -378,7 +378,6 @@ PERF_TEST_P(ImagePair, OpticalFlowDual_TVL1, ...@@ -378,7 +378,6 @@ PERF_TEST_P(ImagePair, OpticalFlowDual_TVL1,
alg->set("medianFiltering", 1); alg->set("medianFiltering", 1);
alg->set("innerIterations", 1); alg->set("innerIterations", 1);
alg->set("outerIterations", 300); alg->set("outerIterations", 300);
TEST_CYCLE() alg->calc(frame0, frame1, flow); TEST_CYCLE() alg->calc(frame0, frame1, flow);
CPU_SANITY_CHECK(flow); CPU_SANITY_CHECK(flow);
......
...@@ -61,7 +61,7 @@ namespace cv { namespace cuda { namespace device ...@@ -61,7 +61,7 @@ namespace cv { namespace cuda { namespace device
template <int channels> static float __device__ pixeldiff(const uchar* left, const uchar* right, float max_data_term); template <int channels> static float __device__ pixeldiff(const uchar* left, const uchar* right, float max_data_term);
template<> __device__ __forceinline__ static float pixeldiff<1>(const uchar* left, const uchar* right, float max_data_term) template<> __device__ __forceinline__ static float pixeldiff<1>(const uchar* left, const uchar* right, float max_data_term)
{ {
return fmin( ::abs((int)*left - *right), max_data_term); return fminf( ::abs((int)*left - *right), max_data_term);
} }
template<> __device__ __forceinline__ static float pixeldiff<3>(const uchar* left, const uchar* right, float max_data_term) template<> __device__ __forceinline__ static float pixeldiff<3>(const uchar* left, const uchar* right, float max_data_term)
{ {
...@@ -69,7 +69,7 @@ namespace cv { namespace cuda { namespace device ...@@ -69,7 +69,7 @@ namespace cv { namespace cuda { namespace device
float tg = 0.587f * ::abs((int)left[1] - right[1]); float tg = 0.587f * ::abs((int)left[1] - right[1]);
float tr = 0.299f * ::abs((int)left[2] - right[2]); float tr = 0.299f * ::abs((int)left[2] - right[2]);
return fmin(tr + tg + tb, max_data_term); return fminf(tr + tg + tb, max_data_term);
} }
template<> __device__ __forceinline__ static float pixeldiff<4>(const uchar* left, const uchar* right, float max_data_term) template<> __device__ __forceinline__ static float pixeldiff<4>(const uchar* left, const uchar* right, float max_data_term)
{ {
...@@ -80,7 +80,7 @@ namespace cv { namespace cuda { namespace device ...@@ -80,7 +80,7 @@ namespace cv { namespace cuda { namespace device
float tg = 0.587f * ::abs((int)l.y - r.y); float tg = 0.587f * ::abs((int)l.y - r.y);
float tr = 0.299f * ::abs((int)l.z - r.z); float tr = 0.299f * ::abs((int)l.z - r.z);
return fmin(tr + tg + tb, max_data_term); return fminf(tr + tg + tb, max_data_term);
} }
template <typename T> template <typename T>
......
...@@ -166,7 +166,13 @@ TEST(Video_calcOpticalFlowDual_TVL1, Regression) ...@@ -166,7 +166,13 @@ TEST(Video_calcOpticalFlowDual_TVL1, Regression)
ASSERT_EQ(gold.rows, flow.rows); ASSERT_EQ(gold.rows, flow.rows);
ASSERT_EQ(gold.cols, flow.cols); ASSERT_EQ(gold.cols, flow.cols);
const double err = calcRMSE(gold, flow); double err = calcRMSE(gold, flow);
EXPECT_LE(err, MAX_RMSE);
tvl1->set("gamma", 1.f);
tvl1->calc(frame1, frame2, flow);
ASSERT_EQ(gold.rows, flow.rows);
ASSERT_EQ(gold.cols, flow.cols);
err = calcRMSE(gold, flow);
EXPECT_LE(err, MAX_RMSE); EXPECT_LE(err, MAX_RMSE);
#endif #endif
} }
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