Skip to main content
Advertisement
Browse Subject Areas
?

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

Machine vision model for detection of foreign substances at the bottom of empty large volume parenteral

  • Pi Yuan,

    Roles Conceptualization, Data curation, Formal analysis, Investigation, Methodology, Software, Validation, Writing – original draft

    Affiliation School of Mechanical and Energy Engineering, Zhejiang University of Science and Technology, Hangzhou, China

  • Chen Li ,

    Roles Conceptualization, Methodology, Validation, Writing – review & editing

    lee_lichen@163.com

    Affiliation School of Mechanical and Energy Engineering, Zhejiang University of Science and Technology, Hangzhou, China

  • Peng Tang,

    Roles Data curation, Formal analysis, Project administration, Writing – review & editing

    Affiliation School of Mechanical and Energy Engineering, Zhejiang University of Science and Technology, Hangzhou, China

  • Bin Yuan,

    Roles Project administration, Supervision, Writing – review & editing

    Affiliation School of Mechanical and Energy Engineering, Zhejiang University of Science and Technology, Hangzhou, China

  • Yongjing Yin

    Roles Conceptualization, Data curation, Formal analysis, Project administration, Supervision

    Affiliation School of Mechanical and Energy Engineering, Zhejiang University of Science and Technology, Hangzhou, China

Abstract

Empty large volume parenteral (LVP) bottle has irregular shape and narrow opening, and its detection accuracy of the foreign substances at the bottom is higher than that of ordinary packaging bottles. The current traditional detection method for the bottom of LVP bottles is to directly use manual visual inspection, which involves high labor intensity and is prone to visual fatigue and quality fluctuations, resulting in limited applicability for the detection of the bottom of LVP bottles. A geometric constraint-based detection model (GCBDM) has been proposed, which combines the imaging model and the shape characteristics of the bottle to construct a constraint model of the imaging parameters, according to the detection accuracy and the field of view. Then, the imaging model is designed and optimized for the detection. Further, the generalized GCBDM has been adopted to different bottle bottom detection scenarios, such as cough syrup and capsule medicine bottles by changing the target parameters of the model. The GCBDM, on the one hand, can avoid the information at the bottom being blocked by the narrow opening in the imaging optical path. On the other hand, by calculating the maximum position deviation between the center of visual inspection and the center of the bottom, it can provide the basis for the accuracy design of the transmission mechanism in the inspection, thus further ensuring the stability of the detection.

1. Introduction

Large Volume Parenteral (LVP) is one of the five important classes of pharmaceutical products. Its safety is closely related to the life and health of patients, and the quality detection of LVP needs strict requirements [1]. Due to the constraints of manufacturing technique and environment, in some cases, there may be some foreign substances inside the LVP fluid, such as glass chips, fibers, hairs, plastic chips, etc. When the liquid medicines containing foreign substances have been taken into the human body, the patients may catch a fever or chill, and in some case, even face death [2]. Therefore, it is necessary to conduct vial-by-vial detection for insoluble foreign substances in LVP.

For the detection of foreign substances in LVP, the traditional detection method is directly through the manual visual, which is labor-intensive and prone to visual fatigue and production quality fluctuations. With the development of computer vision technology, some machine vision inspection equipment has been applied to the detection of foreign objects in pharmaceutical fluids [3, 4]. In general, these devices often rotate the liquid bottle by mechanical means, thus rotating the foreign objects to follow the movement of the liquid. Then the rotating mechanism is stopped sharply and the motion of the foreign objects are observed by continuous photography of the vision system [5, 6], and finally the identification of different targets is performed [7]. At present, the detection technology for foreign substances in pharmaceutical solutions is more mature [8], but most of the above detection equipment is concentrated in the detection after the filling of pharmaceutical solutions. However, the plastic empty bottles used for pharmaceutical liquid packaging may have foreign substances brought in and attached to the bottom or body of the bottle before filling the liquid. After passing through the subsequent filling process, they become substandard products. In order to reduce production costs, the empty plastic bottles after the blow molding process and before filling also need to be detected for foreign substances.

For the above-mentioned foreign substances adsorbed on the side of the LVP bottle, drawing on the traditional detection in transparent glass bottles [911], the imaging and detection of foreign substances can be quickly achieved by backward illumination of a planar light source. However, in the detection of foreign substances adsorbed at the bottom of LVP bottle, due to the special characteristics of the bottle (as shown in Fig 1), there will be differences in imaging compared to the traditional transparent glass bottles and will interfere with the illumination or imaging optical path [12]. For example, the presence of a special structure like a pull ring at the bottom can obscure the imaging at the bottom at some imaging angles. In addition, the narrow bottle opening will interfere with the imaging light path at the bottom.

thumbnail
Fig 1. Images of commonly used LVP bottle.

(a) front view; (b) side view; (c) image of the bottom; (d) image of the opening.

https://doi.org/10.1371/journal.pone.0298108.g001

