Implementing obstacle detection system by hybrid programming of Matlab and VC++

Publisher:SparklingMoonLatest update time:2011-11-27 Keywords:Matlab Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This paper mainly studies the obstacle detection problem of mobile robots in unknown environments, and proposes a software implementation method for obstacle detection system based on Matlab and VC++ hybrid programming. This method integrates the numerical calculation function of MATLAB, with powerful graphics and image processing functions and the visualization, fast execution speed, easy maintenance and upgrade of VC++. The experimental results show that this detection method can greatly improve the programming efficiency and shorten the software development cycle in the development process of obstacle detection system.

introduction

At present, many researchers have applied visual navigation to the mobile control of mobile robots. However, due to the large amount of image processing data and complex algorithms, there are shortcomings in specific applications, such as poor real-time performance, insufficient robustness of the road area detection algorithm, and only suitable for the specific road model of the algorithm. In order to improve the real-time performance of mobile robots in detecting obstacles, this paper proposes a software implementation method of obstacle detection system based on Matlab and VC hybrid programming, which can greatly improve the efficiency of programming, shorten the software development cycle, and can detect obstacles quickly and accurately.

1 VC++ and Matlab mixed programming method

Matlab is a high-level technical computing language and interactive environment for algorithm development, data analysis and numerical calculation launched by MatlaWorks in the United States. It has powerful functions in matrix operations, numerical calculations and graphic display, and is very intuitive and concise. It provides corresponding toolboxes for various engineering computing fields and has been widely used in various industries such as control, biomedical engineering, speech processing, digital signal processing, radar engineering, signal analysis, computer technology, etc. However, compared with other high-level programming languages, its program execution speed is slower, and the disclosure of its source code is not conducive to the confidentiality of algorithms and data.

Visual C++ is an object-oriented high-level programming language launched by Microsoft. It integrates a variety of visual programming tools such as powerful compilers, connectors, debuggers, AppWizard, etc. It runs in a compiled manner and has a fast running speed, especially a strong ability to write interfaces. However, it is far inferior to Matlab language in digital processing analysis, algorithm tools, programming efficiency, and accurate and convenient drawing of data images.

There are five common methods for combining Matlab and VC++:

①Matlab engine.

② Use Matcom to compile Matlab's M file into C language file and embed it into VC++.

③ Use the function library provided by Matlab or the C++ interface function library to program directly in VC.

④ Use the MCC command provided by Matlab to generate a package file based on C language or C++ language corresponding to the Matlab file, and then embed it into VC.

⑤ Apply assembly technology to realize Matlab and VC hybrid programming.

This study conducted research and experiments on five methods. The last four methods only partially support Matlab's image processing toolbox, while the Matlab engine has full-function calling capabilities for Matlab, including support for digital image and communication object processing. Therefore, this paper selects the Matlab engine to implement the obstacle detection system development platform based on VC++ and Matlab.

2 Design and implementation of obstacle detection system

2.1 Setting up the Matlab and VC interface compilation environment

In the integrated environment of VC, if you want to achieve communication with the Matlab engine, you need to make some settings for the VC compilation environment, such as adding Matlab header files to the VC project, adding Matlab library files, etc.

2.2 Setting and program implementation of calling Matlab engine in VC

To use Matlab engine for image processing in VC, you first need to make some basic definitions in the program. For example, in the cpp file that uses the Matlab engine class, you need to first add the statements #inclu-de "engine.h" and #include "matrix.h". You need to use Engine*m_ep to define the Matlab engine, and use the m_ep=engOpen(NULL) statement to start the Matlab engine; finally, you need to use the engClose(m_ep) statement to close the Matlab engine.

The obstacle detection system studied in this paper mainly uses binocular stereo vision to detect the position and distance of obstacles, and controls the dual cameras of the mobile robot to collect image pairs, and then performs a series of image processing. Its software design adopts modular development ideas, mainly including image acquisition module, edge feature extraction module, Otsu image segmentation module, camera calibration module, stereo matching module and 3D reconstruction module. The main interface of the obstacle detection system is shown in Figure 1.

Obstacle detection system main interface
The source code of the image Otsu segmentation Matlab image processing part is:

