Compute Library
18.05
|
Go to the source code of this file.
Functions | |
const float16 | build_perspective_mtx () |
Returns the perspective matrix. More... | |
const float8 | apply_perspective_transform (const float2 coord, const float16 mtx) |
Transforms four 2D coordinates using the formula: More... | |
__kernel void | warp_perspective_nearest_neighbour (__global uchar *in_ptr, uint in_stride_x, uint in_step_x, uint in_stride_y, uint in_step_y, uint in_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, const int width, const int height) |
Performs perspective transformation on an image interpolating with the NEAREAST NEIGHBOUR method. More... | |
__kernel void | warp_perspective_bilinear (__global uchar *in_ptr, uint in_stride_x, uint in_step_x, uint in_stride_y, uint in_step_y, uint in_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, const int width, const int height) |
Performs a perspective transform on an image interpolating with the BILINEAR method. More... | |
|
inline |
Transforms four 2D coordinates using the formula:
x0 = M[1][1] * x + M[1][2] * y + M[1][3] y0 = M[2][1] * x + M[2][2] * y + M[2][3] z0 = M[3][1] * x + M[3][2] * y + M[3][3]
(x0/z0,y0/z0)
[in] | coord | 2D coordinate to transform. |
[in] | mtx | perspective matrix |
Definition at line 46 of file warp_perspective.cl.
Referenced by warp_perspective_bilinear(), and warp_perspective_nearest_neighbour().
|
inline |
Returns the perspective matrix.
Definition at line 28 of file warp_perspective.cl.
Referenced by warp_perspective_bilinear(), and warp_perspective_nearest_neighbour().
__kernel void warp_perspective_bilinear | ( | __global uchar * | in_ptr, |
uint | in_stride_x, | ||
uint | in_step_x, | ||
uint | in_stride_y, | ||
uint | in_step_y, | ||
uint | in_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, | ||
const int | width, | ||
const int | height | ||
) |
Performs a perspective transform on an image interpolating with the BILINEAR method.
Input and output are single channel U8.
[in] | in_ptr | Pointer to the source image. Supported data types: U8. |
[in] | in_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | in_step_x | in_stride_x * number of elements along X processed per work item (in bytes) |
[in] | in_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | in_step_y | in_stride_y * number of elements along Y processed per work item (in bytes) |
[in] | in_offset_first_element_in_bytes | Offset of the first element in the source image |
[out] | out_ptr | Pointer to the destination image. Supported data types: U8. |
[in] | out_stride_x | Stride of the destination image in X dimension (in bytes) |
[in] | out_step_x | out_stride_x * number of elements along X processed per work item (in bytes) |
[in] | out_stride_y | Stride of the destination image in Y dimension (in bytes) |
[in] | out_step_y | out_stride_y * number of elements along Y processed per work item (in bytes) |
[in] | out_offset_first_element_in_bytes | Offset of the first element in the destination image |
[in] | width | Width of the destination image |
[in] | height | Height of the destination image |
Definition at line 119 of file warp_perspective.cl.
References apply_perspective_transform(), bilinear_interpolate(), build_perspective_mtx(), CONVERT_TO_IMAGE_STRUCT, CONVERT_TO_IMAGE_STRUCT_NO_STEP, get_current_coords(), and Image::ptr.
__kernel void warp_perspective_nearest_neighbour | ( | __global uchar * | in_ptr, |
uint | in_stride_x, | ||
uint | in_step_x, | ||
uint | in_stride_y, | ||
uint | in_step_y, | ||
uint | in_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, | ||
const int | width, | ||
const int | height | ||
) |
Performs perspective transformation on an image interpolating with the NEAREAST NEIGHBOUR method.
Input and output are single channel U8.
This kernel performs perspective transform with a 3x3 Matrix M with this method of pixel coordinate translation: x0 = M[1][1] * x + M[1][2] * y + M[1][3] y0 = M[2][1] * x + M[2][2] * y + M[2][3] z0 = M[3][1] * x + M[3][2] * y + M[3][3]
output(x,y) = input(x0/z0,y0/z0)
[in] | in_ptr | Pointer to the source image. Supported data types: U8. |
[in] | in_stride_x | Stride of the source image in X dimension (in bytes) |
[in] | in_step_x | in_stride_x * number of elements along X processed per work item (in bytes) |
[in] | in_stride_y | Stride of the source image in Y dimension (in bytes) |
[in] | in_step_y | in_stride_y * number of elements along Y processed per work item (in bytes) |
[in] | in_offset_first_element_in_bytes | Offset of the first element in the source image |
[out] | out_ptr | Pointer to the destination image. Supported data types: U8. |
[in] | out_stride_x | Stride of the destination image in X dimension (in bytes) |
[in] | out_step_x | out_stride_x * number of elements along X processed per work item (in bytes) |
[in] | out_stride_y | Stride of the destination image in Y dimension (in bytes) |
[in] | out_step_y | out_stride_y * number of elements along Y processed per work item (in bytes) |
[in] | out_offset_first_element_in_bytes | Offset of the first element in the destination image |
[in] | width | Width of the destination image |
[in] | height | Height of the destination image |
Definition at line 87 of file warp_perspective.cl.
References apply_perspective_transform(), build_perspective_mtx(), clamp_to_border(), CONVERT_TO_IMAGE_STRUCT, CONVERT_TO_IMAGE_STRUCT_NO_STEP, get_current_coords(), Image::ptr, and read_texels4().