With reference to the traditional detection of defects in glass bottles, such as the detection of empty beer bottles, empty beverage bottles, etc. [1320], the following methods are commonly used to detect the bottom of bottles:

  1. Illumination from the bottom and imaging through the opening of the bottle [2125], as shown in Fig 2(A) and 2(B). The detection model shown in (a) uses a uniform planar light source to illuminate the bottom and the imaging unit to image the bottom through the opening. The detection model shown in (b) uses ring light at a specific angle to illuminate the bottom uniformly according to the specific shape of the bottom, and to avoid the interference of the raised pattern of bottom [26, 27]. Similarly, the imaging unit images the bottom through the mouth of the bottle. The two methods mentioned above, which illuminate the bottom uniformly [18], simply capture an image of the bottom. But they don’t take into account constraints such as detection accuracy and the shape of the bottle opening. These methods can achieve uniformed image for bottle bottom inspection with low detection accuracy, or with a small detection field of view. Such as the traditional glass beer bottles and so on [28], the detection accuracy of which is about 3mm×3mm. In addition, for the bottom of the LVP bottle (Fig 1(C)), the pull ring at the bottom is not at a fixed angle as well as a fixed height, and it is not possible to use the ring light to illuminate the bottom of the bottle evenly.
  2. Coaxial illumination and imaging through the bottle opening [29], as shown in Fig 2(C). The coaxial light source incident a uniform plane light through the beam splitter to the bottom, and the imaging unit images the bottom easily through the opening of the bottle. This method is mainly applicable to the inspection of bottles with wide opening, such as canning jars [30, 31]. For the bottom detection of LVP, the small opening (as shown in Fig 1(A) and 1(D)) will interfere with the incident light, resulting in poor illumination uniformity at the bottom and subsequent inability to obtain clear image.
  3. Direct illumination and direct imaging the bottom, as shown in Fig 2(D). Specific angle ring light incident on the bottom, forming bright-field or dark-field illumination. And the imaging unit directly imaging the bottom, and obtains the dark-field or bright-field image of the bottom. This detection method is mainly applicable to the bottom detection of the more regular glass bottle, such as beer bottle or glass LVP bottle bottom. For plastic LVP bottle bottom detection, the presence of pull ring and irregular shapes formed after the blow molding, can prevent the formation of bright-field or dark-field in the imaging, thus failing to obtain clear images.
  4. Illumination through the opening of the bottle and direct imaging the bottom, as shown in Fig 2(E). The illumination of the bottom is completed by a uniform planar light source incident from the opening, and the imaging unit images the bottom directly from the back. However, for LVP with narrow bottle opening, this detection method will form a bright spot at the opening position, which will easily interfere with the imaging of foreign substances to be detected.
  5. llumination from the side of the bottle and tilt imaging the bottom, as shown in Fig 2(F). Uniform plane light source evenly illuminates the side of the bottle, and the imaging unit is tilted at a certain angle to achieve the detection imaging of the bottom. This approach is more conducive to the integration of inspection units, i.e., the simultaneous realization of the inspection of the side of the bottle and the inspection of the bottom, and is commonly used for the rapid inspection of small glass (cylindroid) bottles. However, this detection method is susceptible to interference from the side imaging of the bottle, and the tilt imaging of the bottom is likely to cause the image out of focus.
thumbnail
Fig 2. Imaging solutions for machine vision in traditional bottle bottoms.

(a) (b) illumination from the bottom and imaging through the opening of the bottle; (c) coaxial illumination and imaging through the bottle opening; (d) direct illumination and direct imaging the bottom; (e) illumination through the opening of the bottle and direct imaging the bottom; (f) illumination from the side of the bottle and tilt imaging the bottom.

https://doi.org/10.1371/journal.pone.0298108.g002

In summary, the current detection of the bottom of plastic LVP bottle is mainly due to the irregular shape and the narrow opening of the bottle, which will cause interference with the incident light and the imaging of the bottom in the inspection. In addition, its detection accuracy is generally better than 50um, which is much higher than the detection accuracy of traditional glass bottles. The existing inspection methods do not have a universal visual inspection model based on the inspection accuracy, the shape of the bottle, and the field of view of the inspection.

In this thesis, a machine vision model and system for bottom detection in empty LVP bottle, namely geometric constraint-based detection model GCBDM, is developed to overcome the shortcomings of existing detection techniques. It completes the design and optimization of the imaging model of the bottom according to the requirements of inspection accuracy and field of view, combined with the imaging model and the shape characteristics of the bottle to be inspected. Further, by modifying the relevant constraint parameters in different application scenarios, it is possible to adapt to different detection needs. The innovative application of this paper consists of the following main aspects:

  1. Taking empty LVP bottle as the research object, this paper establishes a generalized visual detection model for the bottom detection based on the imaging theory and the constraints in the actual scenario. The parameters of the vision inspection hardware are optimized according to the geometry of the bottle and the inspection accuracy, combined with the imaging model, etc., so that a more economical vision inspection hardware solution can be designed. It is also possible to image the bottom completely on the camera imaging plane through the narrow opening/neck of the bottle.
  2. The GCBDM can solve the problem of generality of bottle bottom detection in different detection scenarios, taking different pharmaceutical packaging products as examples, such as bottom detection for cough syrup bottle and capsule medicine bottle with different detection needs. And, by calculating the maximum position deviation range between the center of visual inspection and the center of the target to be inspected, it can provide the basis for the accuracy design of the transmission mechanism in the inspection.

