Bottle Cap Inspection based on Machine Vision

Download Full-Text PDF Cite this Publication

Text Only Version

Bottle Cap Inspection based on Machine Vision

S. Sridevi1, Dr. P. Karthikeyan2, C. Arun Prakasp, A. Jaganathan4, A. Mani5

1,2Division of Mechatronics, MIT Campus, Anna University, Chennai

3Department of Mechanical Engineering, SSN Collage of Engineering, Tamil Nadu

4Department of Mechatronics Engineering, Er.Perumal Manimekalai College of Engineering, Krishnagiri

5MELS India Pvt ltd, Chennai

Abstract In industrial production, the process of inspecting products with zero defect takes an important role. The result of inspection is either acceptance or rejection of the product based on certain features. In conventional method, man power is used to inspect the products which are time consuming with poor accuracy. To increase the number of products inspected with in short time with high accuracy, machine vision techniques are employed. This project describes the inspection of bottle cap in a manufacturing company, which utilizes various techniques of machine vision for its automation purposes. A perfect bottle should be a cap perfectly aligned with tamper ring. The defected sample may have absence of cap, absence of tamper ring, absence of both cap and tamper ring and improper tampering of cap. To find out these kinds of defects, profile information of the product is necessary. Here, a detailed discussion on profile information, morphological operations, and region props are described to identify the defects. Image is acquired using backlighting technique and the acquired images are processed using various morphological operations. The region of interest (ROI) is identified and area of ROI is calculated and compared with the prefect sample. Based on the result, the acceptance and rejection decision is taken. To automate this inspection, bottles are made to pass on a conveyor belt. IR sensor is used to identify the presence of bottle in front of the camera and which is used to trigger the camera. For that electronics control system is developed to control the conveyor position, interface the sensor and which is made to communicate with computer. MATLAB is used to image acquisition and image processing. A novel algorithm is developed to identify the defects. So, the inspection accuracy is increased.

