Matlab codegen for the Image Processing Toolbox

2 ビュー (過去 30 日間)
RuiQi
RuiQi 2017 年 3 月 28 日
コメント済み: RuiQi 2017 年 3 月 29 日
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 Center および File ExchangeMATLAB Coder についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by