The remainder of this paper is organized as follows. Section 2 focuses on the bottom inspection of empty LVP bottle as the research object, introducing the geometric characteristics of the sample to be inspected, the inspection accuracy, the constraints, and further building the applicable machine vision inspection system. Section 3 builds the geometric constraint- based detection model (GCBDM) based on the detection accuracy and detection constraints in Section 2. The vision model can achieve clear imaging of the bottom under the condition of ensuring the inspection accuracy and inspection field of view, and it can avoid the interference of special form factor such as narrow bottle opening during the imaging process. Section 4 takes empty LVP bottle as an example, designs a machine vision imaging system according to its inspection requirements, and calculates a variety of hardware combination solutions, and gets the optimal machine vision solution by comparing the experimental results. In addition, taking the bottom detection of other commonly used bottles in the pharmaceutical packaging field as an example, such as the bottom detection of cough syrup bottle and capsule medicine bottle, the optimization of the visual detection system is completed by modifying the constraints according to the GCBDM established in Section 3, and the generality of the model is verified by the experimental results. Finally, a brief conclusion is presented in Section 5.

2. Machine vision system for bottle bottom inspection

This paper takes the bottom detection of empty LVP bottle (as shown in Fig 1) as the object of study. Compared with bottoms detection of traditional bottles, such as beer bottles and can bottles, the detection accuracy detection of LVP bottle is about 0.05mm×0.05mm, while the detection accuracy of the latter is only 3mm×3mm but the two have similar detection field of view, thus the former has a higher detection difficulty. In addition, the former has a narrow bottle opening, which tends to interfere with the illumination of the bottom as well as the imaging optical path. Therefore, the design and optimization of the whole machine vision system needs to be completed according to the geometry constraints of the sample to be inspected, the constraints of the inspection field of view, and the constraints of the inspection accuracy.

Firstly, considering the special geometry of LVP bottle, is not the traditional cylindrical. For the imaging unit, this paper adopts the pin-hole imaging model with the effect of near large and far small, which ensures that the near imaging height can pass through the narrow bottle opening. That is, imaging from the bottom of the bottle can pass through the narrow mouth of the bottle. For the light unit, it is difficult to meet the ideal inspection conditions such as bright field and dark field using ring light incidence due to the presence of a pull ring and the uneven surface at the bottom. In addition, due to the narrow opening of the bottle, it is also difficult for the coaxial light to be incident from the opening to the bottom of the bottle, thus making it difficult to achieve uniform illumination of the bottom. At the same time, because the bottle is not cylindrical, it is difficult to achieve a uniform image from the side incident light and from the side tilt imaging. And its bottle bottom size is large, tilt imaging is more likely to produce out-of-focus, resulting in unclear imaging. Based on the above analysis, in order to achieve uniform illumination of the bottom, this paper uses gross glass and LED plane light to form uniform illumination, which is incident from the lower part to the bottom. As shown in Fig 3.

thumbnail
Fig 3. System structure diagram of LVP bottle bottom detection.

https://doi.org/10.1371/journal.pone.0298108.g003

In the inspection system shown in Fig 3, the drive mechanism moves in direction, using mechanical devices such as cylinders and clamps to hold the neck of the bottle and drive the bottom within the inspection range. The light under the bottom is evenly incident on the bottom, and the Factory Automation (FA) lens is used to capture the information from the bottom through the narrow opening into the image sensor, using the pin-hole imaging theory. According to the optical path shown in Fig 3, in order to ensure the effectiveness of the imaging optical path, then the following conditions need to be met:

  1. the resolution of the imaging should be smaller than the minimum size of the detection target, ensuring clear imaging of the detection target;
  2. the detection field of view corresponding to the shortest side of the camera sensor needs to be larger than the longest dimension of the bottom of the bottle being inspected, which can ensure that the detection target is completely presented within the camera’s field of view;
  3. the working distance of the imaging unit needs to be greater than the height of the bottle, which can avoid the occurrence of defocusing and resulting in unclear imaging;
  4. to avoid interference from the narrow bottle mouth on the imaging of the bottle bottom, it is necessary to ensure that the imaging parameters at the bottle mouth position are smaller than the diameter of the bottle mouth, which can effectively avoid occlusion of the imaging optical path by the bottle mouth.

3. Geometric Constraint-Based Detection Model (GCBDM)

The system diagram shown in Fig 3 is simplified to the model schematic shown in Fig 4(A). Uniform plane illumination, through the bottom into the imaging system, the bottom information (x) imaged on the camera imaging plane (x′). Since the bottom is approximately elliptical, the long axis of the elliptical bottom is imaged on the short side of the camera imaging plane in order to ensure the integrity of the bottom imaging. Where the length of the long axis is D1. For the camera and the lens composed of the pin-hole imaging unit, the focal point is F, the focal distance is f, the focus-image distance is i,the object principal plane of the imaging is A, and the image principal plane is B. Based on the analysis of Section 2, in order to ensure that the imaging system can achieve complete imaging of the bottom through the width of the bottle opening (w), four different sets of constraints on the imaging system are required from the inspection requirements, as well as the geometric parameters of the bottle. The calculation flow of the constraints and the parameters of the imaging system are shown in Fig 4(B).

thumbnail
Fig 4. Schematic diagram of GCBDM.

(a) schematic diagram of bottle bottom detection; (b) flow chart of imaging parameters calculation based on different constraints.

