Matlab codegen for the Image Processing Toolbox

5 visualizaciones (últimos 30 días)
RuiQi
RuiQi el 28 de Mzo. de 2017
Comentada: RuiQi el 29 de Mzo. de 2017
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 comentario
RuiQi
RuiQi el 29 de Mzo. de 2017
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

Iniciar sesión para comentar.

Respuesta aceptada

Steven Lord
Steven Lord el 28 de Mzo. de 2017
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 comentarios
RuiQi
RuiQi el 28 de Mzo. de 2017
Editada: RuiQi el 28 de Mzo. de 2017
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 el 29 de Mzo. de 2017
Do I need the latest version of matlab ? i am using the R2014b

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Generating Code en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by