KeywordsStructuring element, region of interest, erosion and dilation process


    In 2011 the international electrical and electronics approved the feature extraction for fill level and cap inspection in bottling machine which described the automated visual inspection system (AVIS) for cap closure and over/under filling [1]. Inspection of bottles crates in the beer industry through computer vision described about region of interest and segmentation of the crates. Even though the bottles orientation present in the crates may change, this method identifies the odd one [2]. A real-time machine vision system for bottle finish inspection described the real time inspection which involves selection of camera, selection of light settings, software selection and discussed about inspection algorithm [3]. Development of a Computerized Method to Inspect Empty Glass Bottle described that examine

    the empty glass bottles noise less image of the bottle neck is captured and morphological functions are used to inspect the empty bottles and 1D wavelet transform is used to inspect finishing of the bottles [4]. A bottle finish inspects method based on fuzzy support vector machines and wavelet transform discussed that the region of interest is found by using statistical and probability methods. Features are extracted from the image and identified using fuzzy support vector machines [5]. Due to industrialization, everyday usage of bottles in fields like medicine, oil industries, automobile sectors, and chemicals industries have increased enormously. To face the huge demand industries are automated for filling and sealing the bottles with high precision. Sometimes there may be some defects like absence of cap or tamper or both. In automation, identifying such defect is become difficult if done with manual inspection. Using machine vision, vision sensor is used to identify such defects with the help of proper light settings. Computer is interfaced with vision sensor through USB or frame grabbers. This technique is used to inspect the bottles in few milliseconds with high accuracy.

    Machine vision is one of the advanced techniques which explain about, building the machine vision inspection system describing the task and benefits of the system, inspecting various parts comprising individual and batch production, time performance, installation space, and checklist. It also describes about various lighting techniques for various applications, interfacing and data communication of various frame grabbers, industrial camera systems which are either area scan camera or line scan camera, frame rate, resolution, lenses, camera calibration, optical systems, image enhancement, image transformations, image segmentation, image sub pixeling, thresholding and color image processing.

    Various lighting techniques are used to capture the image which is chosen based on the application. Front lighting is used to know about the surface information presented in the image. Back lighting is used to get the profile information presented in the image. Machine vision system describes about various data cables with standard connectors. This work discusses about how the reference image and defect image is acquired and processed for decision. Acquired image is a gray level image which is later converted into binary image to detect the noises due to ambient light. Area of defected image is subtracted from the area of reference image to identify proper parameters. Based on the parameter result, the acceptance or rejection action is performed.


    1. Specifications of Machine Vision System Inspection

      1. Task and Benefit

        Inspection of bottle cap should be important to industrial quality. If any defect such as missing cap, missing tamper or improper alignment can be a quality issue. To avoid this, it should be checked before dispatch. The defects are classified into different categories based on cap position, tamper position, presence or absence of cap and tamper. Maximum 2 defects per minute of caps are defected. To analyze this defect, image processing software is necessary which is used to display the defect, and to display a summary of inspected items. The inspection can be monitored from remote place through an interfacing protocol and the inspection is done automatically.

      2. Parts

        In bottle cap inspection, individual sealed bottles are passed through a conveyor. The parts should be presented in front of image sensor one by one. The process considered here is for batch production.

      3. Parts Positioning

        Filled and sealed bottles are passed through a conveyor which is moved in horizontal direction and the bottles are kept in vertical position. The speed should be 100mm /sec. The tolerance of part positioning is less than

        ± 1mm. The belt stops for every 1.5s. Part vibration might be an issue. The belt control can provide a 5V signal for triggering cameras. Here only one type of cap with specific dimension is considered for inspection.

      4. Performance Requirements

        The bottle cap needs to be measured with high accuracy. The processing result should be presented immediately. The maximum processing time is 2.5 sec.

      5. Installation Space

        A direct insight into the cap is possible. The maximum space for installing equipment is 1m. The distance betwen the camera and the remote computer is 6m. A certain protection glass is not necessary.

    2. Design of Machine Vision System Inspection 1)Camera Type

    As the part positioning is indexed and the cap can be

    imaged with one frame, area scan camera is used.

    1. Field of view

      FOV = maximum part size + tolerance in positioning + margin + adaption to aspect ratio of camera sensor.

      In this case, the following values are specified. Maximum part size : 30 mm Tolerance in positioning : 1mm Margin : 70 mm

      Hence, the field of view is calculated as FOV hor = 80mm + 1mm+20mm = 101mm

    2. Resolution

      As the field of view and the accuracy of the measurement are known, the necessary sensor resolution can be calculated as follows.

      RCamera = 101mm x 5 pixel/0.1mm = 5050 pixels

    3. Choice of camera, frame grabber and hardware platform

      Camera Scan Type : Area Scan

      Camera (Color/Mono) : Monochrome Camera Make and Model : iball C8.0 Camera Sensor Resolution : 320 X 240 Sensor Size and Aspect Ratio : 4:3 CCD/CMOS : CMOS

      Camera Interface : USB 2.0 Progressive/Interlaced Scan : Progressive Frame Rate : 60fps

      Hardware Platform : Intel core2 Duo, 1GB RAM

    4. Choice of illumination

      Type of Light Source : Incandescent bulb Type of Lighting Technique : Diffused Bright Field

      Transmitted Lightning Technique

    5. Mechanical Design

      Once the image acquisition setup is determined as per the design based on previous parameters, the alignment should not be changed manually or artificially like vibration or shock.

    6. Electrical Design

      The proper power supply is given to the total system. Cable lengths should be as per the standard to avoid information loss.

      Camera Link : 10meter or

      IEEE 1394 : 4.5meter

      Analog : up to 15 meter

    7. Software

    Software Platform : Windows XP

    Software Library : MATLAB, Image acquisition Toolbox, Image processing Toolbox


    1. Image Acquisition Setup

      Fig. 1. Typical diagram of bottle cap inspection system.

      Bottles are made to pass through the conveyor. A digital IR or proximity sensor or ultrasonic sensor can be used to detect the bottle presence in front of the camera. When the sensor detects the bottle it triggers the camera through Computer. Images are acquired using vision sensor like camera which is high resolution and high speed camera and interfaced with MATLAB and image acquisition toolbox. A

      real-time image processing algorithm is developed to identify the defect in the bottle cap. Back lighting technique is used which is diffused white light is used as back light and the ambient light made to null. So the profile information gets clear. Based on the image processing algorithm the system identifies the bottle which has defected cap. Finally the system displays the classified defect in the screen. The defected item sent to rejection bin. Fig 1 shows that the bottle cap inspection system.

    2. Image Processing Methodology

      Acquired Image (Gray Scale Image)


      Acquired Image (Gray Scale Image)




      Binary Image

      Binary Image

      Complement Image

      Complement Image

      Perform morphological operations

      Perform morphological operations

      the image may consist of noise which must be eliminated. Some software filers like structuring elements are designed and used to erode the noise presented in the image. Now the noises are eliminated.

      (a) (b) (c) (d)

      Fig. 3 (a) Acquired reference image, (b) Binary image (c) Complemented image (d) Filtered image

      The resultant image consists of only one connected component which is nothing but the white region of the cap. The area of white region is calculated. Initially a good sample piece of bottle is taken for acquiring reference image and the above discussed steps are performed for that particular sample of bottle image and consider this resultant noise eliminated image as reference image throughout the inspection.

      (a) (b) (c) (d)

      Calculate the area of the connected component (ROI)

      Calculate the area of the connected component (ROI)

      Fig. 4 (a) Acquired defected image (cap missed) (b) Binary image (c) Complemented image (d) Filtered image




      Area == Ref.Area




      Fig. 2 Block diagram of image analysis

      Fig.2 shows the block diagram for image analysis. Acquired image is gray level image which has the gray values between 0-255. The value 0 represents black color, the value 255 represents white color and in between the values 1 to 254 represents the various grey colors between black and white. The image is converted into binary image for that thresholding technique is used. Morphological operations are applied to the image. Area of ROI is calculated which is compared with reference perfect sample. Based on the comparison, acceptance and rejection is taken.

    3. Discussion the Result of Image Analysis

    Fig 3 shows the acquired gray level image (a) binary image (b) complemented image (c) and filtered image (d) for perfect sample. Acquired grey level image is converted into binary image by setting the threshold value. So the cap area is converted into black region (binary value is zero) and the remaining area is converted into white region (binary value is one). This image is complemented as shown in fig (c). Then

    (a) (b) (c) (d)

    Fig. 5 (a) Acquired defected image (tamper missed) (b) Binary image (c) Complemented image (d) Filtered image.

    Fig. 4. and Fig. 5 shows that the image cap and damper missed. So, the area of the region of interest (ROI) is calculated and compared with the reference image area. The difference is larger. The algorithm is developed such that to display the error.

    (a) (b) (c) (d)

    Fig. 6 (a) Acquired defected image (cap doesnt damper) (b) Binary image (c) Complemented image (d) Filtered image.

    Fig. 6. shows that the cap doesnt damper. In this case the ROI has split into two connected components. From that, the cap doesnt damper properly. Based on the above discussions, the result is displayed as shown in Fig. 7.


    Fig. 7. Image with the information of defect


    To get accuracy in the inspection system, the ambient light is a big challenge which makes noises in images that leads to complication in development of decision making algorithm. To reduce the noise interference, image acquisition is taken in dark place. During decision process, the difference may not be exact zero for that some tolerance is predetermined and decision is carried out. When the result goes beyond the preset value, rejection occurs.