https://doi.org/10.1371/journal.pone.0298108.g004

The flow chart shown in Fig 4(B) focuses on the calculation of the dimension (P) and pixel size (p)of the camera, as well as the focal length (f) and magnification (M) of the lens, based on different constraints. This facilitates the design of the optimal imaging unit configuration.

First, according to the principle of lens imaging: (1) (2)

In Fig 4, using the principle of similar triangles: (3)

Where x is the object height of the image,x′ is the image height of the image, and M is the magnification of the image.

From Eqs (1)(2)(3), it can be found that: (4)

According to constraint 1: the resolution of the imaging (β)should be smaller than the minimum size of the target to be detected (δ): (5)

According to constraint 2: the inspection field of view (2x) is larger than the maximum size of the bottom to be inspected (D1): (6)

It should be noted that P is the short side dimension of the camera sensor size, and its dimension is the product of the number of pixels Pixelshort on the short side of the sensor and the pixel size p. In addition, the bottom of the LVP bottle is approximated as an ellipse, and the long axis of the ellipse is D2, and the short axis is D1, and the short axis is D2.

According to Eqs (5)(6): (7)

According to Formula 7: A balance point can be found that ensures sufficient resolution to detect the required minimum features, while also ensuring that the object to be inspected can be completely captured within the camera’s field of view. If the magnification is too high, it may lead to a too small field of view, unable to fully observe the entire object to be inspected; if the magnification is too low, it may be unable to discern the fine features that need to be detected.

According to constraint 3: the working distance of the imaging unit d needs to be greater than the height of the bottle H. In order to further ensure the safe distance between the lens and the bottle, the distance between the object principal plane of the imaging A and the bottom (the object distance u) is approximated as the safe distance for imaging: (8)

According to constraint 4: the width of the imaging at the opening of the bottle w′ is smaller than the diameter of the opening w: (9)

Where, according to the principle of similar triangles, the bottom D1 passes through the opening of the bottle, the corresponding imaging width w′ is calculated as follows: (10) (11)

Where,h is the height of the bottleneck.

According to Eqs (8)(9)(11), it can be obtained that: (12)

Further, according to Eqs (4)(12): (13) (14)

In industrial cameras and lenses for vision inspection, the camera dimension P the pixel size P and lens focal length f are a series of fixed parameters. And, for the shape parameter (H,h,D1) of the sample to be tested and the minimum size of the target to be detected (δ)are the known values. Therefore, the imaging system parameters matching the inspection requirements can be calculated according to Eqs (7)(14), which can avoid interfering factors in imaging and ensure the integrity and stability of imaging, i.e., the information of the bottom of the bottle in imaging is not obscured by the narrow opening of the bottle.

In summary, by designing the GCBDM model and selecting an appropriate hardware solution, clear imaging of the bottom of the bottle can be achieved. Moreover, after obtaining a clear image of the bottom of the bottle using the imaging method designed in this paper, image processing of defects can be easily operated. For example, some methods of feature enhancement, and Blob analysis can be easily used in the detection of foreign objects at the bottom of the bottle, which are shown as follows:

  1. (1) Feature enhancement.

Feature enhancement can increase the contrast information of the object to be recognized in the background, ensuring a clear distinction between foreign objects and the clean bottom area of the bottle. Its principle is shown in Eq (15): (15) Where,Iem is the enhanced image, meanm×m is the mean value in the image I within the window size m×m, and Kem is the enhancement factor (Kem>1).Through the above image processing operations, foreign objects at the bottom of the bottle can be clearly identified, resulting in an image with strong contrast.

  1. (2) Blob Analysis.

Formula (15) can further enhance the background and contrast of the image. The enhanced image can then be used for defect extraction and detection through an adaptive global threshold segmentation algorithm. Further analysis of blob features can be performed to label the defects, based on the principles presented in Eqs (16) and (17).

(16)(17)

In conclusion, with the use of GCBDM in this paper, a clear image of the bottom of the bottle can be achieved. Then, the information of defects can be extracted easily using the traditional image processing of defect detection.

4. Experiments

4.1 Experiments of GCBDM on the Bottle Bottom of LVP

4.1.1 Constraints of detection, and calculation of GCBDM.

In this paper, the object of study is an empty LVP bottle whose dimensions are shown in Fig 4(A), and whose bottom is an approximate ellipse with the long and short axes respectively D1 = 70mm, D2 = 50mm In addition, the required geometry parameters in the calculation process are w = 18mm, h = 18mm, H = 142mm In addition, the detection accuracy of foreign objects in LVP is δ = 00.5mm. Through the above-mentioned shape characteristics of empty LVP bottle and the inspection requirements, the calculation of vision parameters is completed. And according to the commonly used industrial camera and industrial lens parameters, design a suitable imaging configuration, and complete the imaging of the bottom. Therefore, based on the given parameters of β<δ, β = p/M, P/M>D1, d>u>H, and w′<w, as well as the four constraint conditions, the computational process is obtained as shown in Fig 5.

thumbnail
Fig 5. Constraints of LVP bottle bottom detection and calculation process of detection model.

https://doi.org/10.1371/journal.pone.0298108.g005

According to the above calculation process, the main parameters of the camera unit in the detection model are the resolution of the camera, the sensor size, and the pixel size. Among them, parameters of the commonly used industrial camera and lens are shown in Table 1.

