How do I deploy "computer vision toolbox interface for opencv in matlab" support-packages in my microservice(docker image)

6 次查看(过去 30 天)
I am using matlab r2024b update 4 on win11
I am following the doc under compiler-sdk/microservice chapter, and successfully run all the tutorials.
Now I want to package my own function as a microservice container. However, my function relies on "computer vision toolbox interface for opencv in matlab" support pacakges. I know I can use the "SupportPacakges" option when calling the function "compiler.build.productionServerArchive", and I can use compiler.codetools.deployableSupportPackages to show the support pacakges that I can include in the archive. But after I run the command compiler.codetools.deployableSupportPackages in the command window, "computer vision toolbox interface for opencv in matlab" is not among them.
I even tried to use the mpm tool to install this package, through the 'AdditionalInstructions' of the compiler.package.microserviceDockerImage function. However, when I called my micro-service, I saw through the trace that the matlab runtime complains that opencvInterface.so is not on matlab path. Then I addpath in my function, tried to add the path of the parent folder of this .so file, but the trace said it's forbidden to addpath(change the search path) inside matlab runtime.
Below I also attach my packaging live script.

回答(1 个)

Jacob Mathew
Jacob Mathew 2025-6-10
Hey zzm oliver,
I tried to replicate the problem and installed the Computer Vision Toolbox Interface for OpenCV in MATLAB, which requires the Computer Vision Toolbox which in turn requires the Image Processing Toolbox. Additionally, I have other toolboxes installed as well, which can be listed using the ver command:
However, even though the toolboxes show up as installed under the ver command's output, there is a different command to list the toolboxes that are available to be deployed - compiler.codetools.deployableSupportPackages. It can either be used with no arguments, in which case it will list all the toolboxes you have installed that can be deployed or file names (in this case I passed the packaging live script) can be passed as arguments in which case it will list the toolboxes that are installed and can be deployed and are required by the files. You can read more regarding this at the documentation link below:
Crucially, when I used this command, it did NOT list Computer Vision Toolbox Interface for OpenCV in MATLAB. This means that unfortunately it will not be possible to create a microservice Docker image using MATLAB Compiler while having the toolbox.
A workaround would be to try and create a standalone MATLAB instance using MATLAB Docker Image and then install necessary Support Packages and Toolboxes within it. You can refer to the following GitHub page for the official Docker Image and follow the Readme:

类别

Help CenterFile Exchange 中查找有关 Code Generation, GPU, and Third-Party Support 的更多信息

产品


版本

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by