| OpenCV 3.4.7 Open Source Computer Vision

Classes | Enumerations | Functions
OpenCL support
Core functionality

## Classes
class | cv::ocl::Context
class | cv::ocl::Device
class | cv::ocl::Image2D
class | cv::ocl::Kernel
class | cv::ocl::KernelArg
class | cv::ocl::Platform
class | cv::ocl::PlatformInfo
class | cv::ocl::Program
class | cv::ocl::ProgramSource
class | cv::ocl::Queue
class | cv::ocl::Timer

## Enumerations
enum | cv::ocl::OclVectorStrategy { cv::ocl::OCL_VECTOR_OWN = 0, cv::ocl::OCL_VECTOR_MAX = 1, cv::ocl::OCL_VECTOR_DEFAULT = OCL_VECTOR_OWN }

## Functions
void | cv::ocl::attachContext (const String &platformName, void *platformID, void *context, void *deviceID)
| Attaches OpenCL context to OpenCV. More...
void | cv::ocl::buildOptionsAddMatrixDescription (String &buildOptions, const String &name, InputArray _m)
int | cv::ocl::checkOptimalVectorWidth (const int *vectorWidths, InputArray src1, InputArray src2=noArray(), InputArray src3=noArray(), InputArray src4=noArray(), InputArray src5=noArray(), InputArray src6=noArray(), InputArray src7=noArray(), InputArray src8=noArray(), InputArray src9=noArray(), OclVectorStrategy strat=OCL_VECTOR_DEFAULT)
void | cv::ocl::convertFromBuffer (void *cl_mem_buffer, size_t step, int rows, int cols, int type, UMat &dst)
| Convert OpenCL buffer to UMat. More...
void | cv::ocl::convertFromImage (void *cl_mem_image, UMat &dst)
| Convert OpenCL image2d_t to UMat. More...
const char * | cv::ocl::convertTypeStr (int sdepth, int ddepth, int cn, char *buf)
void | cv::ocl::finish ()
MatAllocator * | cv::ocl::getOpenCLAllocator ()
const char * | cv::ocl::getOpenCLErrorString (int errorCode)
void | cv::ocl::getPlatfomsInfo (std::vector< PlatformInfo > &platform_info)
bool | cv::ocl::haveAmdBlas ()
bool | cv::ocl::haveAmdFft ()
bool | cv::ocl::haveOpenCL ()
bool | cv::ocl::haveSVM ()
void | cv::ocl::initializeContextFromHandle (Context &ctx, void *platform, void *context, void *device)
String | cv::ocl::kernelToStr (InputArray _kernel, int ddepth=-1, const char *name=NULL)
const char * | cv::ocl::memopTypeToStr (int t)
int | cv::ocl::predictOptimalVectorWidth (InputArray src1, InputArray src2=noArray(), InputArray src3=noArray(), InputArray src4=noArray(), InputArray src5=noArray(), InputArray src6=noArray(), InputArray src7=noArray(), InputArray src8=noArray(), InputArray src9=noArray(), OclVectorStrategy strat=OCL_VECTOR_DEFAULT)
int | cv::ocl::predictOptimalVectorWidthMax (InputArray src1, InputArray src2=noArray(), InputArray src3=noArray(), InputArray src4=noArray(), InputArray src5=noArray(), InputArray src6=noArray(), InputArray src7=noArray(), InputArray src8=noArray(), InputArray src9=noArray())
void | cv::ocl::setUseOpenCL (bool flag)
const char * | cv::ocl::typeToStr (int t)
bool | cv::ocl::useOpenCL ()
const char * | cv::ocl::vecopTypeToStr (int t)

## Detailed Description

## Enumeration Type Documentation

## § OclVectorStrategy

enum cv::ocl::OclVectorStrategy

`#include <opencv2/core/ocl.hpp>`

