Data Structures and Utility Functions — OpenCV 2.4.13.0 documentation

### Navigation

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

# Data Structures and Utility Functions

## ocl::getOpenCLPlatforms

Returns the list of OpenCL platforms

C++:`` int `ocl::``getOpenCLPlatforms`(PlatformsInfo& platforms)

  Parameters: | platforms – Output variable

## ocl::getOpenCLDevices

Returns the list of devices

C++:`` int `ocl::``getOpenCLDevices`(DevicesInfo& devices, int deviceType=CVCL_DEVICE_TYPE_GPU, const PlatformInfo* platform=NULL )

  Parameters: | devices – Output variable deviceType – Bitmask of `CVCL_DEVICE_TYPE_GPU`, `CVCL_DEVICE_TYPE_CPU` or `CVCL_DEVICE_TYPE_DEFAULT`. platform – Specifies preferrable platform

## ocl::setDevice

Initialize OpenCL computation context

C++:`` void `ocl::``setDevice`(const DeviceInfo* info)

  Parameters: | info – device info

## ocl::initializeContext

Alternative way to initialize OpenCL computation context.

C++:`` void `ocl::``initializeContext`(void* pClPlatform, void* pClContext, void* pClDevice)

  Parameters: | pClPlatform – selected `platform_id` (via pointer, parameter type is `cl_platform_id*`) pClContext – selected `cl_context` (via pointer, parameter type is `cl_context*`) pClDevice – selected `cl_device_id` (via pointer, parameter type is `cl_device_id*`)

This function can be used for context initialization with D3D/OpenGL interoperability.

## ocl::setBinaryPath

Returns void

C++:`` void `ocl::``setBinaryPath`(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.

## 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.13.0 documentation »
- OpenCV API Reference »
- ocl. OpenCL-accelerated Computer Vision »