Matlab codegen for the Image Processing Toolbox

4 次查看(过去 30 天)
I was reading about code generation and I came across these 2 pages and was wondering if there is any difference between the two.
Are they both the same ? That the codegen app just makes it easier to use ? Or does the codegen app only work for Image Processing functions ?
Lastly, I am intending to generate a c++ lib for the watershed function so I was wondering if there is any options that I need to pay attention to if I want the code to run as fast as possible. I will only be passing in image as input to the code.
  1 个评论
RuiQi
RuiQi 2017-3-29
Okay I realized that watershed is only available for codegen for Matlab version R2015a onwards. I am using R2014b.
https://www.mathworks.com/help/coder/release-notes.html

请先登录,再进行评论。

采纳的回答

Steven Lord
Steven Lord 2017-3-28
The first page is in the documentation for MATLAB Coder and discusses how to generate C/C++ code from MATLAB code in general, listing the various options that are available. The examples on that page are small and assume you have already set up your system to generate code.
The second page is in the documentation for Image Processing Toolbox and shows how to generate code from a function that uses Image Processing Toolbox functionality. It shows one example that goes through the whole workflow, from setup to the final generated code.
The documentation for the watershed function does indicate it is supported for code generation, but it also lists some usage notes and limitations at the end of the page.
  2 个评论
RuiQi
RuiQi 2017-3-28
编辑:RuiQi 2017-3-28
Thanks steven ! Im having an issue with generating the c++ static library for watershed. I have followed the instructions below:
Usage notes and limitations:
bwconncomp only supports 2-D inputs.
The conn arguments must be a compile-time constant and the only connectivities supported are 4 or 8. You can also specify connectivity as a 3-by-3 matrix, but it can only be [0 1 0;1 1 1;0 1 0] or ones(3)
The PixelIdxList field in the CC struct return value is not supported.
Codegen now tells me that I have an unsupported matlab function call which is bwconncomp. Should I be using bwlabel instead because based on the page https://www.mathworks.com/help/images/ref/bwconncomp.html bwlabel is the only function that can only support 4 or 8 connectivity which was stated in the notes.
function L = watershed(A) %#codegen
conn = [0 1 0;1 1 1;0 1 0];
cc = bwconncomp(imregionalmin(A, conn), conn);
L = watershed_meyer(A,conn,cc);
RuiQi
RuiQi 2017-3-29
Do I need the latest version of matlab ? i am using the R2014b

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Generating Code 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by