Current location - Training Enrollment Network - Education and training - How to use vb, vc and? Net?
How to use vb, vc and? Net?
HALCON is no stranger to machine vision learners and developers, and it is understandable to call it the first software in the field of machine vision.

HALCON can realize the control of vision system, image processing and analysis, especially various image processing algorithms. But in itself, developing user interface is not ideal. User interface and other bottom control, such as control and communication with bottom circuit board and PLC, can be developed with VC++, VB, etc. Conveniently, HALCON can be called by these development tools, and it supports C, C++, VB, JAVA and so on.

When I first started learning and developing with VC++ and HALCON, I was at a loss about how to call HALCON in VC++ because of the weakness of the software. I also found some information on the internet, which is less and the basic content is similar. It may still be used, but it is not very brilliant for the author. Later, under the guidance of a software colleague, I got a deeper understanding of it. In fact, in the final analysis, it is a very simple thing for software engineers to import the library of HALCON into VC++.

The following is a step-by-step introduction for beginners, using MFC as a development tool.

Choose MFC under Visual C++ for the new project in Visual Studio, and the process of establishing MFC application will not be described in detail. This paper takes Visual Studio 2005 as an example.

Open the installation directory of HALCON (taking HALCON7.0 as an example, the later version is the same), as shown in the following figure 1:

Copy the entire include folder to the working directory of the MFC project, as shown in Figure 2 below:

Similarly, copy the LIB file of HALCON to the working directory of the MFC project. Because it was developed by C++, we chose halconcpp.lib under the x: program file smvtechalconlibi586-NT4, where x: is the installation letter.

Open stdafx.h and add it in the blank space of the document.

# include " include/CPP/halconcpp . h "

#prama comment (lib, "halconcpp.lib")

Next, click the properties under the project, as shown in Figure 6 below:

Click C/C++ in the configuration properties, as shown in Figure 7 below:

When you click the blank box to the right of the attached inclusion directory, the icon that will appear will be opened, as shown in Figure 8 below:

Click New CCB and enter the address of the include folder in the project directory of MFC project, which is the folder we just copied.

The last step is to import the header file of HALCON library where necessary, taking DLG as an example. Take CPP as an example.

In this way, even if we successfully import the HALCON library file in VC++/MFC, we can call the function of HALCON and use its powerful algorithm. In addition, after simply performing the above steps, press F5 to start debugging, and there should be no errors or warnings. This method is also applicable to VB, so I won't go into details here. VB developers can try it themselves.