thumbnail
Table 1. Parameters of common industrial cameras and lenses.

https://doi.org/10.1371/journal.pone.0298108.t001

It should be noted that, considering that the bottom may have the problem of rotation, that is, the shortest edge of the field of view is required to meet the requirements of greater than D1 = 70mm, and the detection accuracy is better than 03 δ = 0.05mm. So, for the industrial camera, the number of pixels on the short side of the sensor size should meet: (18)

Therefore, based on the requirements in Eq (18) and the parameters of industrial cameras and lens, the parameters that may be suitable for the imaging are designed. The magnification M is calculated for different hardware conditions using Eqs (7)(14), and then can be used as a criterion for camera and lens matching. That is, the M calculated by the camera parameters and the M calculated by the lens parameters have the same interval range, shown in Table 2.

thumbnail
Table 2. Magnification calculated based on constraints for different hardware conditions in the bottom detection of empty LVP bottle.

https://doi.org/10.1371/journal.pone.0298108.t002

Based on the above calculations and configurations, some economical imaging solutions are designed in terms of actual costs as shown in Table 3.

thumbnail
Table 3. Feasible imaging solutions for the bottom detection of empty LVP bottle.

https://doi.org/10.1371/journal.pone.0298108.t003

4.1.2 Experiment results and discussion.

According to the schemes in Table 3, the information at the bottom of the LVP bottle, through the narrow bottle opening, is imaged on the camera imaging plane, and the experimental results are shown in Fig 6.

thumbnail
Fig 6. Imaging results obtained according to different detection schemes.

(a1) (a2) the constructed detection model and the image of the bottom acquired by the 5MP camera at the lens focal length f = 12mm; (b1) (b2) (c1) (c2) (d1) (d2) the constructed detection models and the images of the bottom acquired by the 20MP camera at the lens focal length f = 8mm,12mm,16mm; (a3) (b3) (c3) (d3) the detection results of the traditional image processing with the Eqs (15) (16) and (17).

https://doi.org/10.1371/journal.pone.0298108.g006

As can be seen from the Fig 6, all four imaging schemes can achieve complete imaging of the bottom and the foreign object. And all of them can meet the resolution. However, for the imaging methods with large sensor size (20MP) in (b)(c)(d), the bottom information occupies only a small part of the image, i.e., there is more waste in the camera imaging plane. Therefore, the optimal imaging method is Option 1.

In addition, it should be noted that in the above-mentioned detection, the bottle bottom in the transmission process, there will be a certain error in the position of each photo. That is, the photo optical axis and the central axis of the bottom will not be completely coincident. If the deviation between the two central axes is large, i.e., the width of the imaging model at the bottle neck position may exceed the width of the bottle opening. That is, the maximum deviation range of the imaging center from the center of the bottom during the inspection. And, in the above calculation, the maximum deviation value is larger when the working distance is closer, thus reducing the requirement for mechanism drive accuracy. Therefore, under the condition that the mechanical installation height allows, the detection height is appropriately reduced. In addition, in the actual inspection, different transmission structures have different transmission accuracy, and the appropriate transmission mechanism can be designed according to the above calculation results Δw.

Based on the above solution and in conjunction with the GCBDM imaging model designed in this article, it is possible to effectively address the bottlenecks in imaging detection schemes caused by inappropriate working distances, which lead to obstruction of the imaging optical path. It also resolves issues such as obstruction of the imaging optical path due to unsuitable lens focal lengths during the imaging process, or the inability to meet precision requirements for detection, which is shown in Fig 7.

thumbnail
Fig 7. Imaging optical path occlusion.

(a) Inappropriate working distance causes the imaging optical path to be obscured by the bottleneck. (b) Inappropriate lens focal length causes the imaging optical path to be obscured by the bottleneck. (c) Full imaging is possible, but due to inappropriate focal length or working distance, the accuracy cannot reach 0.05mm.

https://doi.org/10.1371/journal.pone.0298108.g007

Further, using the GCBDM established in this paper, the optimized detection model is automatically obtained by modifying the corresponding geometry parameters in different application scenarios, thus adapting to the detection needs of different samples to be detected. In this paper, we try different detection scenarios, taking different pharmaceutical packaging products as examples, such as bottom detection for cough syrup bottle and capsule medicine bottle, etc.

4.2 Experiments of GCBDM on the bottle bottom of cough syrup

4.2.1 Constraints of detection, and calculation of GCBDM.

For the bottle of cough syrup, its shape can be approximated as a cylinder with a tall bottle and a small neck. During the inspection, the information from the bottom needs to be imaged on the camera imaging plane through the narrow bottle neck. The parameter calculation process based on constraints β<δ,β = p/M, P/M>D1, d>u>H, and w′<w is shown in Fig 8.

thumbnail
Fig 8. Constraints of cough syrup bottle bottom detection and calculation process of detection model.

https://doi.org/10.1371/journal.pone.0298108.g008

For the bottom detection of the cough syrup bottle, the main detection is the presence of foreign matter (e.g., hair, fiber, etc.), and the detection accuracy is about 0.1mm. Likewise, the bottle has a narrow opening, and the width at the bottle neck position should not exceed the width of the narrow bottle neck.

