主要内容

Portable C Code Generation for Functions That Use OpenCV Library

You can generate portable C code for Computer Vision Toolbox™ functions that use the OpenCV library. The generated code calls OpenCV APIs and therefore requires compatible OpenCV header files and libraries during compilation and linking.

The flowchart illustrates the workflow for generating code that uses the OpenCV library.

Flowchart showing OpenCV code generation workflow. For MATLAB host targets, generated code uses OpenCV libraries provided using PackNGo. For non-host targets, users need to supply OpenCV libraries built for the target hardware and toolchain.

  • For MATLAB® host platforms, the generated code uses the OpenCV libraries provided through packNGo (MATLAB Coder). Your compiler must be compatible with the compiler used to build these libraries.

    The following compilers are used to build the OpenCV libraries for MATLAB host:

    Operating System Compatible Compiler
    Windows® 64 bitMicrosoft® Visual Studio® 2015 or later (Professional or Community editions)
    Linux® 64 bitgcc-4.9.3 (g++)
    Mac 64 bitXcode 6.2.0 (Clang++)

  • For non-host targets, you must provide OpenCV libraries that are compatible with the target platform and compiler. These libraries must match the target hardware architecture and toolchain for successful compilation and linking.

See Also