MVTec’s HALCON Software Reliably Checks Bottle Cap Imprints

by | May 10, 2024

MVTec_Success Story_K&S_Image 1_©K&S

Machine vision offers enormous advantages for many areas of application, such as quality assurance. In addition to high accuracy and speed, high flexibility and availability are also important for practical use. K&S Anlagenbau GmbH has implemented such an application for the beverage industry with the help of the consulting company Computer Vision Solutions. In this application, the machine vision software MVTec HALCON is used.

The production of bottles and bottle caps in the beverage industry is highly automated. The reason is simple: large quantities have to be produced quickly and reliably. It is important that the processes keep pace with the speed but also with the quality requirements. “Our aim is to make automated processes as safe and reliable as possible.

This is the lever for being able to operate a process at high speed in the long term. Our approach is to take the hectic out of production processes. To do this, we rely on standardized tools that allow us to manufacture reproducible products reliably and quickly. Based on machine vision, we have developed a solution for inspecting porcelain bottle caps,” says Thomas Kelz, responsible for quality technology at K&S Anlagenbau GmbH.

The company from Lengenwang, Bavaria has been developing automation solutions for the electrical, automotive, medical, and consumer goods industries for over 30 years. The company specializes in standardized modules with the option of individual adaptations. Together with the consulting firm Computer Vision Solutions Consulting & Research, the company has developed an application for the quality inspection of bottle caps for beverage bottles.

This is primarily used to check the print image of the bottle caps. The consulting company was called in by K&S Anlagenbau because the team around Managing Director Dr. Markus Heber has many years of experience in the implementation of sophisticated applications that are implemented with machine vision technologies.

Maximum flexibility with a minimum of machine stops

The challenge in developing the new solution was to implement a quality control system that quickly and reliably detects faults in a fully automated process, but is also low-maintenance. Low maintenance means that the system can quickly and easily be switched to other product types and delivers reliable results. “Automation only brings decisive added value, if the customer has little effort in maintaining the system,” says Dr. Heber. In the newly developed system, quality control is carried out inline. To do this, the camera takes a picture of the bottle cap to be checked. The image of the imprint on the top of the cap is then checked using the algorithms of the machine vision software MVTec HALCON.

The challenge with print image control is the variability of the print images on the one hand and the requirement to create a clear operating concept for the system operator on the other hand. Possible print image errors could be, for example, incorrect or out-of-focus colors or imprints that are not completely visible. The “central” position of the print image on the bottle cap is also checked and evaluated as a quality criterion. “One of the major challenges during implementation was that the number of different-looking print images is theoretically infinite. This applies to both the good, i.e., “OK” prints, and the faulty, i.e., “NOK” prints. Our task was therefore to ensure that the software was trained in advance to make the right decision at all times and for different prints,” explains Dr. Heber. For training, the image of an OK print, also known as a “golden sample”, is saved in HALCON. This “good image” serves as a template against which each image is compared during the inspection process. Various parameters in HALCON can be used to set the degree to which deviations from the “golden sample” are still considered OK.

Simple system control via graphical user interface

An important component of the system is the graphical user interface (GUI). The GUI is the operating unit with which, on the one hand, the entire system can be visually displayed and overviewed and, on the other hand, changes and configurations of the process can be made.

The requirement for the GUI was that it can display several different apps dynamically. The apps should also be able to be controlled both via the GUI and the PLC. In the finished system, the setting options now include various display options and configuration modes, as well as different user levels. This means that it is possible to assign rights and thus determine which employees are allowed to carry out which activities. Troubleshooting or adjustments can also be made via the GUI. One adjustment, for example, is to simply change the test program, e.g., if a different print needs to be tested.

One of the core components of the system is HALCON from MVTec. HALCON is a machine vision library that is integrated into the K&S Control software using HDevEngine. “I have been working with HALCON for over ten years. It is the industry standard in the field of image processing software and, with its large library, it is not limited to just a few algorithms,” explains Dr. Heber. HDevEngine acts as an interpreter designed to dynamically load and execute the machine vision algorithms. HDevEngine also enables changes to the machine vision processes on the fly without having to recompile or recertify the entire application. HDevEngine acts as the image processing backend and communicates with the GUI in the background. System operators have little or no contact with it. This is because they operate the system via the GUI they are familiar with.

Sophisticated combination of several machine vision methods ensures robust detection rates

In addition to flexibility and stability in operation, it was of course also important for K&S Anlagenbau to guarantee robustness and high detection rates. This is also ensured by the machine vision software HALCON. This not only includes HDevEngine, but also many image processing methods that are used to check the print images. In total, the HALCON library contains more than 2,100 different operators. Matching technologies, classification, and blob analysis are used in the specific application. The three technologies interact as follows: after the image has been captured by a camera, shape-based matching is used first. This technology is responsible for localizing the print in the image in the first place. The pre-trained print image is matched with the scanned image, allowing the position and alignment to be determined with sub-pixel accuracy and almost in real time. This works even if the print is rotated, scaled, perspectively distorted, partially covered or outside the image or subject to non-linear lighting fluctuations. Once the print has been found, the next task is classification. Here, too, it is important that the class features have been defined and trained beforehand. Classification can be used for various tasks. For example, to segment areas in images or to find objects. In the K&S Anlagenbau plant, classification is used for quality control. Possible errors include color deviations, missing edges, incorrect edges, or structures. Corresponding deviations are segmented and analyzed using blob analysis. For this purpose, features are extracted from connected pixels with similar brightness, the blobs. In this specific case, errors and deviations of a previously defined size are recognized as such.

If the machine vision technologies described find an error, this is displayed in the GUI. The corresponding area is detected by the blob analysis and highlighted in color. This also allows users to recognize the nature of the defect. If the imprint is “OK”, the bottle cap is processed further.

“However, the scope of the machine vision software goes beyond inspecting the print. To ensure that the process is as automated as possible, we have embedded the software in the entire system in such a way that it can communicate with other components. If a bottle cap is not printed correctly, HALCON informs the system accordingly and the component is automatically ejected,” Dr. Heber explains. To communicate easily with other components, HALCON is equipped with interfaces to OPC-UA and PROFINET. The communication protocols enable consistent data exchange between the various components within the system. In this way, full automation can be achieved.

System fulfills requirements in use

The system is already being used by customers. “The feedback we have received from the customer has been very positive. The system runs flawlessly as required and can be operated highly autonomously,” says Dr. Heber. Specifically, the system can test 120 bottle caps per minute. As a result of the successful implementation, Dr. Heber is also working with K&S on new machine vision or 3D vision topics of this inspection application. The special feature is that each system is customized and adapted to the customer’s requirements – just in line with K&S’s claim to be a special machine manufacturer.

Related articles

Trending Articles

Join our mailing list

Subscribe to our mailing list to receive regular updates!