Enumerator
OCL_VECTOR_OWN Python: cv.ocl.OCL_VECTOR_OWN |
OCL_VECTOR_MAX Python: cv.ocl.OCL_VECTOR_MAX |
OCL_VECTOR_DEFAULT Python: cv.ocl.OCL_VECTOR_DEFAULT |

## Function Documentation

## § attachContext()

void cv::ocl::attachContext | ( | const String & | platformName,
|  | void * | platformID,
|  | void * | context,
|  | void * | deviceID
| ) |  |

`#include <opencv2/core/ocl.hpp>`

Attaches OpenCL context to OpenCV.

Note
  OpenCV will check if available OpenCL platform has platformName name, then assign context to OpenCV and call `clRetainContext` function. The deviceID device will be used as target device and new command queue will be created.

Parameters

  platformName | name of OpenCL platform to attach, this string is used to check if platform is available to OpenCV at runtime
  platformID | ID of platform attached context was created for
  context | OpenCL context to be attached to OpenCV
  deviceID | ID of device, must be created from attached context

## § buildOptionsAddMatrixDescription()

void cv::ocl::buildOptionsAddMatrixDescription | ( | String & | buildOptions,
|  | const String & | name,
|  | InputArray | _m
| ) |  |

`#include <opencv2/core/ocl.hpp>`

## § checkOptimalVectorWidth()

int cv::ocl::checkOptimalVectorWidth | ( | const int * | vectorWidths,
|  | InputArray | src1,
|  | InputArray | src2 = `noArray()`,
|  | InputArray | src3 = `noArray()`,
|  | InputArray | src4 = `noArray()`,
|  | InputArray | src5 = `noArray()`,
|  | InputArray | src6 = `noArray()`,
|  | InputArray | src7 = `noArray()`,
|  | InputArray | src8 = `noArray()`,
|  | InputArray | src9 = `noArray()`,
|  | OclVectorStrategy | strat = `OCL_VECTOR_DEFAULT`
| ) |  |

`#include <opencv2/core/ocl.hpp>`

## § convertFromBuffer()

void cv::ocl::convertFromBuffer | ( | void * | cl_mem_buffer,
|  | size_t | step,
|  | int | rows,
|  | int | cols,
|  | int | type,
|  | UMat & | dst
| ) |  |

`#include <opencv2/core/ocl.hpp>`

Convert OpenCL buffer to UMat.

Note
  OpenCL buffer (cl_mem_buffer) should contain 2D image data, compatible with OpenCV. Memory content is not copied from `clBuffer` to UMat. Instead, buffer handle assigned to UMat and `clRetainMemObject` is called.

Parameters

  cl_mem_buffer | source clBuffer handle
  step | num of bytes in single row
  rows | number of rows
  cols | number of cols
  type | OpenCV type of image
  dst | destination UMat

## § convertFromImage()

void cv::ocl::convertFromImage | ( | void * | cl_mem_image,
|  | UMat & | dst
| ) |  |

`#include <opencv2/core/ocl.hpp>`

Convert OpenCL image2d_t to UMat.

Note
  OpenCL `image2d_t` (cl_mem_image), should be compatible with OpenCV UMat formats. Memory content is copied from image to UMat with `clEnqueueCopyImageToBuffer` function.

Parameters

  cl_mem_image | source image2d_t handle
  dst | destination UMat

## § convertTypeStr()

const char* cv::ocl::convertTypeStr | ( | int | sdepth,
|  | int | ddepth,
|  | int | cn,
|  | char * | buf
| ) |  |

`#include <opencv2/core/ocl.hpp>`

## § finish()

void cv::ocl::finish | ( |  | ) |

Python:
| None | = | cv.ocl.finish( |  | )

`#include <opencv2/core/ocl.hpp>`

## § getOpenCLAllocator()

MatAllocator* cv::ocl::getOpenCLAllocator | ( |  | ) |

`#include <opencv2/core/ocl.hpp>`

## § getOpenCLErrorString()

const char* cv::ocl::getOpenCLErrorString | ( | int | errorCode | ) |

