|
|
|
|
|
|
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
|
|
| __kernel void
|
| AKAZE_pm_g2(__global const float* lx, __global const float* ly, __global float* dst,
|
| float k, int size)
|
| {
|
| int i = get_global_id(0);
|
|
|
| if (!(i < size))
|
| {
|
| return;
|
| }
|
|
|
| const float k2inv = 1.0f / (k * k);
|
| dst[i] = 1.0f / (1.0f + ((lx[i] * lx[i] + ly[i] * ly[i]) * k2inv));
|
| }
|
|
|
| __kernel void
|
| AKAZE_nld_step_scalar(__global const float* lt, int lt_step, int lt_offset, int rows, int cols,
|
| __global const float* lf, __global float* dst, float step_size)
|
| {
|
| |
| |
| |
| |
|
|
|
|
| int i = get_global_id(1);
|
| int j = get_global_id(0);
|
|
|
|
|
| if (!(i < rows && j < cols))
|
| {
|
| return;
|
| }
|
|
|
|
|
| int a = (i - 1) * cols;
|
| int c = (i ) * cols;
|
| int b = (i + 1) * cols;
|
|
|
| float res = 0.0f;
|
| if (i == 0)
|
| {
|
| if (j == 0 || j == (cols - 1))
|
| {
|
| res = 0.0f;
|
| } else
|
| {
|
| res = (lf[c + j] + lf[c + j + 1])*(lt[c + j + 1] - lt[c + j]) +
|
| (lf[c + j] + lf[c + j - 1])*(lt[c + j - 1] - lt[c + j]) +
|
| (lf[c + j] + lf[b + j ])*(lt[b + j ] - lt[c + j]);
|
| }
|
| } else if (i == (rows - 1))
|
| {
|
| if (j == 0 || j == (cols - 1))
|
| {
|
| res = 0.0f;
|
| } else
|
| {
|
| res = (lf[c + j] + lf[c + j + 1])*(lt[c + j + 1] - lt[c + j]) +
|
| (lf[c + j] + lf[c + j - 1])*(lt[c + j - 1] - lt[c + j]) +
|
| (lf[c + j] + lf[a + j ])*(lt[a + j ] - lt[c + j]);
|
| }
|
| } else
|
| {
|
| if (j == 0)
|
| {
|
| res = (lf[c + 0] + lf[c + 1])*(lt[c + 1] - lt[c + 0]) +
|
| (lf[c + 0] + lf[b + 0])*(lt[b + 0] - lt[c + 0]) +
|
| (lf[c + 0] + lf[a + 0])*(lt[a + 0] - lt[c + 0]);
|
| } else if (j == (cols - 1))
|
| {
|
| res = (lf[c + j] + lf[c + j - 1])*(lt[c + j - 1] - lt[c + j]) +
|
| (lf[c + j] + lf[b + j ])*(lt[b + j ] - lt[c + j]) +
|
| (lf[c + j] + lf[a + j ])*(lt[a + j ] - lt[c + j]);
|
| } else
|
| {
|
| res = (lf[c + j] + lf[c + j + 1])*(lt[c + j + 1] - lt[c + j]) +
|
| (lf[c + j] + lf[c + j - 1])*(lt[c + j - 1] - lt[c + j]) +
|
| (lf[c + j] + lf[b + j ])*(lt[b + j ] - lt[c + j]) +
|
| (lf[c + j] + lf[a + j ])*(lt[a + j ] - lt[c + j]);
|
| }
|
| }
|
|
|
| dst[c + j] = res * step_size;
|
| }
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| __kernel void
|
| AKAZE_compute_determinant(__global const float* lxx, __global const float* lxy, __global const float* lyy,
|
| __global float* dst, float sigma, int size)
|
| {
|
| int i = get_global_id(0);
|
|
|
| if (!(i < size))
|
| {
|
| return;
|
| }
|
|
|
| dst[i] = (lxx[i] * lyy[i] - lxy[i] * lxy[i]) * sigma;
|
| }
|
|
|