According to the calculation of the detection model shown in Fig 8, and the commonly used imaging lens and camera parameters (which can be initially selected based on Eq (18)), the design of the detection model is shown in Table 4.

thumbnail
Table 4. Magnification calculated based on constraints for different hardware conditions in the bottom detection of cough syrup bottle.

https://doi.org/10.1371/journal.pone.0298108.t004

Based on the above calculations, the economical imaging schemes are selected as shown in Table 5. Since the 1.3MP sensor size and the 2.3MP sensor size can already meet the actual detection requirements, the use of the 2.3MP sensor with higher total number of pixels, resulting in increased costs and increased time for subsequent feature calculations.

thumbnail
Table 5. Feasible imaging solutions for the bottom detection of empty cough syrup bottle.

https://doi.org/10.1371/journal.pone.0298108.t005

4.2.2 Experiment results and discussion.

According to the above two options, the detection models are built separately to clearly image the bottom through the narrow opening, and the results are shown in Fig 9.

thumbnail
Fig 9. Imaging results obtained according to different detection schemes.

(a1) (a2) (b1) (b2) the constructed detection models and the images of the bottom acquired by the 1.3MP camera at the lens focal length condition f = 8mm,12mm; (c1) (c2) (d1) (d2) the constructed detection models and the images of the bottom acquired by the 2.3MP camera at the lens focal length condition f = 8mm,12mm; (b3) (c3) (d3) the detection results of the traditional image processing with the Eqs (15) (16) and (17).

https://doi.org/10.1371/journal.pone.0298108.g009

As the experimental results shown in Fig 9, the different configurations of the above two options can achieve imaging of the bottom from above the bottle opening and clearly image the visible foreign object present at the bottom. Besides, the maximum deviation Δw of the center of the imaging from the center of the bottom is calculated under the conditions of the inspection model satisfying the geometric constraints. It can be seen from this that, for the method in option 1 of f = 12mm, the deviation range between the center of the photo and the center of the bottom is smaller, i.e., when the transmission mechanism produces a large deviation, the bottom information is more easily obscured by the mouth of the bottle. It can also be seen in Fig 9(b2) that the imaging information at the bottom is close to the imaging information at the opening, so that a slight transmission deviation can cause the information at the bottom to be interfered with by the mouth of the bottle. Additionally, in the process of inspecting cough syrup bottles, similar challenges arise due to bottlenecks caused by issues like working distance, lens focal length, and lens target surface, leading to obstructions in the imaging optical path and resulting in problems such as inability to achieve detection accuracy, decreased resolution, and distortion, as illustrated in Fig 10. Employing this solution can still effectively prevent these issues from occurring. Therefore, under the condition of ensuring the height of mechanical installation, the detection model of (a2) (c2) (d2) is preferred. On the one hand, it is possible to meet the test specifications, and on the other hand, it is possible to allow the drive mechanism to have a certain amount of motion error.

thumbnail
Fig 10. Insufficient imaging accuracy.

(a) Inappropriate working distance results in the inability to achieve a detection accuracy of 0.05mm. (b) Inappropriate focal length results in the inability to achieve a detection accuracy of 0.05mm. (c) Due to factors such as working distance or focal length, as well as the imaging chip of the lens, the precision cannot reach 0.05mm.

https://doi.org/10.1371/journal.pone.0298108.g010

4.3 Experiment of GCBDM on the bottle bottom of capsule medicine

4.3.1 Constraints of detection, and calculation of GCBDM.

Further, for the bottom detection of common capsule medicine bottle, its shape can approximate a cylinder with a larger opening and broader imaging constraints compared to the two pharmaceutical packages mentioned above. According to the detection needs, the foreign matters (such as fiber hair, etc.) present at the bottom need to be detected with an accuracy of about 0.1mm. The parameter calculation process based on constraints β<δ,β = p/m, P/M>D1, and w′<w is shown in Fig 11.

thumbnail
Fig 11. Constraints of capsule medicine bottle bottom detection and calculation process of detection model.

https://doi.org/10.1371/journal.pone.0298108.g011

Based on the calculation process of the detection model shown in Fig 11, and the commonly used imaging lens and camera parameters (the initial selection is made according to Eq (18)), the design of the bottle bottom detection model for capsule medicine bottle is shown in Table 6.

thumbnail
Table 6. Magnification calculated based on constraints for different hardware conditions in the bottom detection of capsule medicine bottle.

https://doi.org/10.1371/journal.pone.0298108.t006

Based on the above calculation results, the economical imaging schemes are selected as shown in Table 7.

thumbnail
Table 7. Feasible imaging solutions for the bottom detection of empty capsule medicine bottle.

https://doi.org/10.1371/journal.pone.0298108.t007

4.3.2 Experiment results and discussion.

According to the different configurations in the above two options, the detection models are built to clearly image the bottom through the opening of the bottle, and the results are shown in Fig 12.

thumbnail
Fig 12. Imaging results obtained according to different detection schemes.