`#include <opencv2/core/ocl.hpp>`

## § getPlatfomsInfo()

void cv::ocl::getPlatfomsInfo | ( | std::vector< PlatformInfo > & | platform_info | ) |

`#include <opencv2/core/ocl.hpp>`

## § haveAmdBlas()

bool cv::ocl::haveAmdBlas | ( |  | ) |

Python:
| retval | = | cv.ocl.haveAmdBlas( |  | )

`#include <opencv2/core/ocl.hpp>`

## § haveAmdFft()

bool cv::ocl::haveAmdFft | ( |  | ) |

Python:
| retval | = | cv.ocl.haveAmdFft( |  | )

`#include <opencv2/core/ocl.hpp>`

## § haveOpenCL()

bool cv::ocl::haveOpenCL | ( |  | ) |

Python:
| retval | = | cv.ocl.haveOpenCL( |  | )

`#include <opencv2/core/ocl.hpp>`

## § haveSVM()

bool cv::ocl::haveSVM | ( |  | ) |

`#include <opencv2/core/ocl.hpp>`

## § initializeContextFromHandle()

void cv::ocl::initializeContextFromHandle | ( | Context & | ctx,
|  | void * | platform,
|  | void * | context,
|  | void * | device
| ) |  |

`#include <opencv2/core/ocl.hpp>`

## § kernelToStr()

String cv::ocl::kernelToStr | ( | InputArray | _kernel,
|  | int | ddepth = `-1`,
|  | const char * | name = `NULL`
| ) |  |

`#include <opencv2/core/ocl.hpp>`

## § memopTypeToStr()

const char* cv::ocl::memopTypeToStr | ( | int | t | ) |

`#include <opencv2/core/ocl.hpp>`

## § predictOptimalVectorWidth()

int cv::ocl::predictOptimalVectorWidth | ( | InputArray | src1,
|  | InputArray | src2 = `noArray()`,
|  | InputArray | src3 = `noArray()`,
|  | InputArray | src4 = `noArray()`,
|  | InputArray | src5 = `noArray()`,
|  | InputArray | src6 = `noArray()`,
|  | InputArray | src7 = `noArray()`,
|  | InputArray | src8 = `noArray()`,
|  | InputArray | src9 = `noArray()`,
|  | OclVectorStrategy | strat = `OCL_VECTOR_DEFAULT`
| ) |  |

`#include <opencv2/core/ocl.hpp>`

## § predictOptimalVectorWidthMax()

int cv::ocl::predictOptimalVectorWidthMax | ( | InputArray | src1,
|  | InputArray | src2 = `noArray()`,
|  | InputArray | src3 = `noArray()`,
|  | InputArray | src4 = `noArray()`,
|  | InputArray | src5 = `noArray()`,
|  | InputArray | src6 = `noArray()`,
|  | InputArray | src7 = `noArray()`,
|  | InputArray | src8 = `noArray()`,
|  | InputArray | src9 = `noArray()`
| ) |  |

`#include <opencv2/core/ocl.hpp>`

## § setUseOpenCL()

void cv::ocl::setUseOpenCL | ( | bool | flag | ) |

Python:
| None | = | cv.ocl.setUseOpenCL( | flag | )

`#include <opencv2/core/ocl.hpp>`

Examples:
  samples/tapi/hog.cpp, and samples/tapi/squares.cpp.

## § typeToStr()

const char* cv::ocl::typeToStr | ( | int | t | ) |

`#include <opencv2/core/ocl.hpp>`

## § useOpenCL()

bool cv::ocl::useOpenCL | ( |  | ) |

Python:
| retval | = | cv.ocl.useOpenCL( |  | )

`#include <opencv2/core/ocl.hpp>`

Examples:
  samples/dnn/colorization.cpp, and samples/tapi/hog.cpp.

## § vecopTypeToStr()

const char* cv::ocl::vecopTypeToStr | ( | int | t | ) |

`#include <opencv2/core/ocl.hpp>`