3. Detection process and results of obstacle detection system

Figures 2 to 5 show the processing of the obstacle detection system, which includes the acquisition of real-time images, image preprocessing, obstacle feature extraction, feature point matching, and finally calculating the position coordinates of the obstacle through the parallax method, thereby providing the necessary information for decision control. Table 1 shows the coordinates of some points in the detected obstacles.

4 Conclusion

In actual scientific research, it saves the trouble of writing some complicated and tedious image algorithm codes, and can provide convenience for engineering technicians who are familiar with VC language to develop practical image processing algorithm research; using Matlab engine can simply and effectively realize the function of calling Matlab in VC, thus improving efficiency and shortening the software development cycle.

Keywords:Matlab Reference address:Implementing obstacle detection system by hybrid programming of Matlab and VC++

Previous article:Design Considerations for Transconductance Amplifiers
Next article:Maintenance of Digital Multimeter Calibrator

Recommended ReadingLatest update time:2024-11-16 19:37

Yongtai Technology: VC project is planned to be put into production in August-September, in cooperation with CATL
Recently, Yongtai Technology said in an institutional survey that the VC project capacity release plan is in preparation for trial production and is scheduled to be put into production in August-September. Under the current tight supply and demand situation, VC products will selectively support the purchasing needs of
[Mobile phone portable]
Design of isolated inverter source based on Matlab
  Based on the Matlab software platform, the inverter source designed with a dual-loop control strategy is modeled and simulated using the Matlab-Simulink-SimPowerSystems toolbox to verify the feasibility and effectiveness of the scheme designed in this paper.   introduction   With the development of renewable energ
[Power Management]
Design of isolated inverter source based on Matlab
Obtain the phase difference between the two columns of signals based on the waveform data stored in the oscilloscope (MATLAB source code)
Purpose The waveform displayed by the oscilloscope is as follows, and the phase difference between the two columns of signals needs to be obtained through MATLAB processing. step Insert the USB flash drive into the oscilloscope and store the signal sequence. Read this .CSV signal sequence file in MATLAB and process
[Test Measurement]
Obtain the phase difference between the two columns of signals based on the waveform data stored in the oscilloscope (MATLAB source code)
Trajectory planning simulation of articulated six-axis robotic arm based on MATLAB
1. Purpose of the experiment Based on the theoretical knowledge, the mathematical model of the articulated robot is established using the standard DH parameter method, and the Robocs Toolbox toolkit is used to build the model. Tip: Experimental tools: Matlab R2021a (many metaphysical problems are due t
[robot]
Interface Design between TMS320VC5402 and TLC320AD50C
The high-speed digital signal processor (DSP) currently developed has been widely used in speech processing systems. TMS320VC5402 is a 16-bit fixed-point DSP produced by TI with relatively high performance and price. Its instruction cycle is 10ns, and it has the characteristics of fast operation speed, general perfo
[Embedded]
Design of Isolated Inverter Power Supply Based on Matlab
Based on the Matlab software platform, the inverter source designed with a dual-loop control strategy is modeled and simulated using the Matlab-Simulink-SimPowerSystems toolbox, verifying the feasibility and effectiveness of the scheme designed in this paper. 0 Introduction With the development of renewable energy s
[Power Management]
Design of Isolated Inverter Power Supply Based on Matlab
Serial communication record between matlab and stm32
1. Functions involved serial,fopen,fclose, instrfindall,instrhwinfo, fprintf,fscanf,fwrite,fread,isempty 1.1 Serial port function scom = serial('com6','BaudRate',115200,'BytesAvailableFcnMode','byte');  fopen(scom);  . fclose(scom); Or set the serial port properties separately as follows: scom = serial(com);
[Microcontroller]
Research on the method of online flash programming and bootstrap startup of TMS320VC5509
Abstract: In order to solve the problem of preserving the program code of the TMS320VC55X series DSP system, a method is designed to use the JTAG interface to burn Flash online and realize bootstrap startup. This online programming method uses the parallel external memory loader (EMIF) interface to connect the
[Embedded]
Research on the method of online flash programming and bootstrap startup of TMS320VC5509
Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号