Container multi-angle imaging quality detection method and system
Through multi-spectral differential refractive calibration and light propagation path model, the problem of image distortion in transparent container multi-angle imaging is solved, and efficient defect detection is achieved.
Patent Information
- Application Number
- CN202510483159.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-07-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing transparent container multi-angle imaging quality detection technology, it is difficult to accurately detect defects due to image distortion and displacement due to optical path refraction.
Multi-spectral differential refraction calibration acquisition is used to record image displacement data under light sources of different wavelengths, build a refractive displacement fingerprint data set, area division and viewing angle weight are calculated, position mapping and distortion compensation are performed through the light propagation path model, and defect detection is performed in combination with the regional adaptive fusion algorithm.
Accurate alignment and fusion of multi-view images is achieved, the accuracy and reliability of defect detection are improved, and the interference of transparent container refractive effect is reduced.
Smart Images

Figure CN120275398A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of quality inspection, and particularly to a method and system for multi-angle imaging quality inspection of containers. Background Art
[0002] In industries such as beverages, pharmaceuticals, and cosmetics, the quality inspection of transparent and semi-transparent containers is a key link to ensure product safety and quality. Existing container quality inspection methods usually use multiple high-resolution cameras to simultaneously capture containers from different angles, and detect defects on the surface and inside of the containers through image processing and analysis. However, due to the characteristics of transparent containers, when light passes through the container wall, refraction occurs, resulting in distortion and displacement of the defect images on the container surface and inside, and this refraction effect is inconsistent at different viewing angles and different container parts. Especially in the high-curvature area or the area where the wall thickness changes of the container, the refraction effect is more significant, making it difficult to accurately align and fuse the images obtained from multiple perspectives, seriously affecting the accuracy of defect detection. Summary of the Invention
[0003] The main objective of the present invention is to solve the technical problem in the existing multi-angle imaging quality inspection technology for transparent containers that due to the refraction of the light path, image distortion and displacement occur, resulting in inaccurate detection of multi-view images; The first aspect of the present invention provides a method for multi-angle imaging quality inspection of containers, and the method for multi-angle imaging quality inspection of containers includes: Performing multi-spectral differential refraction calibration acquisition on a target container, illuminating and imaging the target container from multiple preset perspectives using light sources with different wavelengths, recording image displacement data under the illumination of light sources with different wavelengths, and obtaining a refraction displacement fingerprint data set; According to the refraction displacement fingerprint data set, dividing the surface of the target container into regions, and calculating the refraction influence degree of each region at different perspectives to obtain a region perspective weight distribution map; According to the region perspective weight distribution map, performing optical path reverse tracing processing on the images collected from each perspective, constructing a light propagation path model, and using the light propagation path model to perform position mapping and distortion compensation on the pixel points in the images to obtain corrected images; According to the corrected images and the region perspective weight distribution map, using a region adaptive fusion algorithm to perform defect detection on the target container to obtain detection data containing defect information.
[0004] Optionally, in the first implementation manner of the first aspect of the present invention, the performing multi-spectral differential refraction calibration acquisition on a target container, illuminating and imaging the target container from multiple preset perspectives using light sources with different wavelengths, recording image displacement data under the illumination of light sources with different wavelengths, and obtaining a refraction displacement fingerprint data set includes: Pre-implant dot array fiducial marks on the surface of the target container, and sequentially illuminate the target container with narrowband light sources having multiple preset central wavelengths at multiple preset incident angles; Record the position coordinates of each fiducial mark in the dot array fiducial marks under the illumination of each narrowband light source during sequential illumination; Calculate the position offset of each fiducial mark under the illumination of light sources with different wavelengths based on the position coordinates, and establish a position offset vector field of the fiducial marks according to the position offset; Construct the refraction displacement fingerprint data set according to the relative position relationship between the position offset vector field and the surface of the target container.
[0005] Optionally, in the second implementation manner of the first aspect of the present invention, the region division of the surface of the target container is performed according to the refraction displacement fingerprint data set, and the refraction influence degree of each region at different viewing angles is calculated to obtain a region-viewing angle weight distribution map, including: Calculate the displacement difference degree between each fiducial mark and its adjacent fiducial mark according to the refraction displacement fingerprint data set, and perform an initial region division on the surface of the target container based on the displacement difference degree to obtain an initial region division result; Calculate the mean and variance of the refraction displacement of the fiducial marks inside each initial region of the initial region division result according to the refraction displacement fingerprint data set, and adaptively adjust the initial region according to the mean and variance of the refraction displacement to obtain a target region division result, where the target region division result includes multiple regions; Calculate the refraction influence coefficient at different viewing angles according to the refraction displacement fingerprint data in each region, and assign a corresponding viewing angle weight value to each region according to the refraction influence coefficient; Integrate the target region division result and the viewing angle weight value corresponding to each region into the region-viewing angle weight distribution map of the surface of the target container.
[0006] Optionally, in the third implementation manner of the first aspect of the present invention, the calculating the refraction influence coefficient at different viewing angles according to the refraction displacement fingerprint data in each region, and assigning a corresponding viewing angle weight value to each region according to the refraction influence coefficient includes: Sort the refraction displacement fingerprint data in each region according to spatial coordinates, and use the least squares method to fit to obtain a refraction displacement surface function within the region. Calculate the gradient and curvature of the refraction displacement surface function to obtain region refraction feature data; Calculate the normal vector of each point on the surface of the target container using the gradient of the refraction displacement surface function, and calculate the angle between the viewing direction of each viewing angle and the normal vector according to the normal vector and the region refraction feature data; Combining the included angle, the gradient and the curvature of the refraction displacement surface, an initial refraction influence coefficient is obtained; Using the spatial distribution density of the marked points within the region to perform weighted averaging on the initial refraction influence coefficient, and performing normalization processing on the weighted averaging result, a corrected refraction influence coefficient for each region under each viewing angle is obtained; When the corrected refraction influence coefficient of the viewing angle in the region is greater than a preset weight threshold, the weight value of the corresponding viewing angle is set to the logarithm of the corrected refraction influence coefficient; when it is less than the weight threshold, the weight value of the corresponding viewing angle is set to zero, obtaining the viewing angle weight values corresponding to each region.
[0007] Optionally, in the fourth implementation manner of the first aspect of the present invention, the performing optical path backward tracing processing on the images collected from each viewing angle according to the region viewing angle weight distribution map, constructing a light ray propagation path model, and using the light ray propagation path model to perform position mapping and distortion compensation on the pixel points in the image to obtain a corrected image includes: According to the material parameters and shape characteristics of the target container, a basic equation set for light ray propagation is established for each region; Combining the viewing angle weight values in the region viewing angle weight distribution map with the basic equation set to construct a light ray propagation path model including weight factors; According to the light ray propagation path model, calculate the light ray incident path and refraction path corresponding to each pixel point in the images collected from each viewing angle; Based on the light ray incident path and refraction path, calculate the spatial position mapping relationship of the pixel points, and use the spatial position mapping relationship to correct the images collected from each viewing angle to obtain a corrected image.
[0008] Optionally, in the fifth implementation manner of the first aspect of the present invention, the calculating the spatial position mapping relationship of the pixel points based on the light ray incident path and refraction path, and using the spatial position mapping relationship to correct the images collected from each viewing angle to obtain a corrected image includes: Using the light ray incident path and refraction path, combining the container wall thickness distribution data of the target container, calculate the incident angle and exit angle of the light ray on the front and back surfaces of the target container, and establish an optical intensity transmission equation considering multi-layer refraction; Substitute the optical intensity transmission equation into the refractive index function of different wavelengths, and calculate the spatial propagation path and energy attenuation coefficient of the light rays of each wavelength; According to the spatial propagation path and energy attenuation coefficient, establish a spatial position mapping matrix and an optical intensity compensation matrix for the pixel points; For each pixel point in the images collected from each viewing angle, perform position correction using the spatial position mapping matrix and perform optical intensity compensation using the optical intensity compensation matrix to obtain the corrected image.
[0009] Optionally, in the sixth implementation manner of the first aspect of the present invention, the defect detection of the target container by using the regional adaptive fusion algorithm according to the corrected image and the regional perspective weight distribution map, and obtaining the detection data including defect information includes: In each region, extract the regional image feature matrix in the corrected image, and construct a feature description vector reflecting the regional feature distribution according to the regional image feature matrix; Calculate the weight adaptive coefficient of each region according to the regional perspective weight distribution map, and the weight adaptive coefficient is proportional to the variance of the perspective weight values in the region; Use the weight adaptive coefficient to construct a regional adaptive fusion function, and dynamically adjust the fusion parameters according to the uniformity of the regional feature distribution; Apply the regional adaptive fusion function to the feature description vector, generate a fusion feature map, and perform threshold segmentation and feature clustering on the fusion feature map to obtain the detection data.
[0010] The second aspect of the present invention provides a container multi-angle imaging quality detection system, and the container multi-angle imaging quality detection system includes: A calibration acquisition module, configured to perform multi-spectral differential refraction calibration acquisition on a target container, illuminate and image the target container from multiple preset perspectives by using light sources with different wavelengths, record image displacement data under the illumination of light sources with different wavelengths, and obtain a refraction displacement fingerprint data set; A region division module, configured to divide the surface of the target container according to the refraction displacement fingerprint data set, and calculate the refraction influence degree of each region at different perspectives to obtain a regional perspective weight distribution map; An image correction module, configured to perform optical path backward tracking processing on the images collected from each perspective according to the regional perspective weight distribution map, construct a light propagation path model, and perform position mapping and distortion compensation on the pixel points in the image by using the light propagation path model to obtain a corrected image; A defect detection module, configured to perform defect detection on the target container by using the regional adaptive fusion algorithm according to the corrected image and the regional perspective weight distribution map, and obtain detection data including defect information.
[0011] The above-mentioned method and system for detecting the multi-angle imaging quality of a container illuminate and image a target container from multiple preset perspectives using light sources of different wavelengths to obtain a refractive displacement fingerprint dataset; then divide the container surface into regions according to the dataset, calculate the refractive influence degree of each region at different perspectives, and generate a regional perspective weight distribution map; then use this distribution map to perform optical path reverse tracking processing on the images collected from each perspective, construct a ray propagation path model, perform position mapping and distortion compensation to obtain corrected images; finally, according to the corrected images and the regional perspective weight distribution map, use a regional adaptive fusion algorithm to perform defect detection. Through technical means such as regional adaptive division, optical path reverse tracking, and regional adaptive fusion, the present invention enables multi-perspective images to be accurately aligned and fused, while taking into account the observation characteristics of different regions, ensuring the reliability of the defect detection results.
[0012] Other features and advantages of the present invention will be described in the following specification, and in part will be obvious from the specification, or will be understood by implementing the present invention. The objectives and other advantages of the present invention are achieved and obtained by the structures specifically pointed out in the specification, claims, and drawings.
[0013] To make the above objectives, features, and advantages of the present invention more obvious and understandable, the following specifically enumerates preferred embodiments and, in conjunction with the accompanying drawings, details are described as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 It is a schematic diagram of the first embodiment of the method for detecting the multi-angle imaging quality of a container in an embodiment of the present invention; Figure 2 It is a schematic diagram of an embodiment of the system for detecting the multi-angle imaging quality of a container in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0015] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
[0016] The terms "including" and "having" and any variations thereof mentioned in the embodiments of the present invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes other steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products, or devices.
[0017] To facilitate the understanding of this embodiment, first, a method for detecting the imaging quality of a container from multiple angles disclosed in the embodiments of the present invention will be introduced in detail. As Figure 1 shown, this method includes the following steps: 101. Perform multi-spectral differential refraction calibration acquisition on the target container. Use light sources with different wavelengths to illuminate and image the target container from multiple preset perspectives, record the image displacement data under the illumination of light sources with different wavelengths, and obtain a refraction displacement fingerprint dataset; In an embodiment of the present invention, the step of performing multi-spectral differential refraction calibration acquisition on the target container, using light sources with different wavelengths to illuminate and image the target container from multiple preset perspectives, recording the image displacement data under the illumination of light sources with different wavelengths, and obtaining a refraction displacement fingerprint dataset includes: pre-implanting a dot array of marking points on the surface of the target container, and using narrowband light sources with multiple preset central wavelengths to sequentially illuminate the target container at multiple preset incident angles; recording the position coordinates of each marking point in the dot array of marking points under the illumination of each narrowband light source during sequential illumination; calculating the position offset of each marking point under the illumination of light sources with different wavelengths based on the position coordinates, and establishing a position offset vector field of the marking points according to the position offset; constructing the refraction displacement fingerprint dataset according to the relative position relationship between the position offset vector field and the surface of the target container.
[0018] Specifically, the process of performing multi-spectral differential refraction calibration acquisition on the target container first requires pre-implanting a dot array of marking points on the surface of the target container. These marking points are usually made of materials that will not have a significant impact on the function and appearance of the container. For example, micro dots with a diameter of 0.2 mm are arranged in a regular grid of 5 mm × 5 mm on the surface of the container. For PET beverage bottles, these marking points can be formed by micro-engraving with a mold during the blow molding process; for glass containers, laser micro-etching technology can be used to form fine concavities and convexities on the surface to ensure that the marking points are firmly combined with the container material and will not fall off during subsequent production processes. Special attention should be paid to the layout of the marking points in the high-curvature areas of the container, such as the bottle shoulder, bottleneck, and the transition zone at the bottom of the bottle. The density of the marking points in these areas should be increased accordingly to capture more detailed refraction change information. The shape of the marking points is designed as a circle to maintain the consistency of the shape when observed from different angles, facilitating the precise positioning of their central coordinates.
[0019] Specifically, after the marker points are implanted, narrowband light sources with multiple preset central wavelengths are used to sequentially illuminate the target container at multiple preset incident angles. Specifically, the system is configured with three main narrowband light sources, namely a blue light source with a central wavelength of 450±5nm, a green light source with a central wavelength of 550±5nm, and a red light source with a central wavelength of 650±5nm. The full width at half maximum of each light source is controlled within 10nm to ensure spectral purity and narrowband characteristics. At the same time, these light sources are installed on a robotic arm with precisely controllable angles, enabling precise illumination at three typical incident angles of 15°, 45°, and 75°. The illumination process is automatically executed according to a preset program. First, the incident angle is fixed at 15°, and the blue, green, and red wavelength light sources are sequentially activated to illuminate the entire surface of the container. Then, the incident angle is adjusted to 45°, and the same wavelength sequence illumination is repeated. Finally, the last set of illumination is completed at an incident angle of 75°. The entire illumination process is managed by a high-precision timing control system to ensure that the time interval between each light source switch and angle adjustment is precisely controlled at the millisecond level, avoiding interference from ambient light condition changes on the measurement results.
[0020] Specifically, during the sequential illumination process, the system synchronously records the position coordinates of each marker point in the dot array marker points under the illumination of each narrowband light source through high-resolution cameras configured at different positions. The resolution of these cameras reaches the 4K level, equipped with dedicated macro lenses, and can clearly capture the details of marker points with a diameter of only 0.2mm. The arrangement of the cameras follows the principle of omnidirectional coverage, usually including a top vertical view, multiple side views (at least 8 evenly distributed side views) in a circular distribution, and a bottom upward view, ensuring that each marker point on the container surface can be observed by at least 3 or more cameras simultaneously. Each camera records the current light source parameters (wavelength and incident angle) when collecting images and embeds this information into the image metadata. After the image acquisition is completed, the system uses an image processing algorithm with sub-pixel accuracy to automatically identify the exact position of each marker point in the image and convert it into three-dimensional coordinates in the actual physical space. These coordinate data are timestamped and stored in a dedicated database to form a complete position record of the marker points under different lighting conditions.
[0021] Specifically, based on the recorded position coordinates, the system calculates the position offset of each marked point under the illumination of light sources with different wavelengths, and establishes a position offset vector field of the marked points according to the position offsets. The calculation process first takes the position of the marked point under the condition of 550 nm green light and a 45° incident angle as the reference point, and then calculates the three-dimensional offset vector of the same marked point relative to the reference position under the other eight illumination conditions (combinations of three wavelengths and three incident angles, excluding the reference condition). This calculation is performed independently for each marked point on the surface of the container, obtaining a series of displacement vectors describing the refraction effect under different optical conditions. The system uses a cubic spline interpolation algorithm to construct a continuous displacement field function between adjacent marked points, realizing the conversion from the discrete distribution of marked points to a continuous displacement field. The magnitude and direction of the displacement vector directly reflect the refraction differences of the container material for light with different wavelengths, especially in areas with high curvature, where this difference is particularly significant. For example, in the shoulder area of a PET beverage bottle, the displacement difference generated under the illumination of 450 nm blue light and 650 nm red light can reach more than 0.3 mm, which is much larger than that in other flat areas. These displacement vectors are mathematically processed to form a position offset vector field covering the entire surface of the container, clearly showing the distribution of the refraction characteristics of each area of the container.
[0022] Specifically, according to the relative position relationship between the position offset vector field and the surface of the target container, a refraction displacement fingerprint dataset is constructed. The construction process first aligns and maps the three-dimensional geometric model of the container surface with the position offset vector field to establish an accurate correspondence between the coordinate system of the container surface and the displacement field. Subsequently, the system performs multi-dimensional feature extraction on the displacement field data. These features include the spatial distribution of the displacement magnitude, the change gradient of the displacement direction, the ratio of the displacement differences between different wavelengths, etc. After the feature extraction is completed, the system applies the principal component analysis algorithm to perform dimensionality reduction on these features, retaining the most representative feature combinations to form the "refraction displacement fingerprint" unique to the container. This fingerprint data has uniqueness and distinguishability and can accurately characterize the refraction characteristics of containers with specific materials and specific shapes. The refraction displacement fingerprint dataset is stored in a structured form, including the surface mesh division information of the container, the displacement feature vector of each grid unit, the principal component representation of the feature vector, and the spatio-temporal variation law of the displacement field. In addition, the dataset also records auxiliary information such as the container material parameters, wall thickness distribution, and environmental parameters.
[0023] 102. According to the refraction displacement fingerprint dataset, divide the surface of the target container into regions, and calculate the degree of refraction influence of each region from different perspectives to obtain a regional perspective weight distribution map; In an embodiment of the present invention, the process of dividing the surface of the target container according to the refraction displacement fingerprint dataset and calculating the refraction influence degree of each region at different viewing angles to obtain the regional viewing angle weight distribution map includes: calculating the displacement difference degree between each marked point and its adjacent marked point according to the refraction displacement fingerprint dataset, and based on the displacement difference degree, performing an initial regional division on the surface of the target container to obtain an initial regional division result; calculating the mean and variance of the refraction displacements of the marked points within each initial region of the initial regional division result according to the refraction displacement fingerprint dataset, and adaptively adjusting the initial regions according to the mean and variance of the refraction displacements to obtain a target regional division result, where the target regional division result includes multiple regions; calculating the refraction influence coefficients at different viewing angles according to the refraction displacement fingerprint data within each region, and assigning corresponding viewing angle weight values to each region according to the refraction influence coefficients; integrating the target regional division result and the viewing angle weight value corresponding to each region into the regional viewing angle weight distribution map of the surface of the target container.
[0024] Specifically, the process of dividing the surface of the target container according to the refraction displacement fingerprint dataset is first achieved by calculating the displacement difference degree between each marked point and its adjacent marked point. Specifically, the system extracts the displacement feature vector of each marked point from the refraction displacement fingerprint dataset, and this feature vector contains the displacement information of the point under different lighting conditions. For each marked point on the surface of the container, the system identifies its geometrically adjacent marked points, and usually selects 6 - 8 points with the closest Euclidean distance as adjacent points. Subsequently, the system calculates the Euclidean distance between the displacement feature vector of the current marked point and the displacement feature vectors of each adjacent point to obtain a set of difference values reflecting the local displacement changes. These difference values are normalized to form an index describing the refraction non-uniformity around the marked point. For a PET beverage bottle, the marked points at the junction of the bottle neck and the bottle shoulder usually exhibit significantly larger displacement difference values, which reflects the refraction discontinuity caused by the sharp change in shape in this region. The system sets a threshold according to these displacement difference values, marks the boundary points of the regions with difference values greater than the threshold, and forms a preliminary regional dividing line. These dividing lines divide the surface of the container into multiple initial regions, and the marked points within each initial region have relatively consistent refraction displacement characteristics. For a common 500 ml beverage bottle, this step usually divides the surface of the container into five main initial regions: the bottle mouth, the bottle neck, the bottle shoulder, the bottle body, and the bottle bottom, plus some transitional belt regions, for a total of about 8 - 12 initial regions.
[0025] Specifically, after obtaining the initial region division result, the system further calculates the mean and variance of the refraction displacements of the marked points within each initial region based on the refraction displacement fingerprint dataset, and adaptively adjusts the initial regions according to these statistical characteristics. The calculation process first selects all the marked points within each initial region, extracts the set of displacement feature vectors, and calculates the mean vector and covariance matrix of these vectors. The mean vector reflects the overall trend of the refraction displacements within the region, while the covariance matrix describes the complexity of the displacement changes within the region and the main directions of change. The system performs eigenvalue decomposition on the covariance matrix of each initial region to obtain the main patterns of displacement changes and the corresponding change intensities. When the maximum eigenvalue of a certain initial region exceeds the preset threshold, it indicates that there is significant non-uniformity in the displacement changes within this region, and the system will initiate the region subdivision procedure. The region subdivision uses a binary method based on the principal component direction, dividing the original region into two sub-regions along the direction of the maximum change, and then recalculating the statistical characteristics of the sub-regions to examine the segmentation effect. This process is recursively executed until the internal consistency of all regions meets the preset conditions or reaches the maximum subdivision depth. On the contrary, for those small adjacent regions with similar statistical characteristics, the system will perform region merging operations to avoid excessive fragmentation. This adaptive adjustment strategy can accurately capture the spatial distribution law of the refraction characteristics on the container surface, especially for those regions that seemingly appear uniform on the outside but have subtle changes in refraction characteristics, such as the thickness gradient band on a glass bottle body. Through this method, the region boundaries that are difficult to detect by the naked eye can be identified. After the adaptive adjustment, the system obtains the final target region division result. These regions are continuously distributed in space, covering the entire surface of the container, and at the same time, the refraction characteristics within each region have high consistency.
[0026] Specifically, after obtaining the target area division result, the system calculates the refraction influence coefficients at different viewing angles based on the refraction displacement fingerprint data within each area, and assigns corresponding viewing angle weight values to each area based on these coefficients. The calculation process first constructs a regional geometric feature model for each area, including the central position, normal vector distribution, and curvature distribution of the area. Subsequently, the system combines these geometric features with the previously collected multi-angle imaging data to analyze the geometric conditions of each viewing angle for observing the area. For each area and viewing angle combination, the system calculates the angle distribution between the incident light and the surface normal vector of the area, as well as the angle distribution between the observed light and the area normal vector. These angle information are combined with the refraction characteristic data of the area to construct a mathematical model describing the refraction influence of the area at a specific viewing angle. The calculation of the refraction influence coefficient comprehensively considers various factors such as the incident angle, observation angle, material refractive index, and area geometry, forming a quantitative index reflecting the degree of image distortion of a specific area at a specific viewing angle. In actual calculation, for high-curvature areas, such as the shoulder transition zone of a beverage bottle, when the observation angle is close to the grazing angle, the refraction influence coefficient often increases significantly, reflecting the severe image distortion under such conditions. The system assigns weight values to each area at each viewing angle based on the calculated refraction influence coefficients, combined with image quality indicators such as signal-to-noise ratio. The weight assignment principle is that the viewing angles with smaller refraction influence and higher image quality obtain higher weights, while those viewing angles that cause image distortion due to severe refraction distortion are given lower weights or completely excluded. This weight assignment mechanism ensures that the most reliable viewing angle data can be preferentially used in the subsequent image processing process.
[0027] Specifically, the system integrates the target area division result and the perspective weight value corresponding to each area into the area perspective weight distribution map on the surface of the target container. In the integration process, a three-dimensional grid model of the container surface is first established, which usually uses triangular grids or quadrilateral grids to represent the complete geometric shape of the container. Subsequently, the previously obtained area division result is mapped onto this grid model, and each grid cell is labeled with the area number it belongs to. For each area, the calculated perspective weight values of different perspectives are associated with the area number, forming a multi-dimensional data structure. This data structure contains spatial position information, area classification information, and multi-perspective weight information, and can intuitively display the observation reliability distribution of each part of the container surface from different perspectives. For the convenience of visualization and subsequent processing, the system usually generates a heat map representation of the area perspective weight, using different shades of color to represent the magnitude of the weight value. For example, for a typical transparent PET bottle, in the side perspective weight distribution map, the middle area of the bottle body shows a high-weight color (indicating reliable side perspective observation), while the bottle mouth and bottom areas show low-weight colors (indicating unreliable side perspective observation). This intuitive representation method not only facilitates technicians to understand and debug the system, but also provides a clear weight reference for subsequent image processing. The finally generated area perspective weight distribution map is stored in digital form and becomes a key data set for guiding the subsequent light path reverse tracing and image correction processes. This distribution map integrates various information such as the container geometry, material optical properties, and multi-angle imaging system configuration, and comprehensively characterizes the optical properties of a specific container in a multi-angle detection environment.
[0028] Further, calculating the refraction influence coefficient at different perspectives according to the refraction displacement fingerprint data in each area, and assigning the corresponding perspective weight value to each area according to the refraction influence coefficient includes: sorting the refraction displacement fingerprint data in each area according to the spatial coordinates, and using the least squares method to fit to obtain the refraction displacement surface function in the area, and calculating the gradient and curvature of the refraction displacement surface function to obtain the area refraction characteristic data; calculating the normal vector of each point on the surface of the target container using the gradient of the refraction displacement surface function, and calculating the angle between the observation direction of each perspective and the normal vector according to the normal vector and the area refraction characteristic data; combining the angle, the gradient, and the curvature of the refraction displacement surface to obtain the initial refraction influence coefficient; weighting and averaging the initial refraction influence coefficient using the spatial distribution density of the marked points in the area, and normalizing the weighted average result to obtain the corrected refraction influence coefficient of each area at each perspective; when the corrected refraction influence coefficient of the perspective in the area is greater than the preset weight threshold, setting the weight value of the corresponding perspective to the logarithm of the corrected refraction influence coefficient, and when it is less than the weight threshold, setting the weight value of the corresponding perspective to zero, to obtain the perspective weight values corresponding to each area.
[0029] Specifically, in the process of calculating the refraction influence coefficient at different viewing angles based on the refraction displacement fingerprint data in each region, it is first necessary to sort the refraction displacement fingerprint data in each region according to the spatial coordinates. The system extracts the three-dimensional spatial coordinates and corresponding displacement vector data of all marked points in the target region from the database, and organizes these data points using a spatial indexing method based on an octree, so that the data points are arranged according to their positional relationships in the three-dimensional space. This sorting method ensures the spatial continuity of the data points, which is conducive to subsequent surface fitting processing. After sorting, the system uses the least squares method to perform multivariate surface fitting on the refraction displacement data in the region. Specifically, for each region, the system selects a suitable set of basis functions to represent the refraction displacement surface. Commonly used basis functions include bicubic spline functions, radial basis functions, or polynomial functions. For container regions with complex geometries, such as the bottle shoulder or the bottom edge of the bottle, higher-order basis functions are usually selected to capture complex displacement changes; while for regions with relatively simple geometries, such as the cylindrical part of the bottle body, lower-order basis functions can be used to improve the calculation efficiency. The system determines the coefficients of the basis functions by minimizing the sum of squared residuals, and obtains the best-fitting refraction displacement surface function. This surface function is a function of the spatial coordinates, which can interpolate and predict the refraction displacement at any position in the region, fill in the data gaps between the marked points, and form a continuous displacement field description.
[0030] Specifically, after obtaining the refraction displacement surface function, the system obtains the regional refraction characteristic data by calculating the gradient and curvature of this function. The gradient calculation uses the numerical differentiation method. A series of points are evenly sampled on the surface function, and the partial derivative vectors at each point are calculated. These vectors constitute the gradient field that describes the displacement change rate and direction. At the same time, the system calculates the second derivative of the surface function, constructs the Hessian matrix, and calculates the principal curvature values and principal curvature directions through this matrix. These data reflect the acceleration and main change patterns of the refraction displacement change in the region. The gradient field and curvature information are combined to form comprehensive regional refraction characteristic data. These data not only describe the intensity of the refraction effect in the region, but also characterize the spatial change trend of the refraction effect. For example, for the bottleneck region of a PET beverage bottle, the gradient of the refraction displacement surface is usually larger in the direction perpendicular to the bottle axis, reflecting the strong refraction effect caused by the radial change of the geometry at the bottleneck; while in the bottle body part, the gradient value is relatively small and evenly distributed, indicating that the refraction effect in this region is relatively stable. These characteristic data provide an objective mathematical basis for subsequent evaluation of the observation effects at different viewing angles.
[0031] Specifically, using the gradient information of the refraction displacement surface function, the system further calculates the normal vectors of each point on the surface of the target container, and calculates the angle between the observation direction of each viewing angle and the normal vector based on these normal vectors and the regional refraction characteristic data. The normal vector calculation is based on the principles of differential geometry. For each point on the refraction displacement surface, its normal vector is orthogonal to the gradient vector of the surface at that point. The system converts the normal vector into a unit vector through normalization to form a normal vector field covering the area. Subsequently, the system converts multiple preset observation viewing angles into direction vectors in three-dimensional space, and calculates the angle between each observation direction and the normal vector of each point. This calculation uses the vector dot product formula to obtain an angle value that measures the matching degree between the observation direction and the surface orientation. A smaller angle value indicates that the observation direction is close to the surface normal direction, and theoretically, a better observation effect can be obtained; while a larger angle value indicates that the observation direction is close to the surface tangent direction, and the observation quality is usually poor. The system combines the previously obtained regional refraction characteristic data, especially the refractive index and curvature information, to correct these angle values, considering the influence of the refraction effect on the observation path. For example, when the surface curvature of a transparent container is large, even if the observation angle is small, image distortion may occur due to the strong refraction effect, which is fully considered in the calculation model of the system.
[0032] Specifically, combining the observation angle, as well as the gradient and curvature information of the refraction displacement surface, the system constructs a mathematical model to calculate the initial refraction influence coefficient. This calculation process uses a multi-factor weighting method, mainly considering four key factors: the cosine value of the observation angle, the modulus value of the refraction displacement gradient, the principal curvature value of the surface, and the material refractive index. The cosine value of the observation angle reflects the matching degree between the viewing angle and the surface orientation. The closer the cosine value is to 1, the closer the viewing angle is to the normal direction, and the higher the initial score. The modulus value of the refraction displacement gradient represents the severity of the refraction change in the area. The larger the gradient value, the more significant the refraction effect, and the lower the initial score. The principal curvature value of the surface reflects the non-linearity of the refraction change. The larger the curvature, the more complex the spatial change of the refraction effect, and the lower the initial score. The material refractive index directly reflects the basic intensity of the light deflection when passing through the material. The higher the refractive index, the stronger the refraction effect, and the lower the initial score. The system generates the initial refraction influence coefficient by weighting and combining these factors. This coefficient is a dimensionless value, theoretically ranging from 0 to 1. The closer the value is to 1, the less the observation of a specific area from a specific viewing angle is affected by refraction, and the better the image quality is theoretically. For example, for the middle part of the body of a PET bottle, when observed from a viewing angle perpendicular to the bottle wall, a high initial coefficient close to 0.9 can usually be obtained; while for the high-curvature area of the bottle shoulder, even when observed from the best viewing angle, the initial coefficient may only be about 0.5, reflecting the severe refraction interference in this area.
[0033] Specifically, after obtaining the initial refraction influence coefficient, the system also needs to consider the spatial distribution density of the marked points in the area to correct the result. The spatial distribution density reflects the sampling sufficiency of the original data. The higher the density, the more reliable the fitted surface function, and the more accurate the corresponding refraction influence assessment. The system uses the kernel density estimation method to calculate the marked point distribution density of each part in the area and generates a density weight map. Subsequently, the system uses this density weight map to perform weighted averaging on the initial refraction influence coefficient. The specific method is to uniformly sample multiple points in the area, and the weight of each point is proportional to the marked point density at its position. The overall average refraction influence coefficient of the area is calculated through these weighted sample points. This weighting process effectively increases the contribution weight of the data-rich area, reduces the influence of the data-sparse area, and enhances the reliability of the evaluation result. After the weighted averaging is completed, the system normalizes the result to ensure the comparability of the refraction influence coefficients between different areas and different perspectives. The normalization process uses the linear mapping method to map all the corrected refraction influence coefficients to the range of 0-1 to form the final corrected refraction influence coefficients. These correction coefficients comprehensively reflect various factors such as the regional geometric shape, material properties, observation perspective, and data reliability, providing an objective basis for the perspective weight assignment.
[0034] Specifically, after obtaining the corrected refraction influence coefficients of each area under different perspectives, the system determines the final perspective weight values according to the preset weight threshold. This processing follows the principle of non-linear mapping. When the corrected refraction influence coefficient of an area under a certain perspective is greater than the preset weight threshold, the system sets the weight value of the corresponding perspective to the logarithm of this correction coefficient. The calculation formula usually uses the logarithm with base 10. The introduction of the logarithmic transformation makes the weight value no longer linearly respond to the change of the refraction influence coefficient, but has a more detailed discrimination in the high coefficient range (that is, the case of small refraction influence). This non-linear mapping strategy emphasizes the importance of the subtle differences between high-quality perspectives, which is beneficial to more precisely controlling the contribution ratio of each perspective during multi-perspective image fusion. When the corrected refraction influence coefficient is less than the preset threshold, the system directly sets the weight value of the corresponding perspective to zero, which means that the image quality under this perspective is not sufficient to provide effective information and will be completely excluded in subsequent processing. The setting of the weight threshold is usually based on experimental verification and can be adjusted according to different types of container materials and detection requirements. The common threshold settings are between 0.3 and 0.5. Through this threshold-based screening and non-linear mapping, the system finally obtains the perspective weight values corresponding to each area. These weight values will be directly used in the subsequent image processing process to guide the system to reasonably utilize the information of each perspective in multi-perspective image fusion and analysis, and minimize the interference of the refraction effect of the transparent container on quality detection.
[0035] 103. According to the regional perspective weight distribution map, perform optical path reverse tracing processing on the images collected from each perspective, construct a light propagation path model, and use the light propagation path model to perform position mapping and distortion compensation on the pixel points in the images to obtain a corrected image; In an embodiment of the present invention, the performing optical path reverse tracing processing on the images collected from each perspective according to the regional perspective weight distribution map, constructing a light propagation path model, and using the light propagation path model to perform position mapping and distortion compensation on the pixel points in the images to obtain a corrected image includes: establishing a basic light propagation equation set for each region according to the material parameters and shape characteristics of the target container; combining the perspective weight values in the regional perspective weight distribution map with the basic light propagation equation set to construct a light propagation path model including weight factors; according to the light propagation path model, calculating the light incident path and refraction path corresponding to each pixel point in the images collected from each perspective; based on the light incident path and refraction path, calculating the spatial position mapping relationship of the pixel points, and using the spatial position mapping relationship to correct the images collected from each perspective to obtain a corrected image.
[0036] Specifically, establishing a basic light propagation equation set for each region according to the material parameters and shape characteristics of the target container is the primary task of performing optical path reverse tracing. The system first extracts the material optical parameters of the target container from the material database, and these parameters include refractive index data, absorption coefficient, and dispersion coefficient of light with different wavelengths, etc. Taking a common PET beverage bottle as an example, its refractive index is about 1.5 - 1.6 in the visible light spectrum range and shows a non-linear relationship with the wavelength, and this non-linear relationship is usually described by the Cauchy equation or the Sellmeier equation. At the same time, the system extracts accurate geometric information from the CAD model or three-dimensional reconstruction result of the container, including the parametric representation of the container surface and the wall thickness distribution data. For containers with complex geometric shapes, such as the bottom of a bottle with pressure dispersion ribs or a threaded bottle mouth, the system uses a refined triangular mesh or NURBS surface representation to ensure geometric accuracy. Combining the material parameters and geometric information, the system establishes a basic light propagation equation set for each previously divided region. These equation sets are based on the principles of geometric optics and mainly include Snell's law of refraction, Fresnel reflection formula, and the principle of the shortest optical path. The equation sets associate the direction vector of the incident light, the normal vector of the container surface, the refractive index of the material, and the propagation path of the light inside and outside the container to form a mathematical model describing the propagation law of light in a transparent container. For special structures of the container, such as the double-wall region or the place where the thickness changes sharply, the equation sets also need to consider complex optical phenomena such as multiple refractions and internal reflections, which requires the use of a more refined segmented light propagation model in these regions.
[0037] Specifically, after establishing the basic equation set, the system combines the perspective weight values in the regional perspective weight distribution map with the basic equation set to construct a light propagation path model containing weight factors. In this combination process, the system first determines the observation weights of each region at each perspective, and then adjusts the parameter sensitivity and calculation accuracy of the light propagation model according to these weights. In terms of specific implementation, the system adopts an adaptive precision control strategy, using a finer calculation grid and stricter numerical solution conditions for high-weight perspective regions to ensure high precision of the model in these key regions; while for low-weight perspective regions, the calculation precision can be appropriately reduced to improve efficiency. At the same time, the system incorporates the perspective weight information into the sampling strategy of the ray tracing algorithm, using denser ray sampling in high-weight regions and reducing the sampling density in low-weight regions. This weight-oriented calculation resource allocation ensures the balance between calculation efficiency and accuracy. In addition, the system also uses the perspective weight information to optimize the search algorithm for the light propagation path. For combinations of high-weight perspectives and regions, a more accurate but computationally intensive global light path search method is adopted; while for low-weight combinations, an approximate but efficient local search method is used. Through this multi-level weight fusion strategy, a light propagation path model containing weight factors is formed. This model not only retains the accuracy of the basic optical principles but also introduces an optimization mechanism based on actual observation conditions, and can provide more accurate light path predictions for the special optical properties of transparent containers.
[0038] Specifically, based on the constructed light propagation path model, the system begins to calculate the incident and refraction paths of light corresponding to each pixel in the images collected from each perspective. This calculation uses the reverse ray tracing method, that is, starting from the camera sensor, passing through the lens system, projecting light into the observation space, and tracing the intersection points of these lights with the container surface and the subsequent propagation paths. For each pixel, the system first calculates the initial light direction from the camera center to this pixel according to the internal and external parameters of the camera, and then uses the previously established light propagation path model to predict the intersection point of this light with the container surface. Due to the complex shape of the transparent container, the calculation of the intersection point of the light with the surface usually uses iterative numerical methods, such as Newton's method or the bisection method, to ensure the accuracy of the solution. After obtaining the intersection point, the system calculates the direction of the refracted light using Snell's law based on the surface normal vector and the refractive index of the material at the intersection point. For the container area with multiple layers, the system needs to trace the propagation path of the light inside the container, including possible multiple refractions and reflections, until the light leaves the container or is completely absorbed. The entire calculation process forms a complete light propagation chain, recording the exact light path from the camera to the actual position of the object. For the high curvature area or the area with significant thickness variation of the container, the calculation of the light path usually requires more iterative steps and more refined numerical control to ensure the accuracy of the calculation results. Through this pixel-by-pixel ray tracing calculation, the system finally obtains a complete dataset describing the incident path of light for each pixel and the refraction path in the container, and these data directly reflect the light deflection caused by the transparent container and its impact on image formation.
[0039] Specifically, finally, based on the calculated light incident path and refraction path, the system calculates the spatial position mapping relationship of pixel points, and uses these mapping relationships to correct the images collected from each perspective to obtain corrected images. The spatial position mapping calculation first determines the final direction and intersection position of the light corresponding to each pixel point after passing through the container. These information describe the actual spatial position that the pixel point should have observed without the influence of container refraction. By comparing the difference between this ideal observation position and the actual imaging position, the system establishes a pixel-level spatial position mapping relationship and forms a transformation matrix describing image distortion. This transformation matrix is a direct mathematical expression of the container refraction effect and reflects the degree of interference of the transparent container on the light propagation path. The system uses this mapping relationship to perform geometric correction on the original collected images, mapping each pixel point to its ideal observation position determined by ray tracing. The correction process uses bilinear or bicubic interpolation algorithms for pixel resampling to ensure the continuity and detail retention of the image. For the blank areas that may appear at the image edges, the system applies techniques such as edge extrapolation or mirror filling for processing. In addition, the system also performs light intensity compensation on the images according to the attenuation of light in the container material to eliminate the brightness non-uniformity caused by refraction and internal absorption. Through this series of precise geometric transformations and optical compensations, the system finally obtains the corrected images, in which the shapes and positions of the objects are effectively restored, significantly reducing the visual distortion caused by the refraction effect of the transparent container.
[0040] Further, the calculating the spatial position mapping relationship of pixel points based on the light incident path and refraction path, and using the spatial position mapping relationship to correct the images collected from each perspective to obtain corrected images includes: using the light incident path and refraction path, combining with the container wall thickness distribution data of the target container, calculating the incident angle and exit angle of the light on the front and back surfaces of the target container, and establishing a light intensity transmission equation considering multi-layer refraction; substituting the light intensity transmission equation into the refractive index function of different wavelengths, calculating the spatial propagation path and energy attenuation coefficient of each wavelength of light; according to the spatial propagation path and energy attenuation coefficient, establishing a spatial position mapping matrix and a light intensity compensation matrix of pixel points; for each pixel point of the images collected from each perspective, using the spatial position mapping matrix for position correction and using the light intensity compensation matrix for light intensity compensation to obtain the corrected images.
[0041] Specifically, using the incident light path and the refraction path, combined with the container wall thickness distribution data of the target container, calculating the incident angle and the exit angle of the light on the front and back surfaces of the target container is the basis for constructing an accurate light intensity transmission equation. The system first extracts the intersection coordinates and direction vectors of each light ray with the container surface from the light ray propagation path data obtained in the previous step, and then accesses the accurate three-dimensional model database of the container to obtain the local geometric information at the intersection, including the surface normal vector and curvature. For the container wall thickness distribution, the system creates a three-dimensional thickness map using high-precision computed tomography or industrial CT data, which contains the accurate wall thickness values of each part of the container. Taking a typical PET beverage bottle as an example, its wall thickness distribution usually varies between 0.3 mm and 2 mm, with larger wall thicknesses in the bottom and shoulder regions of the bottle and smaller wall thicknesses in the middle of the bottle body. Based on the first intersection of the light ray with the outer surface of the container, combined with the wall thickness data and the surface normal vector, the system accurately calculates the propagation path of the light ray inside the container until it reaches the exit point on the inner surface. During this calculation process, the system applies Snell's law to calculate the refraction angle at each interface, while considering the possible inhomogeneity and stress distribution inside the material that affect the refractive index. For each light ray, the system records its incident angle on the outer surface and the exit angle on the inner surface, and these angle data directly affect the energy transmission efficiency and the degree of spatial deflection of the light ray. Based on these geometric and optical parameters, the system establishes a light intensity transmission equation considering multiple refractions, which combines the Fresnel formula to calculate the interface reflection loss, the Beer-Lambert law to calculate the material absorption loss, and the scattering theory to calculate the scattering loss caused by the microstructure, comprehensively describing the energy change process of the light ray from incidence to exit.
[0042] Specifically, substituting the light intensity transport equation into the refractive index functions of different wavelengths, the system further calculates the spatial propagation paths and energy attenuation coefficients of light rays of each wavelength. This step first extracts the refractive index dispersion curve of the target container material in the visible spectral range from the material optical property database, and this curve describes the relationship between the refractive index and the wavelength. Taking the typical PET material as an example, its refractive index drops by about 0.02 - 0.03 units from blue light (450 nm) to red light (650 nm). Although this change is small, it is sufficient to cause an obvious dispersion effect. The system divides the spectrum into multiple bands, usually selecting three main bands: red (650 nm), green (550 nm), and blue (450 nm), and applies the light intensity transport equation to each band separately to calculate the precise propagation path of the light rays in that band. Due to the different refractive indices of different wavelengths, light rays will undergo different degrees of refraction and deflection under the same incident conditions, forming a dispersion phenomenon. The system calculates the complete path of light rays of each wavelength from incidence to exit through numerical integration methods, records the length and direction changes of the path. At the same time, the system also calculates the energy attenuation coefficients of light rays of each wavelength during propagation, and these coefficients are jointly affected by three factors: the material absorption spectrum, surface reflection loss, and internal scattering. For a semi-transparent PET container, the absorption in the blue light band is usually higher than that in the red light band, resulting in a slightly yellowish tint in the image after passing through the container. The system uses the recursive ray tracing algorithm to handle possible multiple internal reflection situations, especially in the high-curvature or thick-wall regions of the container, where the multiple reflection effect is more significant. Through this multi-wavelength ray tracing calculation, the system obtains a complete dataset describing the optical dispersion and energy transport characteristics.
[0043] Specifically, based on the calculated spatial propagation paths and energy attenuation coefficients of light rays at each wavelength, the system establishes a spatial position mapping matrix and a light intensity compensation matrix for pixel points. To construct the spatial position mapping matrix, the image space is first divided into grids, and for each grid point, the correspondence between the ideal spatial position that the light ray should reach without refraction and the actual imaging position after refraction is calculated. This correspondence forms a transformation function that describes the geometric distortion of the image, and this function assigns a new corrected position to each pixel point in the image. Due to the complex shape of the transparent container, this transformation is usually non-linear and exhibits different characteristics in different regions of the container. For example, the distortion in the bottleneck and shoulder regions is usually more significant than that in the bottle body. The system uses a bicubic interpolation algorithm to ensure the continuity and smoothness of the transformation function across the entire image space, avoiding the introduction of new artifacts during the correction process. For the light intensity compensation matrix, the system establishes independent compensation factors for each pixel point and each color channel based on the previously calculated energy attenuation coefficients. These compensation factors take into account factors such as the selective absorption of light in the container material, surface reflection losses, and energy redistribution caused by refraction, aiming to restore the true brightness and color information of the object. The light intensity compensation matrix is usually represented by floating-point numbers, providing high-precision brightness correction capabilities. For some severely attenuated regions, such as the thick wall part of a dark-colored container, the compensation factors may need to be relatively large to restore sufficient image details, but the system will control the noise amplification effect to ensure that the signal-to-noise ratio of the corrected image is within an acceptable range.
[0044] Specifically, finally, for each pixel point of the images collected from each perspective, the system performs position correction using the spatial position mapping matrix and intensity compensation using the intensity compensation matrix to obtain the corrected images. The position correction process adopts the inverse mapping strategy, that is, for each pixel point of the corrected image, its corresponding position in the original image is found through the mapping matrix, and then the pixel value at this position is calculated by interpolation. This inverse mapping method avoids the pixel hole problem that may occur in forward mapping and ensures the integrity of the corrected image. The system usually uses bilinear or bicubic interpolation algorithms for pixel resampling to suppress the aliasing artifacts caused by interpolation while maintaining the sharpness of the image. For the undefined regions that may appear at the edges of the image, the system uses edge extension or texture synthesis techniques to fill them to ensure the visual continuity of the corrected image. After the position correction is completed, the system further applies the intensity compensation matrix to perform channel-level brightness and color adjustment on the image. This compensation process is carried out separately for the three primary color channels of red, green, and blue to correct the color distortion caused by the selective absorption and dispersion effects of the container material. For high-dynamic-range scenes, the system also applies a local adaptive enhancement algorithm to improve the visibility of details in the shadow areas while avoiding overexposure in the highlight areas. Through this series of precise geometric transformations and optical compensation processes, the system finally obtains the corrected multi-perspective images, in which the object shapes, positions, brightness, and colors are effectively restored, significantly reducing various visual distortions caused by the refraction effect of the transparent container. The corrected images not only retain the detailed information of the original images but also enhance the contrast between the defect areas and the background.
[0045] 104. According to the corrected images and the regional perspective weight distribution maps, use the regional adaptive fusion algorithm to perform defect detection on the target container to obtain detection data containing defect information.
[0046] In an embodiment of the present invention, the step of using the regional adaptive fusion algorithm to perform defect detection on the target container according to the corrected images and the regional perspective weight distribution maps to obtain detection data containing defect information includes: in each region, extract the regional image feature matrix in the corrected image, and construct a feature description vector reflecting the regional feature distribution according to the regional image feature matrix; calculate the weight adaptive coefficient of each region according to the regional perspective weight distribution map, and the weight adaptive coefficient is proportional to the variance of the perspective weight values within the region; use the weight adaptive coefficient to construct a regional adaptive fusion function, and dynamically adjust the fusion parameters according to the uniformity of the regional feature distribution; apply the regional adaptive fusion function to the feature description vector to generate a fused feature map, and perform threshold segmentation and feature clustering on the fused feature map to obtain the detection data.
[0047] Specifically, in the process of defect detection of the target container based on the calibrated image and the regional perspective weight distribution map, it is first necessary to extract the regional image feature matrix in the calibrated image in each region, and construct a feature description vector based on these feature matrices. From the set of calibrated images obtained in the previous steps, the system extracts the image patches corresponding to each region according to the region division result. For each image patch, the system applies a multi-scale feature extraction algorithm to extract its texture, edge, and morphological features. Specifically, the system uses the Local Binary Pattern (LBP) to extract texture features and capture surface microstructure information; uses the Histogram of Oriented Gradients (HOG) to extract edge features and detect contours and linear defects; and at the same time applies morphological feature operators to extract curvature and connectivity features to identify typical defects such as bubbles and cracks. For the unique optical properties of transparent containers, the system also extracts light transmission features and polarization features, which correspond to the internal structural changes and stress distributions of the container material. All the extracted features are organized into a multi-dimensional feature matrix, where each row of the matrix represents a pixel or a small region, and each column represents a feature dimension. The system applies principal component analysis to the feature matrix for dimensionality reduction, retaining the feature combination with the largest amount of information to form a compact feature description vector. These feature vectors directly reflect the material state of the container surface and interior, and large eigenvalue changes usually correspond to potential defect regions.
[0048] Specifically, after obtaining the feature description vector, the system calculates the weight adaptive coefficient for each region according to the regional perspective weight distribution map. This calculation process first extracts the set of weight values of each region at each perspective from the regional perspective weight distribution map, and calculates the statistical properties of these weight values, including mean, variance, and distribution pattern. The weight adaptive coefficient is set to a value proportional to the variance of the perspective weight values within the region. This design principle is based on the following considerations: a region with a large weight variance indicates that the observation quality of this region from different perspectives varies significantly, and stronger perspective selectivity is required; while a region with a small weight variance indicates that the observation quality from each perspective is similar, and a more average fusion strategy is suitable. The system maps the weight variance to an adaptive coefficient between 0 and 1 through normalization processing, usually using an S-shaped function for non-linear mapping to enhance the discrimination of regions with medium variance. For some special regions, such as high-curvature parts or locations with sharp thickness changes of the container, the system will adjust the adaptive coefficient based on prior knowledge to cope with the complex optical properties of these regions. The introduction of the weight adaptive coefficient enables the system to adopt the most appropriate multi-perspective fusion strategy for different parts of the container, improving the accuracy and robustness of defect detection.
[0049] Specifically, using the calculated weight adaptation coefficient, the system constructs a region-adaptive fusion function and dynamically adjusts the fusion parameters according to the uniformity of the regional feature distribution. The design of the fusion function adopts a weighted multi-view feature fusion framework, and the core idea is to adaptively determine the fusion weights according to the reliability of each view and regional characteristics. In terms of specific implementation, the system first evaluates the uniformity of each regional feature distribution, usually quantified by calculating the entropy value or variance of the feature vector. A region with a high degree of uniformity indicates consistent surface characteristics and is suitable for using a higher threshold; while a region with a low degree of uniformity indicates complex surface characteristics and requires a lower threshold to detect potential defects. The system combines the regional uniformity with the weight adaptation coefficient to construct a parameterized fusion function template, usually in the form of weighted average, maximum response or probability mixture. For different types of defects in transparent containers, such as bubbles, cracks, impurities, and wall thickness anomalies, etc., the system specifically adjusts the parameters of the fusion function to enhance the detection sensitivity of the corresponding defect types. The fusion function also includes a defect scale adaptation mechanism, which can detect large-scale structural defects and tiny surface defects simultaneously, which is crucial for comprehensively evaluating the quality of the container.
[0050] Specifically, finally, the system applies the region-adaptive fusion function to the feature description vector, generates a fused feature map, and performs threshold segmentation and feature clustering on the fused feature map to obtain the final detection data. The fusion process is carried out for each region separately. The system combines the feature vectors of the region under each view according to the weights determined by the fusion function to generate a single fused feature representation. These region-level fused features are stitched together to form a fused feature map covering the entire container. This map retains the feature information of each region and at the same time eliminates the perspective differences caused by refraction. The system applies an adaptive threshold algorithm to segment the fused feature map, and marks the regions where the feature values exceed the threshold as potential defects. The determination of the threshold takes into account factors such as the uniformity of the region, material properties, and expected defect types, and different threshold strategies are adopted for different parts of the container. The segmented result is processed morphologically to remove noise and connect broken edges, and then a feature clustering algorithm is applied to combine similar defect features into meaningful defect entities. The clustering process considers the spatial proximity, feature similarity, and morphological consistency of the defects, and can accurately distinguish different types and severities of defects. The finally generated detection data includes information such as the location, size, type, and severity of each detected defect. These data are output in a structured format and can be used for quality control decision-making and statistical analysis.
[0051] In this embodiment, light sources with different wavelengths are used to illuminate and image a target container from multiple preset perspectives to obtain a refractive displacement fingerprint data set; then, the surface of the container is divided into regions according to this data set, and the refractive influence degree of each region at different perspectives is calculated to generate a region-perspective weight distribution map; then, the light path of the images collected from each perspective is traced backward using this distribution map, a light ray propagation path model is constructed, and position mapping and distortion compensation are performed to obtain a corrected image; finally, a defect detection is performed using a region adaptive fusion algorithm based on the corrected image and the region-perspective weight distribution map. Through technical means such as region adaptive division, light path backward tracing, and region adaptive fusion, the multi-perspective images of the present invention can be accurately aligned and fused, while taking into account the observation characteristics of different regions, ensuring the reliability of the defect detection results.
[0052] The method for detecting the multi-angle imaging quality of a container in the embodiment of the present invention has been described above. Next, the system for detecting the multi-angle imaging quality of a container in the embodiment of the present invention will be described. Please refer to Figure 2 , an embodiment of the system for detecting the multi-angle imaging quality of a container in the embodiment of the present invention includes: A calibration acquisition module 201, configured to perform multi-spectral differential refraction calibration acquisition on a target container, illuminate and image the target container from multiple preset perspectives using light sources with different wavelengths, record image displacement data under the illumination of light sources with different wavelengths, and obtain a refractive displacement fingerprint data set; A region division module 202, configured to divide the surface of the target container according to the refractive displacement fingerprint data set, and calculate the refractive influence degree of each region at different perspectives to obtain a region-perspective weight distribution map; An image correction module 203, configured to perform backward light path tracing on the images collected from each perspective according to the region-perspective weight distribution map, construct a light ray propagation path model, and perform position mapping and distortion compensation on the pixel points in the image using the light ray propagation path model to obtain a corrected image; The defect detection module 204 is configured to perform defect detection on the target container by using a region adaptive fusion algorithm according to the corrected image and the region perspective weight distribution map, and obtain detection data including defect information. In the embodiments of the present invention, the container multi-angle imaging quality detection system runs the above-mentioned container multi-angle imaging quality detection method. The container multi-angle imaging quality detection system uses light sources with different wavelengths to illuminate and image the target container from multiple preset perspectives, and obtains a refraction displacement fingerprint data set; then divides the container surface into regions according to this data set, calculates the refraction influence degree of each region at different perspectives, and generates a region perspective weight distribution map; then uses this distribution map to perform optical path reverse tracing processing on the images collected from each perspective, constructs a light ray propagation path model and performs position mapping and distortion compensation to obtain a corrected image; finally, according to the corrected image and the region perspective weight distribution map, a region adaptive fusion algorithm is used for defect detection. Through technical means such as region adaptive division, optical path reverse tracing, and region adaptive fusion, the present invention enables multi-perspective images to be accurately aligned and fused, while taking into account the observation characteristics of different regions, ensuring the reliability of the defect detection results.
[0053] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described system, device, or unit can refer to the corresponding processes in the foregoing method embodiments and will not be repeated here.
[0054] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0055] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for detecting the imaging quality of a container from multiple angles, characterized in that, The method for detecting the imaging quality of a target container from multiple angles includes: Performing multi-spectral differential refraction calibration acquisition on the target container, illuminating and imaging the target container from multiple preset perspectives using light sources with different wavelengths, recording the image displacement data under the illumination of light sources with different wavelengths, and obtaining a refraction displacement fingerprint data set; According to the refraction displacement fingerprint data set, dividing the surface of the target container into regions, and calculating the refraction influence degree of each region from different perspectives to obtain a regional perspective weight distribution map; According to the regional perspective weight distribution map, performing optical path reverse tracing processing on the images collected from each perspective, constructing a light ray propagation path model, and using the light ray propagation path model to perform position mapping and distortion compensation on the pixel points in the images to obtain corrected images; According to the corrected images and the regional perspective weight distribution map, using a regional adaptive fusion algorithm to perform defect detection on the target container to obtain detection data containing defect information.
2. The method for detecting the imaging quality of a container at multiple angles according to claim 1, characterized in that The performing multi-spectral differential refraction calibration acquisition on the target container, illuminating and imaging the target container from multiple preset perspectives using light sources with different wavelengths, recording the image displacement data under the illumination of light sources with different wavelengths, and obtaining a refraction displacement fingerprint data set includes: Pre-implanting dot array marking points on the surface of the target container, and sequentially illuminating the target container at multiple preset incident angles using narrow-band light sources with multiple preset central wavelengths; Recording the position coordinates of each marking point in the dot array marking points under the illumination of each narrow-band light source during sequential illumination; Calculating the position offset of each marking point under the illumination of light sources with different wavelengths based on the position coordinates, and establishing a position offset vector field of the marking points according to the position offset; Constructing the refraction displacement fingerprint data set according to the relative position relationship between the position offset vector field and the surface of the target container.
3. The method for detecting the imaging quality of a container at multiple angles according to claim 1, characterized in that The dividing the surface of the target container into regions according to the refraction displacement fingerprint data set, and calculating the refraction influence degree of each region from different perspectives to obtain a regional perspective weight distribution map includes: Calculating the displacement difference degree between each marking point and its adjacent marking points according to the refraction displacement fingerprint data set, and performing an initial regional division on the surface of the target container based on the displacement difference degree to obtain an initial regional division result; Calculating the mean and variance of the refraction displacement of the marking points inside each initial region of the initial regional division result according to the refraction displacement fingerprint data set, and adaptively adjusting the initial region according to the mean and variance of the refraction displacement to obtain a target regional division result, where the target regional division result includes multiple regions; Calculating the refraction influence coefficient from different perspectives according to the refraction displacement fingerprint data in each region, and assigning a corresponding perspective weight value to each region according to the refraction influence coefficient; Integrating the target regional division result and the perspective weight value corresponding to each region into the regional perspective weight distribution map of the surface of the target container.
4. The method for detecting the multi-angle imaging quality of a container according to claim 3, wherein Calculating the refraction influence coefficients at different viewing angles based on the refraction displacement fingerprint data in each region, and assigning corresponding viewing angle weight values to each region according to the refraction influence coefficients includes: Sorting the refraction displacement fingerprint data in each region according to spatial coordinates, and using the least squares method to fit to obtain the refraction displacement surface function in the region. By calculating the gradient and curvature of the refraction displacement surface function, region refraction characteristic data is obtained; Calculating the normal vectors of each point on the surface of the target container using the gradient of the refraction displacement surface function, and calculating the angle between the viewing direction of each viewing angle and the normal vector according to the normal vector and the region refraction characteristic data; Combining the angle, as well as the gradient and curvature of the refraction displacement surface, to obtain the initial refraction influence coefficient; Weighted averaging the initial refraction influence coefficient using the spatial distribution density of the marked points in the region, and normalizing the weighted average result to obtain the corrected refraction influence coefficient of each region at each viewing angle; When the corrected refraction influence coefficient of the viewing angle in the region is greater than the preset weight threshold, setting the weight value of the corresponding viewing angle to the logarithm of the corrected refraction influence coefficient, and when it is less than the weight threshold, setting the weight value of the corresponding viewing angle to zero, to obtain the viewing angle weight values corresponding to each region.
5. The method for detecting the imaging quality of a container from multiple angles according to claim 1, wherein Performing optical path reverse tracking processing on the images collected at each viewing angle according to the regional viewing angle weight distribution map, constructing a light propagation path model, and using the light propagation path model to perform position mapping and distortion compensation on the pixel points in the image to obtain a corrected image includes: Establishing a basic light propagation equation set for each region according to the material parameters and shape characteristics of the target container; Combining the viewing angle weight values in the regional viewing angle weight distribution map with the basic light propagation equation set to construct a light propagation path model including weight factors; Calculating the light incident path and refraction path corresponding to each pixel point in the images collected at each viewing angle according to the light propagation path model; Based on the light incident path and refraction path, calculating the spatial position mapping relationship of the pixel points, and using the spatial position mapping relationship to correct the images collected at each viewing angle to obtain a corrected image.
6. The method for detecting the imaging quality of a container at multiple angles according to claim 5, wherein, Based on the light incident path and refraction path, calculating the spatial position mapping relationship of the pixel points, and using the spatial position mapping relationship to correct the images collected at each viewing angle to obtain a corrected image includes: Using the light incident path and refraction path, combining the container wall thickness distribution data of the target container, calculating the incident angle and exit angle of the light on the front and back surfaces of the target container, and establishing an optical intensity transmission equation considering multi-layer refraction; Substituting the optical intensity transmission equation into the refractive index function of different wavelengths, and calculating the spatial propagation path and energy attenuation coefficient of the light of each wavelength; According to the spatial propagation path and energy attenuation coefficient, establishing a spatial position mapping matrix and an optical intensity compensation matrix for the pixel points; For each pixel point in the images collected at each viewing angle, performing position correction using the spatial position mapping matrix and performing optical intensity compensation using the optical intensity compensation matrix to obtain the corrected image.
7. The method for detecting the imaging quality of a container from multiple angles according to claim 1, wherein Performing defect detection on the target container by using a region adaptive fusion algorithm according to the corrected image and the regional perspective weight distribution map, the obtained detection data including defect information includes: In each region, extracting the region image feature matrix in the corrected image, and constructing a feature description vector reflecting the regional feature distribution according to the region image feature matrix; Calculating the weight adaptive coefficient of each region according to the regional perspective weight distribution map, where the weight adaptive coefficient is proportional to the variance of the perspective weight values within the region; Constructing a region adaptive fusion function by using the weight adaptive coefficient, and dynamically adjusting the fusion parameters according to the uniformity degree of the regional feature distribution; Applying the region adaptive fusion function to the feature description vector, generating a fusion feature map, and performing threshold segmentation and feature clustering on the fusion feature map to obtain the detection data.
8. A multi-angle imaging quality detection system for a container, characterized in that, The multi-angle imaging quality detection system for the container includes: A calibration acquisition module, configured to perform multi-spectral differential refraction calibration acquisition on the target container, illuminate and image the target container from multiple preset perspectives by using light sources with different wavelengths, record the image displacement data under the illumination of light sources with different wavelengths, and obtain a refraction displacement fingerprint data set; A region division module, configured to perform region division on the surface of the target container according to the refraction displacement fingerprint data set, and calculate the refraction influence degree of each region at different perspectives to obtain a regional perspective weight distribution map; An image correction module, configured to perform optical path backward tracking processing on the images acquired from each perspective according to the regional perspective weight distribution map, construct a light propagation path model, and perform position mapping and distortion compensation on the pixel points in the image by using the light propagation path model to obtain a corrected image; A defect detection module, configured to perform defect detection on the target container by using a region adaptive fusion algorithm according to the corrected image and the regional perspective weight distribution map, and obtain detection data including defect information.
Citation Information
Cited By
Camera shell defect detection method and system in nuclear radiation environment
CN121053103A
A method and system for detecting camera casing defects under nuclear radiation environment
CN121053103B
Oil cup defect detection method and system based on deep learning
CN121095182A
Defect detection method and system based on honeycomb catalyst stacking
CN121231494A
Cable dimension parameter detection method and system based on point cloud feature registration
CN122170762A
