GuidedFilter  1.2.0
 Hosted by GitHub
Functions
imageSupport_kernels.cl File Reference

Kernels for manipulating images. More...

Functions

kernel void separateRGBChannels_Float2Float (global float *AoS, global float *r, global float *g, global float *b, local float *data)
 Separates the 3 channels of an RGB image. More...
 
kernel void separateRGBChannels_Uchar2Float (global uchar *AoS, global float *r, global float *g, global float *b, local uchar *data)
 Separates the 3 channels of an RGB image. More...
 
kernel void combineRGBChannels_Float2Float (global float *r, global float *g, global float *b, global float *AoS, local float *data)
 Combines the 3 channels of an RGB Image. More...
 
kernel void combineRGBChannels_Float2Uchar (global float *r, global float *g, global float *b, global uchar *AoS, local float *data)
 Combines the 3 channels of an RGB Image. More...
 
kernel void depth_Ushort2Float (global ushort4 *depth, global float4 *fDepth, float scaling)
 Converts a buffer from type uchort to float. More...
 
kernel void depthTo3D (global float *depth, global float4 *pCloud, float f, float scaling)
 Transforms a depth image to a point cloud. More...
 
kernel void rgbNorm (global float *in, global float *out)
 Performs RGB color normalization. More...
 
kernel void rgbdTo8D (global float *depth, global float *r, global float *g, global float *b, global float8 *p8D, local float *data, uint cols, float f, float scaling, int rgb_norm)
 Fuses 3-D space coordinates and RGB color values into 8-D feature points (homogeneous coordinates + RGBA values). More...
 
kernel void splitPC8D (global float8 *pc8d, global float4 *pc4d, global float4 *rgba, unsigned int offset)
 Splits an 8-D point cloud into 4-D geometry points and RGBA color points. More...
 

Detailed Description

Kernels for manipulating images.

Author
Nick Lamprianidis
Version
1.1
Date
2015
Copyright (c) 2015 Nick Lamprianidis
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Function Documentation

kernel void combineRGBChannels_Float2Float ( global float *  r,
global float *  g,
global float *  b,
global float *  AoS,
local float *  data 
)

Combines the 3 channels of an RGB Image.

Performs a matrix transposition on an RGB image (SoA -> AoS). For avoiding alignment restrictions, the SoA structure is broken out to the individual channels, R, G, B.

