mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Fix OpenCL's wrong output of calcOpticalFlowPyrLK function's output vector of err. Improve err's precison of the calcOpticalFlowPyrLK OpenCL function and add the relative test.
This commit is contained in:
@@ -849,6 +849,9 @@ namespace
|
||||
return false;
|
||||
if (maxLevel < 0 || winSize.width <= 2 || winSize.height <= 2)
|
||||
return false;
|
||||
if (winSize.width < 16 || winSize.height < 16 ||
|
||||
winSize.width > 24 || winSize.height > 24)
|
||||
return false;
|
||||
calcPatchSize();
|
||||
if (patch.x <= 0 || patch.x >= 6 || patch.y <= 0 || patch.y >= 6)
|
||||
return false;
|
||||
|
||||
@@ -260,7 +260,7 @@ inline void GetPatch(image2d_t J, float x, float y,
|
||||
|
||||
inline void GetError(image2d_t J, const float x, const float y, const float* Pch, float* errval)
|
||||
{
|
||||
float diff = read_imagef(J, sampler, (float2)(x,y)).x-*Pch;
|
||||
float diff = (((read_imagef(J, sampler, (float2)(x,y)).x * 16384) + 256) / 512) - (((*Pch * 16384) + 256) /512);
|
||||
*errval += fabs(diff);
|
||||
}
|
||||
|
||||
@@ -526,6 +526,6 @@ __kernel void lkSparse(image2d_t I, image2d_t J,
|
||||
nextPts[gid] = prevPt;
|
||||
|
||||
if (calcErr)
|
||||
err[gid] = smem1[0] / (float)(c_winSize_x * c_winSize_y);
|
||||
err[gid] = smem1[0] / (float)(32 * c_winSize_x * c_winSize_y);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user