Machine-vision systems perform practical tasks on bottling lines, varying frominspecting defects in cap placement to measuring fill levels. Because the operations are often performed at high speeds, it is impossible to manually inspect each bottle for these characteristics.
In light of this, Slim Abdelhedi, PhD, and his colleagues at CMERP (Control of Electrical Machines and Power Networks, part of the University of Sfax) in Tunisia have developed a machine-vision system that uses off-the-shelf imaging components to perform these tasks on olive oil bottles as they pass along a production line (see Fig. 1).
As bottles move along the production line, they are detected by a photoelectric sensor that is used to trigger an SVCam eco424 640 × 480-pixel GigE Vision CCD camera fromSVS-Vistek (www.svs-vistek.com). To capture images of the bottles as they move at 1 m/sec, an exposure time of 0.18 msec ensures that there is less than one pixel of image blur across the 116-mm field of view (FOV) of the camera.
Measuring the fill level and cap placement depends on accurately obtaining a high contrast between the object and its background, so a direct white LED ringlight mounted around the camera reduced shadow effects and provided good definition of the object's color. The ringlight was used in conjunction with a white LED backlight that enhanced contrast of both the outline of the cap and the fill level within the bottle.
After images were acquired by the camera, they were transferred to a host PC over the GigE interface using the Image Acquisition Toolbox, part of theMATLAB software library from The MathWorks (www.mathworks.com).
Anadaptive thresholding algorithm is first performed on the RGB color images to separate the bottle from the background. Although a global thresholding approach could have been taken, changing this threshold dynamically over the image accommodates any changing lighting conditions in the image.
To reduce the processing time required to determine the correct cap placement and fill level, two regions of interest are extracted from the thresholded image. To detect whether the bottle cap is present, a binary profile within the region of interest is computed and compared with a known good value (see Fig. 2). The data are then used to either accept the cap placement as good or reject it as unacceptable.
For liquid level detection, a Hough transform is used to determine the location and orientation of straight lines in the image of the second region of interest (ROI; see Fig. 3). After computing the distance between these lines and a known good reference level, the system then uses the result to determine whether a bottle is filled correctly. The data are used to accept the bottle as correctly filled or to reject it as unacceptable.