Note
The global workspace should be one-dimensional (= # pixels in the input buffer). The global and local workspaces should be multiples of 3.
Parameters
[in]rinput buffer with all the pixel values in channel R.
[in]ginput buffer with all the pixel values in channel G.
[in]binput buffer with all the pixel values in channel B.
[out]AoSoutput buffer with the following (logical) arrangement: float[total-pixels][3]. Each row contains the RGB values of a pixel.
[in]datalocal buffer with size 3 x (# work-items in work-group) x sizeof (float) bytes.
kernel void combineRGBChannels_Float2Uchar ( global float *  r,
global float *  g,
global float *  b,
global uchar *  AoS,
local float *  data 
)

Combines the 3 channels of an RGB Image.

Performs a matrix transposition on an RGB image (SoA -> AoS), demotes the float type to uchar, and scales the data to 255. For avoiding alignment restrictions, the SoA structure is broken out to the individual channels, R, G, B.

Note
The global workspace should be one-dimensional (= # pixels in the input buffer). The global and local workspaces should be multiples of 3.
Parameters
[in]rinput buffer with all the pixel values in channel R.
[in]ginput buffer with all the pixel values in channel G.
[in]binput buffer with all the pixel values in channel B.
[out]AoSoutput buffer with the following (logical) arrangement: uchar[total-pixels][3]. Each row contains the RGB values of a pixel.
[in]datalocal buffer with size 3 x (# work-items in work-group) x sizeof (float) bytes.
kernel void depth_Ushort2Float ( global ushort4 *  depth,
global float4 *  fDepth,
float  scaling 
)

Converts a buffer from type uchort to float.

Note
The global workspace should be one dimensional and equal to the number of elements in the image divided by 4.
Parameters
[in]depthdepth image (for Kinect, type: uint16, unit: mm).
[out]fDepthdepth image with type float.
[in]scalingfactor by which to scale the depth values in the output array.
kernel void depthTo3D ( global float *  depth,
global float4 *  pCloud,
float  f,
float  scaling 
)

Transforms a depth image to a point cloud.

Note
The global workspace should be equal to the dimensions of the image.
Parameters
[in]depthdepth image.
[out]pCloudpoint cloud (in 4D homogeneous coordinates with \( w=1 \)).
[in]ffocal length (for Kinect: 595.f).
[in]scalingfactor by which to scale the depth values before building the point cloud.
kernel void rgbdTo8D ( global float *  depth,
global float *  r,
global float *  g,
global float *  b,
global float8 *  p8D,
local float *  data,
uint  cols,
float  f,
float  scaling,
int  rgb_norm 
)

Fuses 3-D space coordinates and RGB color values into 8-D feature points (homogeneous coordinates + RGBA values).

Gathers the R, G, B channel values and assembles them into a pixel with opacity set to 1.0. It can optionally perform RGB normalization. Transforms the depth values into 4-D homogeneous coordinates, setting \( w=1 \).

Note
The global workspace should be one-dimensional (= # elements in the input buffers). Both global and local workspaces should be multiples of 3.
Parameters
[in]depthdepth array.
[in]rchannel R array.
[in]gchannel G array.
[in]bchannel B array.
[out]p8Darray of 8D elements (homogeneous coordinates + RGBA values).
[in]datalocal buffer with size 3 x (# work-items in work-group) x sizeof (float) bytes.
[in]colsnumber of columns (width) in the input images.
[in]ffocal length (for Kinect: 595.f).
[in]scalingfactor by which to scale the depth values before building the point cloud.
[in]rgb_normflag to indicate whether to perform RGB normalization.
kernel void rgbNorm ( global float *  in,
global float *  out 
)

Performs RGB color normalization.

That is $$ \hat{p}.i = \frac{p.i}{p.r + p.g + p.b},\ \ i=\{r,g,b\} $$

Note
The global workspace should be one-dimensional (= # pixels in the input buffer).
Parameters
[in]inoriginal frame.
[out]outprocessed frame.
kernel void separateRGBChannels_Float2Float ( global float *  AoS,
global float *  r,
global float *  g,
global float *  b,
local float *  data 
)

Separates the 3 channels of an RGB image.

Performs a matrix transposition on an RGB image (AoS -> SoA). For avoiding alignment restrictions, the SoA structure is broken out to the individual channels, R, G, B.

Note
The global workspace should be one-dimensional (= # pixels in the input buffer). The global and local workspaces should be multiples of 3.
Parameters
[in]AoSinput buffer with the following (logical) arrangement: float[total-pixels][3]. Each row contains the RGB values of a pixel.
[out]routput buffer with all the pixel values in the first channel, R.
[out]goutput buffer with all the pixel values in the second channel, G.
[out]boutput buffer with all the pixel values in the third channel, B.
[in]datalocal buffer with size 3 x (# work-items in work-group) x sizeof (float) bytes.
kernel void separateRGBChannels_Uchar2Float ( global uchar *  AoS,
global float *  r,
global float *  g,
global float *  b,
local uchar *  data 
)

Separates the 3 channels of an RGB image.

Performs a matrix transposition on an RGB image (AoS -> SoA), and promotes the uchar type to float while normalizing the values to one. For avoiding alignment restrictions, the SoA structure is broken out to the individual channels, R, G, B.

Note
The global workspace should be one-dimensional (= # pixels in the input buffer). The global and local workspaces should be multiples of 3.
Parameters
[in]AoSinput buffer with the following (logical) arrangement: uchar[total-pixels][3]. Each row contains the RGB values of a pixel.
[out]routput buffer with all the pixel values in the first channel, R.
[out]goutput buffer with all the pixel values in the second channel, G.
[out]boutput buffer with all the pixel values in the third channel, B.
[in]datalocal buffer with size 3 x (# work-items in work-group) x sizeof (uchar) bytes.
kernel void splitPC8D ( global float8 *  pc8d,
global float4 *  pc4d,
global float4 *  rgba,
unsigned int  offset 
)

Splits an 8-D point cloud into 4-D geometry points and RGBA color points.

Note
The global workspace should be one-dimensional. The x dimension of the global workspace, \( gXdim \), should be equal to the number of points in the point cloud. The local workspace is irrelevant.
Parameters
[in]pc8darray with 8-D points (homogeneous coordinates + RGBA values).
[out]pc4darray with 4-D geometry points.
[out]rgbaarray with 4-D color points.
[in]offsetnumber of points to skip in the output arrays. The kernel will write in the output arrays starting at position offset.