Compute Library
18.03
|
#include "helpers.h"
Go to the source code of this file.
Macros | |
#define | EDGE 255 |
#define | hysteresis_local_stack_L1 8 |
#define | hysteresis_local_stack_L2 16 |
#define | check_pixel(early_test, x_pos, y_pos, x_cur, y_cur) |
Check whether pixel is valid. More... | |
Functions | |
__kernel void | combine_gradients_L1 (__global uchar *src1_ptr, uint src1_stride_x, uint src1_step_x, uint src1_stride_y, uint src1_step_y, uint src1_offset_first_element_in_bytes, __global uchar *src2_ptr, uint src2_stride_x, uint src2_step_x, uint src2_stride_y, uint src2_step_y, uint src2_offset_first_element_in_bytes, __global uchar *grad_ptr, uint grad_stride_x, uint grad_step_x, uint grad_stride_y, uint grad_step_y, uint grad_offset_first_element_in_bytes, __global uchar *angle_ptr, uint angle_stride_x, uint angle_step_x, uint angle_stride_y, uint angle_step_y, uint angle_offset_first_element_in_bytes) |
Calculate the magnitude and phase from horizontal and vertical result of sobel result. More... | |
__kernel void | combine_gradients_L2 (__global uchar *src1_ptr, uint src1_stride_x, uint src1_step_x, uint src1_stride_y, uint src1_step_y, uint src1_offset_first_element_in_bytes, __global uchar *src2_ptr, uint src2_stride_x, uint src2_step_x, uint src2_stride_y, uint src2_step_y, uint src2_offset_first_element_in_bytes, __global uchar *grad_ptr, uint grad_stride_x, uint grad_step_x, uint grad_stride_y, uint grad_step_y, uint grad_offset_first_element_in_bytes, __global uchar *angle_ptr, uint angle_stride_x, uint angle_step_x, uint angle_stride_y, uint angle_step_y, uint angle_offset_first_element_in_bytes) |
Calculate the gradient and angle from horizontal and vertical result of sobel result. More... | |
__kernel void | suppress_non_maximum (__global uchar *grad_ptr, uint grad_stride_x, uint grad_step_x, uint grad_stride_y, uint grad_step_y, uint grad_offset_first_element_in_bytes, __global uchar *angle_ptr, uint angle_stride_x, uint angle_step_x, uint angle_stride_y, uint angle_step_y, uint angle_offset_first_element_in_bytes, __global uchar *non_max_ptr, uint non_max_stride_x, uint non_max_step_x, uint non_max_stride_y, uint non_max_step_y, uint non_max_offset_first_element_in_bytes, uint lower_thr) |
Perform non maximum suppression. More... | |
kernel void | hysteresis (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_offset_first_element_in_bytes, __global uchar *out_ptr, uint out_stride_x, uint out_step_x, uint out_stride_y, uint out_step_y, uint out_offset_first_element_in_bytes, __global uchar *visited_ptr, uint visited_stride_x, uint visited_step_x, uint visited_stride_y, uint visited_step_y, uint visited_offset_first_element_in_bytes, __global uchar *recorded_ptr, uint recorded_stride_x, uint recorded_step_x, uint recorded_stride_y, uint recorded_step_y, uint recorded_offset_first_element_in_bytes, __global uchar *l1_stack_ptr, uint l1_stack_stride_x, uint l1_stack_step_x, uint l1_stack_stride_y, uint l1_stack_step_y, uint l1_stack_offset_first_element_in_bytes, __global uchar *l1_stack_counter_ptr, uint l1_stack_counter_stride_x, uint l1_stack_counter_step_x, uint l1_stack_counter_stride_y, uint l1_stack_counter_step_y, uint l1_stack_counter_offset_first_element_in_bytes, uint low_thr, uint up_thr, int width, int height) |
Perform hysteresis. More... | |
Variables | |
__constant short4 | neighbours_coords [] |
Array that holds the relative coordinates offset for the neighbouring pixels. More... | |
#define check_pixel | ( | early_test, | |
x_pos, | |||
y_pos, | |||
x_cur, | |||
y_cur | |||
) |
Check whether pixel is valid.
Skip the pixel if the early_test fails. Otherwise, it tries to add the pixel coordinate to the stack, and proceed to popping the stack instead if the stack is full
[in] | early_test | Boolean condition based on the minv check and visited buffer check |
[in] | x_pos | X-coordinate of pixel that is going to be recorded, has to be within the boundary |
[in] | y_pos | Y-coordinate of pixel that is going to be recorded, has to be within the boundary |
[in] | x_cur | X-coordinate of current central pixel |
[in] | y_cur | Y-coordinate of current central pixel |
Definition at line 242 of file canny.cl.
Referenced by hysteresis().
#define EDGE 255 |
Definition at line 227 of file canny.cl.
Referenced by hysteresis().
#define hysteresis_local_stack_L1 8 |
Definition at line 228 of file canny.cl.
Referenced by hysteresis().
#define hysteresis_local_stack_L2 16 |
Definition at line 229 of file canny.cl.
Referenced by hysteresis().
__kernel void combine_gradients_L1 | ( | __global uchar * | src1_ptr, |
uint | src1_stride_x, | ||
uint | src1_step_x, | ||
uint | src1_stride_y, | ||
uint | src1_step_y, | ||
uint | src1_offset_first_element_in_bytes, | ||
__global uchar * | src2_ptr, | ||
uint | src2_stride_x, | ||
uint | src2_step_x, | ||
uint | src2_stride_y, | ||
uint | src2_step_y, | ||
uint | src2_offset_first_element_in_bytes, | ||
__global uchar * | grad_ptr, | ||
uint | grad_stride_x, | ||
uint | grad_step_x, | ||
uint | grad_stride_y, | ||
uint | grad_step_y, | ||
uint | grad_offset_first_element_in_bytes, | ||
__global uchar * | angle_ptr, | ||
uint | angle_stride_x, | ||
uint | angle_step_x, | ||
uint | angle_stride_y, | ||
uint | angle_step_y, | ||
uint | angle_offset_first_element_in_bytes | ||
) |
Calculate the magnitude and phase from horizontal and vertical result of sobel result.
[in] | src1_ptr | Pointer to the source image (Vertical result of Sobel). Supported data types: S16, S32 |
[in] | src1_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | src1_step_x | src1_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | src1_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | src1_step_y | src1_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | src1_offset_first_element_in_bytes | The offset of the first element in the source image |
[in] | src2_ptr | Pointer to the source image (Vertical result of Sobel). Supported data types: S16, S32 |
[in] | src2_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | src2_step_x | src2_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | src2_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | src2_step_y | src2_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | src2_offset_first_element_in_bytes | The offset of the first element in the source image |
[out] | grad_ptr | Pointer to the gradient output. Supported data types: U16, U32 |
[in] | grad_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | grad_step_x | grad_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | grad_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | grad_step_y | grad_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | grad_offset_first_element_in_bytes | The offset of the first element of the output |
[out] | angle_ptr | Pointer to the angle output. Supported data types: U8 |
[in] | angle_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | angle_step_x | angle_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | angle_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | angle_step_y | angle_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | angle_offset_first_element_in_bytes | The offset of the first element of the output |
Definition at line 57 of file canny.cl.
References arm_compute::test::fixed_point_arithmetic::detail::abs(), CONVERT_SAT, CONVERT_TO_IMAGE_STRUCT, DATA_TYPE_OUT, Image::ptr, and VEC_DATA_TYPE.
__kernel void combine_gradients_L2 | ( | __global uchar * | src1_ptr, |
uint | src1_stride_x, | ||
uint | src1_step_x, | ||
uint | src1_stride_y, | ||
uint | src1_step_y, | ||
uint | src1_offset_first_element_in_bytes, | ||
__global uchar * | src2_ptr, | ||
uint | src2_stride_x, | ||
uint | src2_step_x, | ||
uint | src2_stride_y, | ||
uint | src2_step_y, | ||
uint | src2_offset_first_element_in_bytes, | ||
__global uchar * | grad_ptr, | ||
uint | grad_stride_x, | ||
uint | grad_step_x, | ||
uint | grad_stride_y, | ||
uint | grad_step_y, | ||
uint | grad_offset_first_element_in_bytes, | ||
__global uchar * | angle_ptr, | ||
uint | angle_stride_x, | ||
uint | angle_step_x, | ||
uint | angle_stride_y, | ||
uint | angle_step_y, | ||
uint | angle_offset_first_element_in_bytes | ||
) |
Calculate the gradient and angle from horizontal and vertical result of sobel result.
[in] | src1_ptr | Pointer to the source image (Vertical result of Sobel). Supported data types: S16, S32 |
[in] | src1_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | src1_step_x | src1_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | src1_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | src1_step_y | src1_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | src1_offset_first_element_in_bytes | The offset of the first element in the source image |
[in] | src2_ptr | Pointer to the source image (Vertical result of Sobel). Supported data types: S16, S32 |
[in] | src2_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | src2_step_x | src2_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | src2_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | src2_step_y | src2_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | src2_offset_first_element_in_bytes | The offset of the first element in the source image |
[out] | grad_ptr | Pointer to the gradient output. Supported data types: U16, U32 |
[in] | grad_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | grad_step_x | grad_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | grad_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | grad_step_y | grad_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | grad_offset_first_element_in_bytes | The offset of the first element of the output |
[out] | angle_ptr | Pointer to the angle output. Supported data types: U8 |
[in] | angle_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | angle_step_x | angle_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | angle_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | angle_step_y | angle_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | angle_offset_first_element_in_bytes | The offset of the first element of the output |
Definition at line 121 of file canny.cl.
References CONVERT_SAT_ROUND, CONVERT_TO_IMAGE_STRUCT, DATA_TYPE_OUT, Image::ptr, and VEC_DATA_TYPE.
kernel void hysteresis | ( | __global uchar * | src_ptr, |
uint | src_stride_x, | ||
uint | src_step_x, | ||
uint | src_stride_y, | ||
uint | src_step_y, | ||
uint | src_offset_first_element_in_bytes, | ||
__global uchar * | out_ptr, | ||
uint | out_stride_x, | ||
uint | out_step_x, | ||
uint | out_stride_y, | ||
uint | out_step_y, | ||
uint | out_offset_first_element_in_bytes, | ||
__global uchar * | visited_ptr, | ||
uint | visited_stride_x, | ||
uint | visited_step_x, | ||
uint | visited_stride_y, | ||
uint | visited_step_y, | ||
uint | visited_offset_first_element_in_bytes, | ||
__global uchar * | recorded_ptr, | ||
uint | recorded_stride_x, | ||
uint | recorded_step_x, | ||
uint | recorded_stride_y, | ||
uint | recorded_step_y, | ||
uint | recorded_offset_first_element_in_bytes, | ||
__global uchar * | l1_stack_ptr, | ||
uint | l1_stack_stride_x, | ||
uint | l1_stack_step_x, | ||
uint | l1_stack_stride_y, | ||
uint | l1_stack_step_y, | ||
uint | l1_stack_offset_first_element_in_bytes, | ||
__global uchar * | l1_stack_counter_ptr, | ||
uint | l1_stack_counter_stride_x, | ||
uint | l1_stack_counter_step_x, | ||
uint | l1_stack_counter_stride_y, | ||
uint | l1_stack_counter_step_y, | ||
uint | l1_stack_counter_offset_first_element_in_bytes, | ||
uint | low_thr, | ||
uint | up_thr, | ||
int | width, | ||
int | height | ||
) |
Perform hysteresis.
[in] | src_ptr | Pointer to the input image. Supported data types: U8 |
[in] | src_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | src_step_x | src_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | src_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | src_step_y | src_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | src_offset_first_element_in_bytes | The offset of the first element of the output |
[out] | out_ptr | Pointer to the output image. Supported data types: U8 |
[in] | out_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | out_step_x | out_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | out_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | out_step_y | out_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | out_offset_first_element_in_bytes | The offset of the first element of the output |
[out] | visited_ptr | Pointer to the visited buffer, where pixels are marked as visited. Supported data types: U32 |
[in] | visited_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | visited_step_x | visited_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | visited_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | visited_step_y | visited_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | visited_offset_first_element_in_bytes | The offset of the first element of the output |
[out] | recorded_ptr | Pointer to the recorded buffer, where pixels are marked as recorded. Supported data types: U32 |
[in] | recorded_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | recorded_step_x | recorded_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | recorded_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | recorded_step_y | recorded_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | recorded_offset_first_element_in_bytes | The offset of the first element of the output |
[out] | l1_stack_ptr | Pointer to the l1 stack of a pixel. Supported data types: S32 |
[in] | l1_stack_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | l1_stack_step_x | l1_stack_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | l1_stack_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | l1_stack_step_y | l1_stack_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | l1_stack_offset_first_element_in_bytes | The offset of the first element of the output |
[out] | l1_stack_counter_ptr | Pointer to the l1 stack counters of an image. Supported data types: U8 |
[in] | l1_stack_counter_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | l1_stack_counter_step_x | l1_stack_counter_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | l1_stack_counter_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | l1_stack_counter_step_y | l1_stack_counter_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | l1_stack_counter_offset_first_element_in_bytes | The offset of the first element of the output |
[in] | low_thr | The lower threshold |
[in] | up_thr | The upper threshold |
[in] | width | The width of the image. |
[in] | height | The height of the image |
Definition at line 306 of file canny.cl.
References arm_compute::test::validation::c, check_pixel, CONVERT_TO_IMAGE_STRUCT_NO_STEP, EDGE, hysteresis_local_stack_L1, hysteresis_local_stack_L2, arm_compute::test::fixed_point_arithmetic::detail::max(), arm_compute::test::fixed_point_arithmetic::detail::min(), offset(), Image::ptr, arm_compute::test::validation::src, Image::stride_x, Image::stride_y, and VEC_DATA_TYPE.
__kernel void suppress_non_maximum | ( | __global uchar * | grad_ptr, |
uint | grad_stride_x, | ||
uint | grad_step_x, | ||
uint | grad_stride_y, | ||
uint | grad_step_y, | ||
uint | grad_offset_first_element_in_bytes, | ||
__global uchar * | angle_ptr, | ||
uint | angle_stride_x, | ||
uint | angle_step_x, | ||
uint | angle_stride_y, | ||
uint | angle_step_y, | ||
uint | angle_offset_first_element_in_bytes, | ||
__global uchar * | non_max_ptr, | ||
uint | non_max_stride_x, | ||
uint | non_max_step_x, | ||
uint | non_max_stride_y, | ||
uint | non_max_step_y, | ||
uint | non_max_offset_first_element_in_bytes, | ||
uint | lower_thr | ||
) |
Perform non maximum suppression.
[in] | grad_ptr | Pointer to the gradient output. Supported data types: S16, S32 |
[in] | grad_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | grad_step_x | grad_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | grad_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | grad_step_y | grad_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | grad_offset_first_element_in_bytes | The offset of the first element of the output |
[in] | angle_ptr | Pointer to the angle output. Supported data types: U8 |
[in] | angle_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | angle_step_x | angle_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | angle_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | angle_step_y | angle_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | angle_offset_first_element_in_bytes | TThe offset of the first element of the output |
[out] | non_max_ptr | Pointer to the non maximum suppressed output. Supported data types: U16, U32 |
[in] | non_max_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | non_max_step_x | non_max_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | non_max_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | non_max_step_y | non_max_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | non_max_offset_first_element_in_bytes | The offset of the first element of the output |
[in] | lower_thr | The low threshold |
Definition at line 191 of file canny.cl.
References CONVERT_TO_IMAGE_STRUCT, DATA_TYPE_OUT, offset(), and Image::ptr.
__constant short4 neighbours_coords[] |