DMC specified machine vision hardware and programmed a custom real-time application to perform high-speed inspection of complex folding cartons. Folding cartons for products like beverage carriers often require many folds, flaps, and complicated glue patterns. The cost of an improperly folded or glued carton can be large, since the cartons are filled with bottles by an automated line. The packaging company is liable for any downtime or broken bottles caused by a bad carton.
Machine Vision Hardware
Since DMC’s customer wanted to package the inspection system and incorporate it into their existing packaging line, keeping hardware costs low was a priority. DMC and the customer created a custom real-time PC from standard components and installed the LabVIEW real-time operating system to run the application. The system has multiple GigE cameras that are each connected to a dedicated network adapter. Encoder and trigger signals from the packaging machine are connected to the inputs on the PCIe-8255R FPGA card. The cameras and lights are controlled by FPGA outputs.
Image Acquisition and Results Tracking
The glue is often applied in two or more stages, requiring multiple inspection stations. Due to machine components that block the view from a single camera, each station has two cameras and there is a total of four cameras connected to one vision controller. Since the cartons could vary in size and length, a line scan camera is used to acquire images of variable size. Line scan cameras also simplify lighting, since only a single line of illumination is needed, instead of a large 2D area. A concentrated line light helps keep exposure times low, allowing for high-speed image acquisition.
Each carton passes a photo eye to trigger the camera(s). The trigger signal and encoder position is tracked by a program running on the FPGA. After the inspection system determines a pass/fail result, the FPGA sends an output signal at a specified position on the line to signal to the packaging system that the current carton is good. Any carton that doesn’t have a pass signal is rejected by the packaging equipment. The timing diagram below illustrates the relative timing between the input trigger signal, image acquisition, pass/fail result determination, and output signal to the system.

User Interface
The customer has an existing Windows application that is used to configure their folding and gluing machines. The customer wanted to seamlessly integrate a user interface developed by DMC without requiring DMC to modify over their existing source code. To accomplish this goal, DMC developed a .NET application that is called by the existing application and covers a portion of the interface while it is active. The .NET application communicates with the LabVIEW real-time application via TCP messages to send configuration information down to the controller and to receive images (with result overlays) for display to the user.
Inspection Algorithm
To verify proper glue application, the vision system checks the position of glue lines. The ideal glue positions and tolerances for each glue line are configurable per product, see the next section. The software creates a “region of interest” for each expected glue line. For each region of interest, the inspection algorithm verifies the following:
- Glue is present
- Glue starts within tolerance
- Glue ends within tolerance
- Glue width is within tolerance
- Gaps in glue (for dot patterns) are smaller than the maximum tolerance
The system also checks that there is no glue found outside of an expected region. Usually, unexpected glue is a bad thing. In some cases, glue is tolerable in a certain region but not required. The system allows the user to create this region that is ignored.
The image below shows glue lines detected by the system (in yellow), surrounded by the “region of interest” for each glue line (in orange).

Inspection Configuration
The inspection system needs regions of interest defined in order to perform the inspection described above. To configure the ROIs, the user has two options:
- Automatically “learn” ROIs based on several cartons
- Manually configure ROIs and tolerances
Typically, for a new product, the user will use the “automatic learn” feature. The system analyzes several cartons and creates ROIs around the average glue positions. If the glue on the template cartons deviates too much from carton to carton, the “learn” process must be retried. After the automatic learn is complete, the user may tweak the auto-generated ROIs to fine tune the inspection.
The inspection configuration can be saved with a user-defined “job name.” In the future, if the customer runs the same glue pattern, they can simply reload the same configuration by selecting the job name from a list on the user interface.
Inspection Result Display
To display inspection results to the user, the real-time vision system transmits images with results markup to the .NET application. The last 10 pass and fail images are stored for review by the user. The user can choose different image processing and overlay options to help them analyze the images and determine failure modes.
The image below illustrates a failed image with some analysis options enabled. Bad glue and failed ROIs are highlighted in red. Glue found outside of an ROI is circled – sometimes a small speck of glue is hard to see.

Conclusion
DMC combined our expertise in vision systems, LabVIEW development, and .NET development to create a powerful and highly flexible inspection system. The system has been installed in end customer facilities all around the world.
Learn more about DMC’s Vision systems, LabVIEW development, Application development, and Test and Measurement expertise and contact us for your next project.