INDEX (English version)
Abstract (English version)
Introduction
CHAPTER. 1: Materials and Methods
1.1 MATLAB 2020b
1.2 Visual Studio 2019
1.3 MATLAB 5.1
1.4 Souce code, static libraries, executables
1.5 License and repository
1.6 Library C++ OpenCV 4.5.1
1.7 Structures for the MATLAB Coder
1.8 From cv::Mat to coder::array and vice versa
CHAPTER. 2: Example-A from MATLAB to C: function add double
2.1 Static library DummyFunction2doubles.lib
2.2 Source code DummyFunction2doubles.c
2.3 Executable DummyFunction2doubles.exe
CHAPTER. 3: Example-B from MATLAB to C: function image (easy) processing
3.1 Static library DummyFunctionImage.lib
3.2 Source code DummyFunctionImage.cpp
3.3 Executable DummyFunctionImage.exe
CHAPTER. 4: Example-B from MATLAB to C: function image (complex) processing
4.1: Static library ComplexFunctionImage.lib
4.2 Source code ComplexFunctionImage.cpp
3.3 Executable ComplexFunctionImage.exe
CHAPTER. 5: Conclusions
SYNOPSIS
INDICE (versione Italiana)
Abstract (versione Italiana)
Introduzione
CAP. 1: Materiali e Metodi
1.1 MATLAB 2020b
1.2 Visual Studio 2019
1.3 MATLAB 5.1
1.4 Codice sorgente, librerie statiche, file eseguibili
1.5 Licenza e repository file
1.6 Libreria C++ OpenCV 4.5.1
1.7 Strutture dati MATLAB Coder
1.8 Da cv::Mat a coder::array e viceversa
CAP. 2: Esempio-1 da MATLAB a C: funzione somma double
2.1 Generazione libreria statica DummyFunction2doubles.lib
2.2 Generazione codice sorgente DummyFunction2doubles.c
2.3 Generazione file eseguibile DummyFunction2doubles.exe
CAP. 3: Esempio-2 da MATLAB a C: funzione processing semplice immagine
3.1 Generazione libreria statica DummyFunctionImage.lib
3.2 Generazione codice sorgente DummyFunctionImage.cpp
3.3 Generazione file eseguibile DummyFunctionImage.exe
CAP. 4: Esempio-3 da MATLAB a C: funzione processing complesso immagine
4.1: Generazione libreria statica ComplexFunctionImage.lib
4.2 Generazione codice sorgente ComplexFunctionImage.cpp
3.3 Generazione file eseguibile ComplexFunctionImage.exe
CAP. 5: Conclusioni
SINOSSI
English and Italian Book
Guide for Dummies: from MATLAB to C++ through the MATLAB Coder
Guida per Dummies:
da MATLAB a C++
attraverso il MATLAB Coder
F. Piccinini, S. Belloni
Edition 2021
Titolo | Guide for Dummies: from MATLAB to C++ through the MATLAB Coder
Autore | Filippo Piccinini Sofia Belloni
ISBN | 979-12-20342-12-4
2021 - Tutti i diritti riservati allAutore
Questa opera pubblicata direttamente dall'Autore tramite la piattaforma di selfpublishing Youcanprint e l'Autore detiene ogni diritto della stessa in maniera esclusiva. Nessuna parte di questo libro pu essere pertanto riprodotta senza il preventivo assenso dell'Autore.
Youcanprint
Via Marco Biagi - 73100 Lecce
www.youcanprint.it
info@youcanprint.it
Abstract (English version)
Nowadays, many of the tools and applications used in the biomedical field are developed in MATLAB (The MathWorks, Inc., MA, USA). However, C++ code is more versatile and, since it is licence-free, it suites better with the policy of code distributed in the form of Open Source.
Having user-friendly tutorials to quickly convert MATLAB code into C++ code is a hot topic for applications in several fields. To facilitate the conversion from MATLAB to C/C++, the MATLAB developers have recently created a toolbox called MATLAB Coder toolbox containing functions and tools to facilitate a (semi-)automatic code conversion.
In this book, using significant examples of increasing complexity, we have described how to exploit the MATLAB Coder to create static .lib libraries, .exe executables and .cpp source code starting from MATLAB .m functions. In particular, starting from some case studies based on simple functions able to manage numerical inputs, we have shown how to manage various parameters of the MATLAB Coder toolbox, in order to be able to convert even complex functions based on image processing algorithms.
Currently, in the literature there are no many manuals designed to guide step-by-step people interested in using the MATLAB Coder. We therefore hope that this document will be a valid help for developers interested in easily and quickly converting MATLAB code to C++ code.
Abstract (versione Italiana)
Al giorno doggi, molti dei tools ed applicativi utilizzati in campo biomedicale sono sviluppati in linguaggio MATLAB (The MathWorks, Inc., MA, USA). Tuttavia, il codice C++ risulta essere pi versatile e, non essendo collegato a licenze di utilizzo, meglio si adatta alla politica di codice distribuito in forma di Open Source.
Poter disporre di protocolli user friedly per convertire in breve tempo codice MATLAB in codice C++ un hot topic per applicazioni in vari settori. Per facilitare il passaggio dal linguaggio MATLAB al linguaggio C/C++, gli sviluppatori MATLAB hanno recentemente realizzato un toolbox chiamato MATLAB Coder contenente varie funzioni e strumenti per facilitare la conversione (semi-)automatica del codice.
In questo libro, utilizzando esempi significativi di complessit crescente, mostriamo come sfruttare il MATLAB Coder per realizzare librerie statiche .lib, eseguibili .exe e codice sorgente .cpp partendo da codice MATLAB .m. In particolare, partendo da casi di studio basati su funzioni semplici in grado di gestire input numerici, abbiamo mostrato come sfruttare i vari parametri del toolbox MATLAB Coder, per riuscire poi a convertire funzioni anche complesse basate su algoritmi di analisi di immagini.
Attualmente in letteratura non sono presenti molti manuali create per guidare passo-passo possibili interessati nellutilizzo del MATLAB Coder. Speriamo quindi che questo documento possa essere un valido aiuto per gli sviluppatori interessati a convertire in maniera facile e veloce codice MATLAB in codice C++.
Introduction
Nowadays, MATLAB is one of the most popular programming environments, especially among engineers and researchers working in the health field. In particular, MATLAB represents a powerful programming language optimized for mathematical computation based on multidimensional matrices. Thanks to these characteristics, it is one of the most common languages in the biomedical world where it is used for the development of several tools and applications, especially in prototype form. However, it is not a licence-free environment and the need to have a license to use MATLAB represents a limit for the dissemination and use in the community of the developed code.
On the other hand, C++ is an open source-code that does not require any license for development and distribution. For this reason it is widely spread in the community although it requires greater programming skills in the code development stage. Being able to quickly and easily convert MATLAB code into C++ code may therefore be very interesting for applications in many fields, considering that C and C++ are among the most popular open source programming languages used in the industry. However, since MATLAB and C++ are two syntactically and conceptually very different languages, a possible step-by-step manual conversion of the MATLAB algorithm would present various problems related first of all to the introduction of potential errors during the conversion process, which moreover would be also a very time-consuming task. Furthermore, it will be necessary to maintain two separate implementations of the algorithm not automatically synchronized with each other.