[BLOG] The use of FPGA programmable logic circuits in industrial machine vision applications | Plastika Skaza d.o.o.

[BLOG] The use of FPGA programmable logic circuits in industrial machine vision applications


Global competition is becoming increasingly stricter, which presents an additional challenge not only to service providers, but especially to all manufacturers of various products and product brands, including the Skaza company. Only those who are among the leaders in productivity and cost management are successful in the market. The machine vision plays a key role here, as it is a technology that provides solutions to many challenges in the future. The machine vision technology brings a number of positive effects to industrial production. Improved quality, greater reliability, greater security and cost-effectiveness are added values that are of key importance.
*FPGA and their use in the machine vision systems
The use of FPGA is logical in developing solutions that require very high-speed data processing. The purpose of the research conducted at Skaza was to demonstrate time efficiency of using programmable logic gates in machine vision systems. The comparison of time efficiency of implementation of the developed algorithm on a classical processor (Eng. Central Processing Unit – CPU) and on the FPGA shall be presented at the end.
What are FPGA logic gates? It is a programmable logic gate array that can be reprogrammed. Their special feature is that the programme or logic does not run on an operating system, as it does on personal computers, but the logic is realised on the circuit. The main advantage of programmable logic circuits as compared to classical processors (Eng. Central Processing Unit – CPU), is the capability of parallel execution of the programme, which is also its main advantage over other processors.
Many machine vision algorithms are inherently parallel, therefore they are very suitable for implementation on FPGA logic circuits. These are algorithms that include operations on picture elements (pixels), lines and regions. Virtually the only disadvantage that the FPGA has is the ability to implement low-level machine vision algorithms only. For high-level algorithms we must use a processor, like the one that we have on personal computers. Here we realise that the FPGA is very fast, but we can only use it for low-level algorithms. Therefore, connecting the FPGA and the ordinary processor is almost necessary.
Three ways to integrate FPGA into machine vision systems
We can integrate FPGA into machine vision systems in three ways, namely:

- that the entire processing takes place on the FPGA,
- that the FPGA is used for pre-processing, and
- The FPGA is used for co-processing.

In machine vision systems where only an FPGA is used, and the CPU is not required, the time of image processing is significantly reduced. Thus, the time between the capture of the image and the results of the analysis is considerably shorter. In this case, the FPGA takes over all of the image processing and simultaneously generates an output signal and captures the input signals. Such a method of use is suitable for high-speed applications, such as sorting, quick regulation, and the like. The disadvantage of such an approach is limitation by the implementation of algorithms, because only algorithms at a low level can be performed on the FPGA.
In the second case, the FPGA performs pre-processing, while more advanced algorithms are implemented on the CPU. In such a system, low level processing of captured images is performed on the FPGA. The pre-processed image is then sent to the CPU where higher level algorithms are performed. The operation of such a system is still high-speed, because most of the processing is performed on the FGPA, and the CPU only assumes the implementation of higher level algorithms.
In the development of some solutions, the image processing consists of several steps. Some steps can be implemented on the FPGA, whereas other steps are more suitable for the CPU. In such cases, we capture the image with the CPU and send it to the FPGA where it is processed. Then it is sent back to the CPU for further processing. The co-processing by using the FPGA reduces processing time by reducing the number of functions that are performed on the CPU.
For testing, we used an example of detection of a single transparent polymer granule on the captured image and to determine its position. The image processing consists of four steps of image processing, namely:
  • by using a mask we determine the field, on which we shall search for particles,
  • we use the threshold method in order to obtain a binary image,
  • followed by two morphological operators to improve the image,
  • in the last step, we perform a particle analysis, in which we obtain a field of data on a single particle in the image.
Six times higher speed of machine vision algorithms on the FPGA
In machine vision systems it is necessary to process large quantities of data that represent camera captured images, while at the same time, in the industrial environment the need for the fastest possible functioning of such systems is almost always present. The implementation of the developed machine vision system to the classical processor and to the programmable logic gates, and testing of the system’s performance showed that the processing speed of machine vision algorithms on the FPGA is six times higher than on a high-performance classical processor. Therefore, the use of FPGA programmable logic gates is an effective solution in industrial machine vision applications, where there is a need for high-speed processing that cannot be achieved by classical processors.

Tadej Peršak, Researcher at the Skaza company
Eng. Field Programmable Gate Array – programmable logic gate