(a1) (a2) (b1) (b2) (c1) (c2) (d1) (d2) the constructed detection models and the images of the bottom acquired by the 1.3MP camera at the lens focal length condition f = 6mm,8mm,12mm,16mm; (e1) (e2) (f1) (f2) (g1) (g2) (h1) (h2) the constructed detection models and the images of the bottom acquired by the 2.3MP camera at the lens focal length condition f = 6mm,8mm,12mm,16mm;(a3) (b3) (c3) (d3) (e3) (f3) (g3) (h3) the detection results of the traditional image processing with the Eqs (15) (16) and (17).

https://doi.org/10.1371/journal.pone.0298108.g012

As the experimental results shown in Fig 12, different configurations of the above two options can achieve clear imaging of the bottle bottom. Similarly, the maximum deviation range Δw of the center position of the imaging from the center position of the bottle bottom is calculated under the condition of the detection model satisfying the geometric constraints.

As can be seen, for the configuration in option 1 of f = 16mm and option 2 of f = 16mm, although the imaging can be satisfied with a high working distance, but when the drive mechanism has a large deviation, the imaging information at the bottom is more likely to be obscured by the bottle mouth. And from Fig 12 (d2) (h2), it can be seen that the imaging information of the bottom is close to the imaging information of the bottle mouth, i.e., the center of the photographed picture is slightly deviated from the center of the bottom of the bottle, which will make the information of the bottom interfered by the bottle opening in the imaging optical path. In addition, for the inspection of the capsule medicine bottle in Fig 12 (a2) (b2) (e2) (f2), due to the short focal length of the lens with a large divergence angle, it is possible to simultaneously image the information of the bottom and the information of the inner wall of the bottle on the camera imaging plane during the inspection, thus enabling the detection of the inner wall of the bottle. Moreover, due to the capsule bottles having wider mouths and shorter bodies, the application of the solution proposed in this article can more effectively avoid issues related to working distance, lens focal length, and lens target surface that are common in traditional imaging models, as shown in Fig 13. This allows for more effective avoidance of these issues and better imaging detection.

thumbnail
Fig 13. Imaging situation for an unsuitable plan.

(a) Inappropriate working distance results in the inability to achieve a detection accuracy of 0.05mm. (b) Due to factors such as working distance or focal length, as well as the imaging chip of the lens, the precision cannot reach 0.05mm.

https://doi.org/10.1371/journal.pone.0298108.g013

Similarly, it can be seen from the results that the height of the test should be appropriately reduced under the condition that the height of the mechanical installation is allowed to ensure sufficient imaging size of the bottom of the bottle. On the one hand, it ensures sufficient imaging size of the bottle bottom, and on the other hand, it can give a certain motion error to the drive mechanism.

5 Conclusion

This paper takes the bottom detection of plastic LVP empty bottle as the research object. Its bottle shape has irregular characteristics, as well as the characteristic of the narrow bottle opening, and its detection accuracy is much higher than the traditional bottle bottom detection requirements. The existing inspection methods cannot establish a universal visual inspection model based on its inspection accuracy, the shape of the inspected bottle and the inspection field of view. In order to ensure the effectiveness of the imaging optical path, this paper proposes a geometric constraint-based detection model (GCBDM), according to the requirements of the detection accuracy (imaging accuracy) and detection field of view, combined with the imaging model and the shape characteristics of the bottle to be detected, to complete the imaging model design and optimization of the bottle bottom. Moreover, based on the above generic detection model, it can be adapted to different detection needs by easily modifying the target parameters for different application scenarios. In addition, by calculating the maximum deviation range of the imaging center position and the center position of the bottle bottom to be detected, it can provide a basis for the design of the accuracy of the transmission structure in the detection, to ensure that in the motion detection, the error of the transmission will not cause the bottle bottom information in the imaging optical path to be obscured by the narrow bottle opening, so as to ensure the stability of the detection. Moreover, the geometric constraint-based detection model (GCBDM) proposed in this paper not only surpasses traditional bottle bottom detection requirements in terms of detection accuracy but also exhibits significant improvements in detection speed, stability, and adaptability to detection environments compared to traditional detection methods. With only appropriate adjustments to the system’s parameters, the GCBDM detection model designed in this article can be fully applicable to different industrial scenarios. For example, some large domestic intravenous infusion manufacturers have already applied the model proposed in this article to their actual production processes. However, some smaller-scale enterprises might still opt for manual inspection due to cost considerations. The GCBD detection model designed in this paper, with minor parameter adjustments, can not only be applied in the medical industry for detecting the bottom of bottles but also has great potential for widespread application in fields like the bottom detection of liquor bottles and perfume bottles.

Supporting information

S1 File. Principle of image preprocessing algorithm.

https://doi.org/10.1371/journal.pone.0298108.s001

(DOCX)

