Interface class for the depthTo3D kernel.
More...
#include <algorithms.hpp>
|
| | DepthTo3D (clutils::CLEnv &_env, clutils::CLEnvInfo< 1 > _info) |
| | Configures an OpenCL environment as specified by _info. More...
|
| |
| cl::Memory & | get (DepthTo3D::Memory mem) |
| | Returns a reference to an internal memory object. More...
|
| |
| void | init (unsigned int _width, unsigned int _height, float _f, float _scaling=1.f, Staging _staging=Staging::IO) |
| | Configures kernel execution parameters. More...
|
| |
| void | write (DepthTo3D::Memory mem=DepthTo3D::Memory::D_IN, void *ptr=nullptr, bool block=CL_FALSE, const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr) |
| | Performs a data transfer to a device buffer. More...
|
| |
| void * | read (DepthTo3D::Memory mem=DepthTo3D::Memory::H_OUT, bool block=CL_TRUE, const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr) |
| | Performs a data transfer to a staging buffer. More...
|
| |
| void | run (const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr) |
| | Executes the necessary kernels. More...
|
| |
| float | getFocalLength () |
| | Gets the focal length. More...
|
| |
| void | setFocalLength (float _f) |
| | Sets the focal length. More...
|
| |
| float | getScaling () |
| | Gets the scaling factor. More...
|
| |
| void | setScaling (float _scaling) |
| | Sets the scaling factor. More...
|
| |
| template<typename period > |
| double | run (clutils::GPUTimer< period > &timer, const std::vector< cl::Event > *events=nullptr) |
| | Executes the necessary kernels. More...
|
| |
Interface class for the depthTo3D kernel.
depthTo3D performs a transformation from 2D image coordinates to 3D world coordinates (it forms a point cloud). For more details, look at the kernel's documentation.
- Note
- The
depthTo3D kernel is available in kernels/imageSupport_kernels.cl.
-
The class creates its own buffers. If you would like to provide your own buffers, call
get to get references to the placeholders within the class and assign them to your buffers. You will have to do this strictly before the call to init. You can also call get (after the call to init) to get a reference to a buffer within the class and assign it to another kernel class instance further down in your task pipeline.
The following input/output OpenCL memory objects are created by a DepthTo3D instance:
| Name | Type | Placement | I/O | Use | Properties | Size |
| H_IN | Buffer | Host | I | Staging | CL_MEM_READ_WRITE | \(width*height*sizeof\ (cl\_float) \) |
| H_OUT | Buffer | Host | O | Staging | CL_MEM_READ_WRITE | \(width*height*sizeof\ (cl\_float4)\) |
| D_IN | Buffer | Device | I | Processing | CL_MEM_READ_ONLY | \(width*height*sizeof\ (cl\_float) \) |
| D_OUT | Buffer | Device | O | Processing | CL_MEM_WRITE_ONLY | \(width*height*sizeof\ (cl\_float4)\) |
Enumerates the memory objects handled by the class.
- Note
H_* names refer to staging buffers on the host.
-
D_* names refer to buffers on the device.
| Enumerator |
|---|
| H_IN |
Input staging buffer.
|
| H_OUT |
Output staging buffer.
|
| D_IN |
Input buffer.
|
| D_OUT |
Output buffer.
|
| cl_algo::GF::DepthTo3D::DepthTo3D |
( |
clutils::CLEnv & |
_env, |
|
|
clutils::CLEnvInfo< 1 > |
_info |
|
) |
| |
Configures an OpenCL environment as specified by _info.
- Parameters
-
| [in] | _env | opencl environment. |
| [in] | _info | opencl configuration. Specifies the context, queue, etc, to be used. |
Returns a reference to an internal memory object.
This interface exists to allow CL memory sharing between different kernels.
- Parameters
-
| [in] | mem | enumeration value specifying the requested memory object. |
- Returns
- A reference to the requested memory object.
| float cl_algo::GF::DepthTo3D::getFocalLength |
( |
| ) |
|
Gets the focal length.
- Returns
- The focal length of the camera used.
| float cl_algo::GF::DepthTo3D::getScaling |
( |
| ) |
|
Gets the scaling factor.
- Returns
- The scaling factor.
| void cl_algo::GF::DepthTo3D::init |
( |
unsigned int |
_width, |
|
|
unsigned int |
_height, |
|
|
float |
_f, |
|
|
float |
_scaling = 1.f, |
|
|
Staging |
_staging = Staging::IO |
|
) |
| |
Configures kernel execution parameters.
Sets up memory objects as necessary, and defines the kernel workspaces.
- Note
- If you have assigned a memory object to one member variable of the class before the call to
init, then that memory will be maintained. Otherwise, a new memory object will be created.
- Parameters
-
| [in] | _width | width of the array to be processed. |
| [in] | _height | height of the array to be processed. |
| [in] | _f | focal length. |
| [in] | _scaling | factor by which to scale the depth values before building the point cloud. |
| [in] | _staging | flag to indicate whether or not to instantiate the staging buffers. |
Performs a data transfer to a staging buffer.
The transfer happens from a device buffer to the associated (specified) staging buffer on the host.
- Parameters
-
| [in] | mem | enumeration value specifying an output staging buffer. |
| [in] | block | a flag to indicate whether to perform a blocking or a non-blocking operation. |
| [in] | events | a wait-list of events. |
| [out] | event | event associated with the read operation to the staging buffer. |
| void cl_algo::GF::DepthTo3D::run |
( |
const std::vector< cl::Event > * |
events = nullptr, |
|
|
cl::Event * |
event = nullptr |
|
) |
| |
Executes the necessary kernels.
The function call is non-blocking.
- Parameters
-
| [in] | events | a wait-list of events. |
| [out] | event | event associated with the last kernel execution. |
template<typename period >
| double cl_algo::GF::DepthTo3D::run |
( |
clutils::GPUTimer< period > & |
timer, |
|
|
const std::vector< cl::Event > * |
events = nullptr |
|
) |
| |
|
inline |
Executes the necessary kernels.
This run instance is used for profiling.
- Parameters
-
| [in] | timer | GPUTimer that does the profiling of the kernel executions. |
| [in] | events | a wait-list of events. |
- Returns
- Τhe total execution time measured by the timer.
| void cl_algo::GF::DepthTo3D::setFocalLength |
( |
float |
_f | ) |
|
Sets the focal length.
Updates the kernel argument for the focal length.
- Parameters
-
| void cl_algo::GF::DepthTo3D::setScaling |
( |
float |
_scaling | ) |
|
Sets the scaling factor.
Updates the kernel argument for the scaling factor.
- Parameters
-
| [in] | _scaling | scaling factor. |
| void cl_algo::GF::DepthTo3D::write |
( |
DepthTo3D::Memory |
mem = DepthTo3D::Memory::D_IN, |
|
|
void * |
ptr = nullptr, |
|
|
bool |
block = CL_FALSE, |
|
|
const std::vector< cl::Event > * |
events = nullptr, |
|
|
cl::Event * |
event = nullptr |
|
) |
| |
Performs a data transfer to a device buffer.
The transfer happens from a staging buffer on the host to the associated (specified) device buffer.
- Parameters
-
| [in] | mem | enumeration value specifying an input device buffer. |
| [in] | ptr | a pointer to an array holding input data. If not NULL, the data from ptr will be copied to the associated staging buffer. |
| [in] | block | a flag to indicate whether to perform a blocking or a non-blocking operation. |
| [in] | events | a wait-list of events. |
| [out] | event | event associated with the write operation to the device buffer. |
| cl_float* cl_algo::GF::DepthTo3D::hPtrIn |
Mapping of the input staging buffer.
| cl_float4* cl_algo::GF::DepthTo3D::hPtrOut |
Mapping of the output staging buffer.
The documentation for this class was generated from the following files: