mapPtr[5] += updatePtr[7];
}
if (motionType == MOTION_EUCLIDEAN) {
- double new_theta = acos(mapPtr[0]) + updatePtr[0];
+ double new_theta = updatePtr[0];
+ if (mapPtr[3]>0)
+ new_theta += acos(mapPtr[0]);
+
+ if (mapPtr[3]<0)
+ new_theta -= acos(mapPtr[0]);
mapPtr[2] += updatePtr[1];
mapPtr[5] += updatePtr[2];
#include "precomp.hpp"
#include "opencl_kernels_video.hpp"
+#if defined __APPLE__ || defined ANDROID
+#define SMALL_LOCALSIZE
+#endif
+
//
// 2D dense optical flow algorithm from the following paper:
// Gunnar Farneback. "Two-Frame Motion Estimation Based on Polynomial Expansion".
bool gaussianBlurOcl(const UMat &src, int ksizeHalf, UMat &dst)
{
-#ifdef ANDROID
+#ifdef SMALL_LOCALSIZE
size_t localsize[2] = { 128, 1};
#else
size_t localsize[2] = { 256, 1};
bool gaussianBlur5Ocl(const UMat &src, int ksizeHalf, UMat &dst)
{
int height = src.rows / 5;
-#ifdef ANDROID
+#ifdef SMALL_LOCALSIZE
size_t localsize[2] = { 128, 1};
#else
size_t localsize[2] = { 256, 1};
}
bool polynomialExpansionOcl(const UMat &src, UMat &dst)
{
-#ifdef ANDROID
+#ifdef SMALL_LOCALSIZE
size_t localsize[2] = { 128, 1};
#else
size_t localsize[2] = { 256, 1};
bool boxFilter5Ocl(const UMat &src, int ksizeHalf, UMat &dst)
{
int height = src.rows / 5;
-#ifdef ANDROID
+#ifdef SMALL_LOCALSIZE
size_t localsize[2] = { 128, 1};
#else
size_t localsize[2] = { 256, 1};
bool updateFlowOcl(const UMat &M, UMat &flowx, UMat &flowy)
{
-#ifdef ANDROID
+#ifdef SMALL_LOCALSIZE
size_t localsize[2] = { 32, 4};
#else
size_t localsize[2] = { 32, 8};
}
bool updateMatricesOcl(const UMat &flowx, const UMat &flowy, const UMat &R0, const UMat &R1, UMat &M)
{
-#ifdef ANDROID
+#ifdef SMALL_LOCALSIZE
size_t localsize[2] = { 32, 4};
#else
size_t localsize[2] = { 32, 8};