Main Content

OpenCV Support

Convert camera parameters, MEX file support, and prebuilt MATLAB®interfaces to OpenCV

TheComputer Vision Toolbox™ Interface for OpenCV in MATLABsupport package provides these functionalities for OpenCV support:

  • MATLAB functions to convert computed camera parameters between MATLAB and OpenCV formats for camera calibration applications.

  • OpenCV Interface C++ API support files for building MEX files that you can use to call OpenCV functions and integrate OpenCV C++ code into MATLAB. The interface does not support graphics processing unit (GPU). You can use the MEX-based approach to integrate a custom OpenCV function with MATLAB. For more information about the MEX-based approach, seeBuild MEX-Files for OpenCV Interface.

  • Prebuilt MATLAB interface to the OpenCV library to directly call OpenCV functions from MATLAB without writing C/C++ code. The support package also provides MATLAB functions to pass data back and forth between OpenCV and MATLAB. However, the prebuilt MATLAB interface to the OpenCV does not provide support for integrating custom OpenCV functions with MATLAB.

To use the MEX-based and the prebuilt MATLAB interface to OpenCV support files, you must first download theComputer Vision Toolbox Interface for OpenCV in MATLABsupport package. For information about how to download the support package, seeInstall and Use Computer Vision Toolbox Interface for OpenCV in MATLAB.

Functions

expand all

cameraIntrinsicsFromOpenCV Convert camera intrinsic parameters from OpenCV toMATLAB
cameraIntrinsicsToOpenCV Convert camera intrinsic parameters fromMATLABto OpenCV
stereoParametersFromOpenCV Convert stereo camera parameters from OpenCV toMATLAB
stereoParametersToOpenCV Convert stereo camera parameters fromMATLABto OpenCV

OpenCV Interface C++ API

ocvCheckFeaturePointsStruct Check thatMATLABstruct represents feature points
ocvStructToKeyPoints ConvertMATLAB特征点struct OpenCVKeyPointvector
ocvKeyPointsToStruct Convert OpenCVKeyPointvector toMATLABstruct
ocvMxArrayToCvRect Convert aMATLABstruct representing a rectangle to an OpenCVCvRect
ocvCvRectToMxArray Convert OpenCVCvRectto aMATLABstruct
ocvCvBox2DToMxArray Convert OpenCVCvBox2Dto aMATLABstruct
ocvCvRectToBoundingBox_{DataType} ConvertvectortoM-by-4mxArrayof bounding boxes
ocvMxArrayToSize_{DataType} Convert 2-elementmxArraytocv::Size.
ocvMxArrayToImage_{DataType} Convert column majormxArray行主要cv::Matfor image
ocvMxArrayToMat_{DataType} Convert column majormxArray行主要cv::Matfor generic matrix
ocvMxArrayFromImage_{DataType} Convert row majorcv::Matto column majormxArrayfor image
ocvMxArrayFromMat_{DataType} Convert row majorcv::Matto column majormxArrayfor generic matrix
ocvMxArrayFromVector_{DataType} Convert numericvectorTtomxArray
ocvMxArrayFromPoints2f ConvertsvectortomxArray

OpenCV Interface C++ API GPU

ocvMxGpuArrayToGpuMat_{DataType} Createcv::gpu::GpuMatfrommxArraycontaining GPU data.
ocvMxGpuArrayFromGpuMat_{DataType} Create anmxArrayfromcv::gpu::GpuMatobject
createMat Create MATLAB interface object for OpenCVMatclass
createUMat Create MATLAB interface object for OpenCVUMatclass
getBasePtr Create MATLAB interface object for OpenCV base class
getImage Read images stored inMATLABinterface object for OpenCV class
keyPointsToStruct Convert OpenCVKeyPointsobject toMATLABstructure
rectToBbox Compute bounding boxes from outputs returned byMATLABinterface object for OpenCVRectclass
visionSupportPackages Start installer to download, install, or uninstallComputer Vision Toolboxdata

Topics