Matlab codegen for the Image Processing Toolbox

조회 수: 3 (최근 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 CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by