Data Structures and Utility Functions — OpenCV 2.4.6.1 documentation

### Navigation

- index
- next |
- previous |
- OpenCV 2.4.6.1 documentation »
- OpenCV API Reference »
- ocl. OpenCL-accelerated Computer Vision »

# Data Structures and Utility Functions

## ocl::Info

class `ocl::``Info`

this class should be maintained by the user and be passed to getDevice

## ocl::getDevice

Returns the list of devices

C++:`` int `ocl::``getDevice`(std::vector<Info>& oclinfo, int devicetype=CVCL_DEVICE_TYPE_GPU )

  Parameters: | oclinfo – Output vector of `ocl::Info` structures devicetype – One of `CVCL_DEVICE_TYPE_GPU`, `CVCL_DEVICE_TYPE_CPU` or `CVCL_DEVICE_TYPE_DEFAULT`.

the function must be called before any other `cv::ocl` functions; it initializes ocl runtime.

## ocl::setDevice

Returns void

C++:`` void `ocl::``setDevice`(Info& oclinfo, int devnum=0 )

  Parameters: | oclinfo – Output vector of `ocl::Info` structures devnum – the selected OpenCL device under this platform.

## ocl::setBinpath

Returns void

C++:`` void `ocl::``setBinpath`(const char* path)

  Parameters: | path – the path of OpenCL kernel binaries

If you call this function and set a valid path, the OCL module will save the compiled kernel to the address in the first time and reload the binary since that. It can save compilation time at the runtime.

## ocl::getoclContext

Returns the pointer to the opencl context

C++:`` void* `ocl::``getoclContext`()

Thefunction are used to get opencl context so that opencv can interactive with other opencl program.

## ocl::getoclCommandQueue

Returns the pointer to the opencl command queue

C++:`` void* `ocl::``getoclCommandQueue`()

Thefunction are used to get opencl command queue so that opencv can interactive with other opencl program.

## Help and Feedback

You did not find what you were looking for?

- Ask a question on the Q&A forum.
- If you think something is missing or wrong in the documentation, please file a bug report.

### Navigation

- index
- next |
- previous |
- OpenCV 2.4.6.1 documentation »
- OpenCV API Reference »
- ocl. OpenCL-accelerated Computer Vision »