This automated bottle cap inspection system is applicable to medical and food product industries. In this discussion, identification of few general defects is analyzed. Machine vision based inspection system will support to achieve high accuracy and to increase product quantity. The algorithm amy be further developed to identify the liquid level at the same time. The estimated result from the inspection system has discussed in detail.


The authors would like to thank HOD Professor.A.Jothilingam, Professor.G.Muralidhran, Production Technology, MIT-Campus, Anna University, Dr.R.Senthilnathan, SRM University, for their continuous moral and finical support throughout this work.

  1. L. Yazdi, A. Prabuwono, and E. Golkar, "Feature extraction algorithm for fill level and cap inspection in bottling machine," in Pattern Analysis and Intelligent Robotics (ICPAIR), 2011 International Conference on, 2011, pp. 47-52.

  2. M. Campos, M. Ferreira, T. Martins, and C. Santos, "Inspection of bottles crates in the beer industry through computer vision," in ECON 2010 – 36th Annual Conference on IEEE Industrial Electronics Society, 2010, pp. 1138-1143.

  3. Feng, W. Yaonan, and L. Huanjun, "A real-time machine vision system for bottle finish inspection," in Control, Automation, Robotics and Vision Conference, 2004. ICARCV 2004 8th, 2004, pp. 842-846 Vol. 2.

  4. H. j. Liu and Y. n. Wang, "Development of a Computerized Method to Inspect Empty Glass Bottle," in Computer Science and Computational Technology, 2008. ISCSCT '08. International Symposium on, 2008, pp. 118-123.

  5. W. Yao-Nan, L. Huan-Jun, and D. Feng, "A bottle finish inspect method based on fuzzy support vector machines and wavelet transform," in Machine Learning and Cybernetics, 2005. Proceedings of 2005 International Conference on, 2005, pp. 4588-4592 Vol. 8.

  6. M. Magee, R. Weniger, and D. Wenzel, "Multidimensional pattern classification of bottles using diffuse and specular illumination," Pattern Recognition, vol. 26, pp. 1639-1654, 1993/11/01 1993.

  7. F. Shafait, S. M. Imran, and S. Klette-Matzat, "Fault detection and localization in empty water bottles through machine vision," in E- Tech 2004, 2004, pp. 30-34.

  8. C. Silva, G. H. C. Bonfim, L. C. Paschoarelli, D. R. Fabio, A. L. Alves, E. A. D. Merino, et al., "Evaluation of Two PET Bottles Caps: An Exploratory Study," Procedia Manufacturing, vol. 3, pp. 6245- 6252, // 2015.


  10. W. Zhou, M. Fei, H. Zhou, and K. Li, "A sparse representation based fast detection method for surface defect detection of bottle caps," Neurocomputing, vol. 123, pp. 406-414, 1/10/ 2014.

Leave a Reply

Your email address will not be published. Required fields are marked *