References

  1. 1. Commission CP. Chinese Pharmacopoeia. Beijing, China: China Medical Science Press; 2020.
  2. 2. Langille S. E. Particulate matter in injectable drug products. Pda Journal of Pharmaceutical Science & Technology. 2013;67(3):186–200. pmid:23752747
  3. 3. Hui Z, Li X, Hang Z, Yang Y, Wang Y. Automated Machine Vision System for Liquid Particle Inspection of Pharmaceutical Injection. IEEE Transactions on Instrumentation and Measurement. 2018;67(99):1278–97.
  4. 4. Lu J, Wang YN, Zhang J, Zhou BW, editors. On-line detection of foreign substances in glass bottles filled with transfusion solution through computer vision. International Conference on Information & Automation; 2008.
  5. 5. Zhou B, Wang Y, Ji G, Hui Z, editors. A Machine Vision Intelligent Inspector for Injection. Workshop on Computational Intelligence & Industrial Application; 2008.
  6. 6. Lu G, Zhou Y, Yu Y, Du S. A Novel Approach for Foreign Substances Detection in Injection Using Clustering and Frame Difference. Sensors (Basel, Switzerland). 2011;11(10). pmid:22163686
  7. 7. Feng M, Wang Y, Wu C, editors. Foreign Particle Inspection for Infusion Fluids via Robust Dictionary Learning. 2015 10th International Conference on Intelligent Systems and Knowledge Engineering (ISKE); 2016.
  8. 8. A System for Automated Detection of Ampoule Injection Impurities. IEEE Transactions on Automation Science and Engineering. 2015;14.
  9. 9. Huibregtse D, Fradley JM, Driscoll JA. Glass container inspection machine with a graphic user interface. Google Patents; 2016.
  10. 10. corp H. HEUFT InLine, Covering everything: a continuous inspection of pharmaceutical primary packaging. 2021. Available from: https://heuft.com/en/product/pharma/pharma-empty-containers/empty-container-inspection-heuft-inline-pharma.
  11. 11. corp K. Empty-container inspector with Deep Learning technology 2022. Available from: https://www.krones.com/en/products/machines/linatronic-ai-empty-bottle-inspector-with-deep-learning-technology.php.
  12. 12. Gross KA, Kupinski MA, Hesterman JY, editors. A fast model of a multiple-pinhole SPECT imaging system. Medical Imaging 2005: Image Perception, Observer Performance, and Technology Assessment; 2005: SPIE.
  13. 13. Sile Ma BH, He Yinzhou, Jinchen Wang, Jinfeng Yang. Implementation of Fast Positioning for the Bottom of Bottle in Intelligent Empty Bottle Inspection System. Process Automation Instrumentation. 2012;33(10):39–41.
  14. 14. Tan G, Dong XL, Ji XU, Wang Q. Defect Detection of Empty Bottle Surface Based on Machine-Vision. Journal of Shanghai University of Engineering Science. 2009.
  15. 15. Xiao-Hu HE. Empty bottle inspection method to realize image acquisition technology based on computer vision. Food & Machinery. 2016.
  16. 16. Zheng Y, Wang Y, Zhou X, Jiang X, Peng Y, Liu Y. Empty bottle texture area defect detection based on POBT. Journal of Electronic Measurement and Instrumentation. 2017.
  17. 17. Feng D, Wang YN, Liu HJ, Li YG. A machine vision inspector for beer bottle. Engineering Applications of Artificial Intelligence. 2007;20(7):1013–21.
  18. 18. Liu H, Wang Y, Feng D, editors. An Empty Bottle Intelligent Inspector Based on Support Vector Machines and Fuzzy Theory. World Congress on Intelligent Control & Automation; 2006.
  19. 19. Sharma S, Vinaya KK, Gandhi R, Jain A, Shah N. Empty and filled bottle inspection system. ICTACT Journal on Image and Video Processing. 2015;06(2):1122–6.
  20. 20. Huang B, Ma S, Wang P, Wang H, Yang J, Guo X, et al. Research and implementation of machine vision technologies for empty bottle inspection systems. 2018:S2215098617310194.
  21. 21. Baldwin LB. Device for optimally illuminate bottles for bottom inspection. Google Patents; 1995.
  22. 22. Hall BL, Baldwin LB. Machine for inspecting the bottom of glass containers. Google Patents; 1994.
  23. 23. Shafait F, Imran SM, Klette-Matzat S, editors. Fault detection and localization in empty water bottles through machine vision. E-Tech 2004; 2004.
  24. 24. Zhou X, Wang Y, Zhu Q, Mao J, Xiao C, Lu X, et al. A Surface Defect Detection Framework for Glass Bottle Bottom Using Visual Attention Model and Wavelet Transform. IEEE Transactions on Industrial Informatics. 2020;16(4):2189–201.
  25. 25. Koodtalang W, Sangsuwan T, Sukanna S, editors. Glass Bottle Bottom Inspection Based on Image Processing and Deep Learning. Research, Invention, and Innovation Congress.
  26. 26. Yoshida H. Bottle bottom inspection apparatus. US; 1990.
  27. 27. Tennakoon SG, Raupp HF. Container inspection machine. Google Patents; 2004.
  28. 28. Ma S, Huang B, Wang H, Guo J, editors. Algorithm research on location of bottle mouth and bottom in intelligent empty bottle inspection system. Automation and Logistics, 2009 ICAL ’09 IEEE International Conference on; 2009.
  29. 29. Feng B, Guo SX, Zhang FL, Zhu CJ, Lei W, editors. Binary-channel can covers defects detection system based on machine vision. IEEE; 2012.
  30. 30. Chen T, Wang Y, Xiao C, Wu Q. A Machine Vision Apparatus and Method for Can-End Inspection. IEEE Transactions on Instrumentation and Measurement. 2016;65(9):1–12.
  31. 31. Zhou X, Wang Y, Zhu Q, Liu X, Chen T. Machine vision based automatic apparatus and method for surface defect detection(WCICA2018). 2018.