Automatic sorting system and method for whole packs of instant lottery tickets with package seal detection
By using multi-wavelength transmitted light spot image analysis and deep learning classification networks, the problems of accuracy and sorting efficiency in detecting sealing defects in high-reflectivity transparent film packaging were solved, enabling precise detection and automatic sorting of the sealing performance of transparent film packaging.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-03-24
AI Technical Summary
In the existing technology, the accuracy of sealing defect detection in high-reflectivity transparent film packaging is low and the sorting efficiency is poor. This is mainly because the structured light is weak due to specular reflection on the surface of the high-reflectivity transparent film, which cannot effectively penetrate and detect internal or back sealing defects.
By employing multi-wavelength transmitted light spot image analysis, and acquiring feature data such as light spot ellipticity, luminous flux distribution, and energy center coordinates, a fuzzy logic control model and a deep learning classification network are used to identify sealing defect areas and generate sorting instructions, thereby achieving automatic sorting.
It enables accurate detection and efficient sorting of the sealing performance of highly reflective transparent film packaging, reduces the false judgment rate, and improves the stability of detection and the accuracy of sorting.
Smart Images

Figure CN121010594B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of packaging quality inspection technology, and in particular to an automatic sorting system and method for ready-to-open lottery tickets with packaging seal detection. Background Technology
[0002] On automated production lines for instant lottery tickets, rapid and accurate online inspection of the seals of highly reflective transparent heat-shrink film packaging is a critical requirement. The characteristics of this type of packaging material make defect detection susceptible to interference from ambient light, and minor sealing imperfections, such as incomplete heat sealing or minor damage, require highly sensitive detection methods for effective identification. This places clear technical demands on ensuring both product quality and production efficiency.
[0003] Currently, there is a detection scheme that uses single-wavelength structured light 3D scanning. This scheme projects laser stripes of a specific pattern onto the packaging surface and uses a high-speed camera to capture the distorted images of the stripes caused by the deformation of the packaging surface. By analyzing the degree and pattern of the stripe distortion, the system can reconstruct the 3D morphology of the packaging surface, and thus determine whether there are any abnormalities in the flatness and continuity of the sealed area.
[0004] However, when dealing with highly reflective transparent film packaging, the existing solution suffers from strong specular reflection of the projected structured light on the film surface, resulting in an excessively small effective signal area in the image captured by the camera. Furthermore, the light-transmitting properties of transparent materials make surface deformation-based detection methods insufficiently sensitive to sealing defects inside or on the back of the film, reducing the reliability of the detection. Summary of the Invention
[0005] This application provides an automatic sorting system and method for ready-to-open lottery tickets with packaging seal detection, in order to solve the problems of low accuracy and poor sorting efficiency in online detection of sealing defects in high-reflectivity transparent film packaging in the prior art.
[0006] To solve the above-mentioned technical problems, in a first aspect, this application provides an automatic sorting method for whole packages of instant lottery tickets with packaging seal detection, comprising:
[0007] Acquire light spot morphology data and multi-wavelength transmitted light spot images through the packaging film of an instant lottery ticket. The light spot morphology data includes: light spot ellipticity, luminous flux distribution characteristics, and energy center coordinates.
[0008] The ellipticity of the light spot and the luminous flux distribution characteristics are compared with the preset standard ellipticity reference value and the preset standard luminous flux distribution template, respectively, to obtain the ellipticity deviation and the distribution deviation. The Euclidean distance between the energy center coordinates and the preset standard coordinates is calculated to obtain the position deviation.
[0009] Using a fuzzy logic control model, the ellipticity deviation, the distribution deviation, and the positional deviation are weighted and combined to generate the transmission characteristic deviation.
[0010] Based on the transmission characteristic deviation, using a pre-constructed packaging film transmission model, the sealing defect area is identified from the multi-wavelength transmission spot image, and the defect type and location coordinates are determined based on the sealing defect area;
[0011] Based on the defect type and the location coordinates, a sorting instruction is generated, and the execution mechanism is controlled based on the sorting instruction to complete the automatic sorting of the entire package of instant lottery tickets.
[0012] Optionally, the step of identifying sealing defect areas from the multi-wavelength transmitted light spot image based on the transmission characteristic deviation using a pre-constructed packaging film transmission model, and determining the defect type and location coordinates based on the sealing defect areas, includes:
[0013] The transmission characteristic deviation is compared with multiple preset deviation thresholds in a graded manner. When the graded comparison result indicates that the transmission characteristic deviation is greater than the preset first-level threshold, the corresponding position in the multi-wavelength transmission spot image is marked as a preliminary suspicious area.
[0014] Based on the packaging film transmission model, multi-scale morphological analysis is performed on the initially suspected area to obtain the area shape factor and texture feature parameters. Based on the area shape factor and texture feature parameters, area feature data is generated.
[0015] The regional feature data is input into a deep learning classification network, and the deep learning classification network performs deep feature extraction and classification on the regional feature data, outputting a regional defect probability score.
[0016] The defect probability score of the region is matched and compared with the standard feature data stored in the packaging film transmission model. Based on the matching and comparison results, the sealing defect region is identified.
[0017] The defect type is determined based on the image feature patterns of the sealing defect area;
[0018] A connected component analysis is performed on the sealing defect region to calculate the minimum bounding rectangle of the sealing defect region in the image coordinate system;
[0019] The location coordinates of the defect are determined based on the geometric center coordinates and dimensions of the minimum bounding rectangle.
[0020] Optionally, the step of inputting the regional feature data into a deep learning classification network, performing deep feature extraction and classification on the regional feature data through the deep learning classification network, and outputting a regional defect probability score includes:
[0021] The region feature data is input into a deep learning classification network, and the region feature data is extracted layer by layer through multiple convolutional layers of the deep learning classification network to obtain a multi-level feature representation.
[0022] The attention mechanism in the deep learning classification network is used to adaptively weight and fuse the multi-level feature representations to generate fused features.
[0023] The fused features are nonlinearly transformed through the fully connected layer of the deep learning classification network to obtain a deep feature representation;
[0024] The probability classifier in the deep learning classification network is used to calculate the deep feature representation, generate the probability distribution of each defect category, and extract the maximum probability value from the probability distribution as the regional defect probability score.
[0025] Optionally, acquiring the light spot morphology data and multi-wavelength transmitted light spot images through the whole package of instant lottery ticket packaging film includes:
[0026] The multi-wavelength transmitted light spot image is preprocessed using an image morphology processing algorithm;
[0027] The images of the same location at different wavelengths in the preprocessed multi-wavelength transmission spot image are superimposed and averaged to obtain the fused image;
[0028] The fused image is then subjected to spatial difference processing to obtain a difference-processed image;
[0029] Identify the light spot contour information and light spot region from the image after differential processing, and calculate the light spot ellipticity based on the light spot contour information;
[0030] Analyze the grayscale distribution characteristics within the light spot area, and statistically analyze the luminous flux distribution characteristics based on the grayscale distribution characteristics;
[0031] Calculate the gray-weighted center point coordinates of the light spot region, and use the gray-weighted center point coordinates as the energy center coordinates;
[0032] The ellipticity of the light spot, the luminous flux distribution characteristics, and the coordinates of the energy center are combined to form light spot morphology characteristic data.
[0033] Optionally, the preprocessing of the multi-wavelength transmitted light spot image using an image morphology processing algorithm includes:
[0034] Using multi-scale circular structural elements, a dilation operation is performed on the transmission spot image of each wavelength in the multi-wavelength transmission spot image, and an erosion operation is performed on each dilated transmission spot image.
[0035] The images obtained after etching at different wavelengths are weighted and superimposed to obtain the superimposed image;
[0036] Calculate the adaptive average gray value of each pixel in the superimposed image;
[0037] Based on the adaptive average gray value, the superimposed image is subjected to adaptive contrast enhancement to obtain a preprocessed multi-wavelength transmission spot image.
[0038] Optionally, the step of using a fuzzy logic control model to weight and combine the ellipticity deviation, the distribution deviation, and the positional deviation to generate a transmission characteristic deviation includes:
[0039] The ellipticity deviation, the distribution deviation, and the position deviation are input into the fuzzy logic control model. The fuzzification layer of the fuzzy logic control model converts each deviation into a corresponding fuzzy membership degree, forming a fuzzy set of deviations.
[0040] Based on the preset fuzzy rule base in the fuzzy logic control model, inference calculations are performed on the fuzzified deviation set;
[0041] The reasoning results are converted into weight coefficients through the defuzzification layer of the fuzzy logic control model.
[0042] Based on the weighting coefficients, the ellipticity deviation, the distribution deviation, and the position deviation are weighted and fused to generate the transmission characteristic deviation.
[0043] Optionally, the step of generating a sorting instruction based on the defect type and the location coordinates, and controlling the actuator to complete the automatic sorting of the entire package of instant lottery tickets based on the sorting instruction, includes:
[0044] Based on the defect type, a corresponding sorting grade code is generated, which includes a complete rejection code and a partial rejection code.
[0045] Based on the sorting grade code and the location coordinates, a sorting instruction is generated;
[0046] The sorting instruction shall be a control signal that can be recognized by the actuator;
[0047] The control signal is transmitted to the control system of the actuator in real time, and the multi-axis robot is driven to position itself to the defective packaging location according to the three-dimensional position information in the sorting instruction;
[0048] Based on the location of the defective packaging, the corresponding sorting mode is selected from the sorting level code: when it is a complete rejection code, the vacuum suction cup is controlled to pick up the whole package of instant lottery tickets and move it to the waste area; when it is a partial rejection code, the laser marking device is controlled to mark the location of the defective packaging.
[0049] The completion status of the sorting operation is verified by photoelectric sensors, and the verification result is fed back to the control system.
[0050] Secondly, this application provides an automatic sorting system for fully packaged instant lottery tickets with packaging seal detection, comprising:
[0051] The acquisition module is used to acquire light spot morphology feature data and multi-wavelength transmitted light spot images through the whole package of instant lottery packaging film. The light spot morphology feature data includes: light spot ellipticity, luminous flux distribution characteristics and energy center coordinates.
[0052] The comparison module is used to compare the ellipticity of the light spot and the luminous flux distribution characteristics with the preset standard ellipticity reference value and the preset standard luminous flux distribution template, respectively, to obtain the ellipticity deviation and the distribution deviation, and to calculate the Euclidean distance between the energy center coordinates and the preset standard coordinates to obtain the position deviation.
[0053] The combination module is used to use a fuzzy logic control model to weight and combine the ellipticity deviation, the distribution deviation, and the position deviation to generate the transmission characteristic deviation.
[0054] The identification module is used to identify sealing defect areas from the multi-wavelength transmitted light spot image based on the transmission characteristic deviation and using a pre-constructed packaging film transmission model, and to determine the defect type and location coordinates based on the sealing defect areas;
[0055] The generation module is used to generate sorting instructions based on the defect type and the location coordinates, and to control the execution mechanism to complete the automatic sorting of the entire package of instant lottery tickets based on the sorting instructions.
[0056] Thirdly, this application provides an electronic device, comprising:
[0057] Memory, used to store computer programs;
[0058] A processor is configured to execute the computer program to implement the steps of the automatic sorting method for whole-package instant lottery tickets with packaging seal detection as described in the first aspect above.
[0059] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps of the automatic sorting method for fully packaged instant lottery tickets with packaging seal detection as described in the first aspect above.
[0060] This application provides an automatic sorting method for ready-to-open lottery tickets with packaging seal detection. The method includes: acquiring light spot morphology feature data and multi-wavelength transmitted light spot images transmitted through the packaging film of the ready-to-open lottery tickets; the light spot morphology feature data includes: light spot ellipticity, luminous flux distribution characteristics, and energy center coordinates; comparing the light spot ellipticity and luminous flux distribution characteristics with preset standard ellipticity reference values and preset standard luminous flux distribution templates respectively to obtain ellipticity deviation and distribution deviation, and calculating the Euclidean distance between the energy center coordinates and the preset standard coordinates to obtain position deviation; using a fuzzy logic control model, weighting and combining the ellipticity deviation, distribution deviation, and position deviation to generate a transmission characteristic deviation; based on the transmission characteristic deviation, using a pre-constructed packaging film transmission model, identifying sealing defect areas from the multi-wavelength transmitted light spot images, and determining the defect type and position coordinates based on the sealing defect areas; generating sorting instructions based on the defect type and position coordinates, and controlling an actuator to complete the automatic sorting of ready-to-open lottery tickets based on the sorting instructions.
[0061] The technical solution provided in this application has the following beneficial effects:
[0062] This application provides a quantitative data foundation that directly reflects the light transmittance characteristics inside the packaging film for subsequent analysis. It transforms complex image information into multi-dimensional, quantifiable deviation indicators, facilitating precise quantitative analysis. By comprehensively considering the impact of deviations in each dimension, a more stable and comprehensive evaluation index that better reflects the overall sealing condition is generated. This enables precise location and qualitative judgment of defective areas, providing a clear decision-making basis for subsequent sorting operations. Ultimately, the detection results are translated into specific production actions, forming a closed-loop automation of detection and processing.
[0063] Furthermore, this application also preliminarily screens suspicious areas by setting multi-level thresholds, then combines the packaging film transmission model to perform multi-scale morphological analysis to extract regional features, and then uses a deep learning classification network to intelligently classify and score the features. Finally, through matching comparison and connected component analysis, a refined judgment process is achieved from locating suspicious areas to identifying defect types and determining location coordinates.
[0064] Furthermore, this series of steps improves the ability to identify subtle defects and complex defect patterns, reduces the false judgment rate, and achieves accurate positioning of defects, laying a solid foundation for efficient and accurate sorting operations.
[0065] These or other aspects of this application will become more apparent in the following description of the embodiments. Attached Figure Description
[0066] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0067] Figure 1 A flowchart of an automatic sorting method for whole-package instant lottery tickets with packaging seal detection provided in this application embodiment;
[0068] Figure 2 A schematic diagram illustrating a specific implementation of an automatic sorting method for fully packaged instant lottery tickets with packaging seal detection, provided in this application embodiment;
[0069] Figure 3 This is a schematic diagram of the structure of an automatic sorting system for instant lottery tickets with packaging seal detection provided in an embodiment of this application. Detailed Implementation
[0070] In the automated production process of instant lottery tickets, existing sealing inspection technology based on single-wavelength structured light 3D scanning faces a core challenge. This technology relies on analyzing the light stripe distortion on the packaging surface to identify defects. However, the highly reflective transparent heat-shrink film surface produces strong specular reflection of structured light, significantly weakening the intensity of the surface deformation signal that can be analyzed. Simultaneously, because the detection light cannot effectively penetrate the transparent film, this method responds weakly to sealing defects inside the film layer or on the back side, making the detection results susceptible to interference and lacking reliability.
[0071] To overcome the aforementioned limitations, this application proposes an automated sorting method for ready-to-open lottery tickets with integrated packaging seal detection. The core of this method lies in utilizing detection light of a specific wavelength to penetrate the lottery ticket packaging film. The sealing status is assessed by analyzing the morphological characteristics of the transmitted light spot image, including ellipticity, luminous flux distribution, and energy center. Specifically, this method employs alternating illumination from multi-band light sources and utilizes fuzzy logic to fuse deviations from multiple morphological features, generating a comprehensive transmission characteristic evaluation index. This shifts the detection mechanism from relying on surface deformation to analyzing internal transmission characteristics, effectively avoiding interference from highly reflective surfaces. By constructing a transmission model of the packaging film and comparing it with actual detection data, this method can sensitively capture subtle transmission anomalies caused by internal sealing defects, achieving stable and accurate online detection of the sealing quality of transparent film packaging. This fundamentally solves the pain points of existing technologies, such as insensitivity to highly reflective transparent materials and weak signal strength.
[0072] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0073] The core of this application is to provide an automatic sorting method for fully packaged instant lottery tickets with packaging seal detection. A flowchart of one specific implementation is shown below. Figure 1 As shown, the method includes:
[0074] Step 101: Obtain the light spot morphology feature data and multi-wavelength transmitted light spot image through the whole package of instant lottery ticket packaging film. The light spot morphology feature data includes: light spot ellipticity, luminous flux distribution characteristics and energy center coordinates.
[0075] In step 101, the light spot morphology feature data refers to a set of quantitative features extracted from the transmitted light spot image through the lottery ticket packaging film. The light spot ellipticity describes how close the light spot shape is to a perfect circle; a value closer to 1 indicates a more rounded shape. The luminous flux distribution features reflect the distribution of light intensity within the light spot region. The energy center coordinates represent the weighted center location of light energy within the light spot region.
[0076] In this embodiment, an image of the transmitted light spot through the lottery packaging film is first acquired using an image acquisition device. Then, an image processing algorithm is used to identify and extract the light spot contour. Based on the extracted light spot contour, its ellipticity parameter is calculated. At the same time, the gray value distribution of all pixels in the light spot area is statistically analyzed to obtain the luminous flux distribution characteristics. Finally, the energy center coordinates are determined by calculating the weighted average of the coordinates of each pixel in the light spot area and its gray value, thereby completing the acquisition of light spot morphology feature data.
[0077] For example, taking the inspection station of a lottery production line as an example, when a well-packaged lottery ticket passes through the inspection area, a linear array sensor captures an image of the transmitted light spot through the packaging film. The system first identifies the light spot region in the image and calculates the ellipticity of the light spot to be 0.92. This value is obtained through the formula... The calculations show that the area refers to the total number of pixels in the light spot, and the perimeter refers to the total length of the boundary formed by connecting the pixels of the light spot outline. Simultaneously, the distribution of 256 gray levels within the light spot region is statistically analyzed to obtain the luminous flux distribution characteristic curve. Finally, according to the formula... and Calculate the coordinates of the energy center, where The X-axis coordinate represents the energy center of the light spot. The Y-axis coordinate represents the energy center of the light spot. , For pixel coordinates, Given the pixel grayscale value, the calculated coordinates are (125.3, 98.7).
[0078] Step 102: Compare the ellipticity of the light spot and the luminous flux distribution characteristics with the preset standard ellipticity reference value and the preset standard luminous flux distribution template, respectively, to obtain the ellipticity deviation and the distribution deviation, and calculate the Euclidean distance between the energy center coordinates and the preset standard coordinates to obtain the position deviation.
[0079] In step 102, the ellipticity deviation represents the degree of difference between the actual spot ellipticity and the standard reference value. The distribution deviation describes the difference in matching between the actual luminous flux distribution and the standard template. The position deviation measures the offset distance between the actual position and the standard position of the energy center using Euclidean distance.
[0080] In this embodiment, the ellipticity deviation is calculated by comparing the measured ellipticity with the preset standard ellipticity reference value. At the same time, the distribution deviation is obtained by comparing the actual luminous flux distribution characteristics with the standard distribution template. Finally, the position deviation is obtained by calculating the straight-line distance between the actual energy center coordinates and the standard coordinates. These three deviations provide basic data for subsequent comprehensive evaluation.
[0081] For example, continuing from the previous example, the system presets the standard ellipticity reference value to 0.95, the standard luminous flux distribution template to be the distribution curve under ideal conditions, and the standard energy center coordinates to be (120, 100). The calculated ellipticity deviation is |0.92 - 0.95| = 0.03, the distribution deviation is calculated using the correlation coefficient method to obtain 0.08, and the position deviation is calculated using the Euclidean distance formula. These deviations will be fed into the next step of the fusion process.
[0082] Step 103: Using a fuzzy logic control model, the ellipticity deviation, the distribution deviation, and the position deviation are weighted and combined to generate the transmission characteristic deviation.
[0083] In step 103, the transmission characteristic deviation is a comprehensive evaluation index obtained by intelligently fusing multiple individual deviation quantities through a fuzzy logic model, which is used to fully reflect the degree of abnormality in the transmission characteristics of the packaging film.
[0084] In this embodiment, three deviation values are input into a pre-trained fuzzy logic control model. The model first performs fuzzification processing on each deviation value to convert it into a membership degree, then performs inference calculation according to preset fuzzy rules, and finally obtains the optimal weight coefficients of each deviation value through defuzzification processing. The final transmission characteristic deviation value is generated by weighted summation.
[0085] For example, the deviation obtained in the previous step is input into the fuzzy logic model. The model sets the weight of the ellipticity deviation to 0.3, the weight of the distribution deviation to 0.4, and the weight of the position deviation to 0.3. The weighted calculation formula, transmission characteristic deviation = 0.3 × 0.03 + 0.4 × 0.08 + 0.3 × 5.42, yields a comprehensive deviation value of 1.65. This value exceeds the preset threshold, triggering the subsequent defect identification process.
[0086] Step 104: Based on the transmission characteristic deviation, using the pre-constructed packaging film transmission model, identify the sealing defect area from the multi-wavelength transmission spot image, and determine the defect type and location coordinates based on the sealing defect area.
[0087] In step 104, the sealing defect area refers to the image area where sealing problems may exist, as determined by transmission characteristic deviation analysis. Defect types include specific defect categories such as incomplete heat sealing and seal contamination. Location coordinates are used to precisely pinpoint the spatial location of the defect.
[0088] In this embodiment, the suspicious area is first determined by comparing the transmission characteristic deviation with a multi-level threshold. Then, the suspicious area is analyzed by multiple features using the packaging film transmission model. The defect type is determined by a classification algorithm. Finally, the defect location coordinates are accurately located using image analysis methods.
[0089] For example, when the transmission characteristic deviation of 1.65 exceeds the first-level threshold of 1.0, the system marks a suspicious area in the image. Analysis shows that this area has a shape factor of 1.8 and a texture parameter of 0.35, and is identified as an incomplete heat-sealing defect by the classifier. Finally, the minimum bounding rectangle of the defect area is obtained through connected component analysis, and its center coordinates (135, 105) are calculated as the defect location.
[0090] Step 105: Based on the defect type and the location coordinates, generate a sorting instruction, and control the actuator to complete the automatic sorting of the entire package of instant lottery tickets based on the sorting instruction.
[0091] In step 105, the sorting instruction is a control command generated based on the defect information, used to guide the actuator to complete a specific sorting action. Automated sorting refers to the process by which the system automatically separates defective products according to the sorting instruction.
[0092] In this embodiment, a corresponding sorting level code is generated according to the defect type, and a complete sorting instruction is formed by combining the defect location coordinates. The control system drives the actuator to locate the defective packaging and completes the rejection or marking operation according to the sorting mode.
[0093] For example, the system generates a complete rejection command based on incomplete heat sealing defects, and generates a control signal based on the defect location coordinates (135, 105). The six-axis robot is positioned at the designated location, and a vacuum suction cup uses -80kPa negative pressure to pick up the defective lottery ticket and move it to the waste area. The photoelectric sensor confirms that the sorting is completed and sends a feedback signal to the control system.
[0094] By combining multi-dimensional light spot feature analysis with intelligent fusion judgment, the system achieves accurate detection of the sealing performance of highly reflective transparent film packaging, effectively identifies and precisely locates various defects, and ultimately improves detection accuracy and sorting efficiency through automated sorting, thus ensuring product quality.
[0095] To address the issue of accuracy in identifying sealing defects, in some embodiments, step 104 involves identifying sealing defect regions from the multi-wavelength transmitted light spot image based on the transmission characteristic deviation using a pre-constructed packaging film transmission model, and determining the defect type and location coordinates based on the sealing defect regions. Figure 2 The above includes:
[0096] Step 201: Compare the transmission characteristic deviation with multiple preset deviation thresholds in a graded manner. When the graded comparison result indicates that the transmission characteristic deviation is greater than the preset first-level threshold, mark the corresponding position in the multi-wavelength transmission spot image as a preliminary suspicious area.
[0097] In step 201, the preset deviation threshold is a multi-level threshold value set according to the statistical distribution of transmission characteristic deviations of qualified products, used to classify and judge the severity of defects. The preliminary suspicious area refers to the area marked in the image for further analysis when the transmission characteristic deviation exceeds the minimum threshold.
[0098] In this embodiment of the application, the system compares the calculated transmission characteristic deviation with multiple preset thresholds in sequence. When the deviation value exceeds the first threshold, a rectangular area is delineated in the corresponding multi-wavelength transmission spot image as a preliminary suspicious area. The coordinate information of this area is recorded and transmitted to the subsequent processing flow.
[0099] Step 202: Based on the packaging film transmission model, perform multi-scale morphological analysis on the preliminary suspicious area to obtain the area shape factor and texture feature parameters, and generate area feature data based on the area shape factor and texture feature parameters.
[0100] In step 202, the region shape factor is a parameter describing the geometric complexity of the suspicious region, and the texture feature parameter is an indicator characterizing the gray-level variation pattern within the region. The region feature data is a feature vector formed by combining the shape and texture parameters.
[0101] In this embodiment, a multi-scale analysis is performed on the preliminary suspicious areas of the marking based on the packaging film transmission model. First, the shape factor of the area is calculated to reflect the contour features. Then, texture feature parameters are extracted to describe the internal structure. Finally, the two parameters are combined into area feature data to provide input for subsequent classification.
[0102] Step 203: Input the regional feature data into a deep learning classification network, and use the deep learning classification network to extract and classify the regional feature data, and output a regional defect probability score.
[0103] In step 203, the regional defect probability score is a numerical value output by the deep learning network that represents the likelihood of a defect existing in the region.
[0104] In this embodiment of the application, regional feature data is input into a pre-trained deep learning classification network. The network obtains deep feature representation through multi-layer feature extraction, and then calculates the probability distribution of each defect category through a classifier. Finally, the highest probability value is output as the regional defect probability score.
[0105] Step 204: Match and compare the regional defect probability score with the standard feature data stored in the packaging film transmission model, and identify the sealing defect area based on the matching and comparison results.
[0106] In step 204, the standard feature data are reference values of normal region features learned in advance from a large number of qualified samples.
[0107] In this embodiment of the application, the regional defect probability score is matched with the standard feature data stored in the packaging film transmission model. When the score exceeds the set standard, the region is confirmed as a sealing defect region.
[0108] Step 205: Determine the defect type based on the image feature pattern of the sealing defect area.
[0109] In step 205, the image feature pattern of the sealing defect area is a comprehensive description derived by analyzing the morphological features and gray-scale distribution features of the defect area. This means that the combination of visual features such as shape, texture, and contour presented by the area in the image has a corresponding relationship with specific defect types (such as incomplete heat sealing, sealing contamination, etc.) and serves as the basis for defect classification.
[0110] In this embodiment, the system matches the image feature pattern of the sealing defect area with its shape and texture features, and finally determines the specific defect category.
[0111] Step 206: Perform connected component analysis on the sealing defect region to calculate the minimum bounding rectangle of the sealing defect region in the image coordinate system.
[0112] In step 206, the minimum bounding rectangle refers to the smallest regular rectangle that can completely enclose the defect area.
[0113] In this embodiment of the application, a connected component analysis is performed on the confirmed sealing defect area to find the set of boundary points of the area, and the smallest rectangle that can contain all the boundary points is calculated to obtain the coordinates and size parameters of the rectangle.
[0114] Step 207: Determine the location coordinates of the defect based on the geometric center coordinates and size information of the minimum bounding rectangle.
[0115] In step 207, the geometric center coordinates and dimensions of the smallest bounding rectangle are obtained by calculating the smallest regular rectangle that can completely enclose the pixels of the defect area. This means that the center coordinates of this rectangle are used to accurately locate the defect, while the width and height dimensions of the rectangle are used to quantify the size range of the defect area, together providing accurate spatial positioning information for the sorting execution mechanism.
[0116] In this embodiment, the defect location is determined based on the geometric center coordinates of the smallest bounding rectangle, and the size of the defect area is evaluated by combining the rectangle size information to achieve accurate defect location.
[0117] Here is a specific example:
[0118] Following the aforementioned embodiment, when the transmission characteristic deviation value is 1.65, the system compares it with three preset deviation thresholds [1.0, 1.5, 2.0]. Since 1.65 is greater than the first-level threshold of 1.0 and less than the second-level threshold of 1.5, the corresponding positions in the multi-wavelength transmission spot image with coordinates ranging from x120 to 150 and y90 to 120 are marked as preliminary suspicious areas. Based on the packaging film transmission model, multi-scale morphological analysis is performed on this preliminary suspicious area. First, the shape factor of the area is calculated. The formula is: the shape factor equals the square of the perimeter of the area divided by 4π multiplied by the area of the area. The perimeter refers to the total length of the pixels connecting the boundary points of the area, with the unit being pixels, and the area refers to the total number of pixels inside the area, with the unit being square pixels. Substituting the perimeter of the area (60 pixels) and the area (200 square pixels), the shape factor is calculated to be 3600 divided by 4π. Multiplying by 200 approximately equals 1.8. Then, the texture feature parameters are calculated using the contrast value of the gray-level co-occurrence matrix, yielding 0.35. Based on these two parameters, region feature data [1.8, 0.35] is generated. This region feature data is input into a deep learning classification network, which outputs a region defect probability score of 0.82. This score is compared with the standard feature data threshold of 0.75 stored in the packaging film transmission model. Since 0.82 is greater than 0.75, the region is identified as a sealing defect region. Based on the image feature pattern of this sealing defect region—an elliptical gray-level anomaly area accompanied by a ring-shaped texture—the defect type is determined to be... The heat seal is incomplete. A connected component analysis is performed on the defective sealing area, and the coordinates of the minimum bounding rectangle are calculated to be x125 to 145 and y95 to 115. The geometric center coordinates of this rectangle are calculated as follows: the center x-coordinate equals the sum of the left and right boundaries of the rectangle divided by 2 (i.e., 125 + 145 divided by 2 = 135), and the center y-coordinate equals the sum of the upper and lower boundaries of the rectangle divided by 2 (i.e., 95 + 115 divided by 2 = 105). The rectangle's width and height are 20 pixels. Based on the geometric center coordinates [135, 105] of the minimum bounding rectangle and its dimensions, the defect's location coordinates are determined to be [135, 105], thus completing defect identification and location.
[0119] In this embodiment, by combining multi-level threshold screening with deep learning classification, accurate identification and location of sealing defects are achieved, effectively improving the accuracy and reliability of defect detection and providing precise decision-making basis for subsequent automatic sorting.
[0120] To further improve the accuracy of defect classification, in some embodiments, step 203: inputting the regional feature data into a deep learning classification network, performing deep feature extraction and classification on the regional feature data through the deep learning classification network, and outputting a regional defect probability score, includes:
[0121] Step 301: Input the region feature data into a deep learning classification network, and extract features from the region feature data layer by layer through multiple convolutional layers of the deep learning classification network to obtain a multi-level feature representation.
[0122] In step 301, multi-level feature representation refers to feature information with different levels of abstraction extracted through different layers of a deep learning network.
[0123] In this embodiment, after the regional feature data is input into the deep learning classification network, the basic features are first extracted through the first convolutional layer, and then the output features are passed to the second convolutional layer to extract more complex features. This process is repeated layer by layer to finally obtain feature representations containing different levels of abstraction.
[0124] Step 302: Adaptively weighted fuse the multi-level feature representations using the attention mechanism in the deep learning classification network to generate fused features.
[0125] In step 302, the fusion feature refers to the comprehensive feature representation formed by combining feature information from multiple levels through weighted combination.
[0126] In this embodiment, an attention mechanism is used to analyze the feature representations at multiple levels. Different weight coefficients are assigned according to the importance of each feature. Then, the weighted features are superimposed and combined to generate a fusion feature that better reflects the essence of the defect.
[0127] Step 303: Perform a nonlinear transformation on the fused features through the fully connected layer of the deep learning classification network to obtain a deep feature representation.
[0128] In step 303, the deep feature representation refers to the highly discriminative feature vector obtained after undergoing multiple nonlinear transformations.
[0129] In this embodiment, the fused features are input into a fully connected layer and transformed nonlinearly through an activation function, so that the features have stronger expressive power and finally output a fixed-dimensional deep feature vector.
[0130] Step 304: Utilize the probability classifier in the deep learning classification network to calculate the deep feature representation, generate the probability distribution of each defect category, and extract the maximum probability value from the probability distribution as the regional defect probability score.
[0131] In step 304, the probability distribution refers to the set of numerical values that the network predicts for each defect category.
[0132] In this embodiment of the application, the deep feature representation is input into the probability classifier. First, the score of each category is calculated. Then, the score is converted into a probability value through normalization. Finally, the maximum value among all the probability values of all categories is selected as the regional defect probability score.
[0133] Here is a specific example:
[0134] Received from the generated region feature data 1.8 and 0.35, this region feature data is input into a deep learning classification network. The network first extracts features from the input data using a 3×3 filter in the first convolutional layer, outputting a feature representation containing 32 feature maps. This feature representation is then passed to a second convolutional layer using a 5×5 filter for deeper feature extraction, obtaining a deeper feature representation containing 64 feature maps. Next, the attention mechanism in the network is used to adaptively weight and fuse these multi-level feature representations, assigning a weight of 0.6 to shape features and a weight of 0.4 to texture features, generating a weighted fused feature. This fused feature is then non-linearly transformed through a fully connected layer and processed using the ReLU activation function to obtain a 128-dimensional deep feature representation. Finally, the probabilistic classifier in the network calculates these deep feature representations, first calculating the score for each defect category using the following formula: ,in Indicates the first Scores for each category Indicates the first The weight vectors of each category, This represents the input deep feature vector. Indicates the first The bias terms for each category are determined, and then the scores are converted into a probability distribution using the softmax function. The probability calculation formula is as follows: ,in Indicates the first The probability of each category The total number of defect categories is represented by 0.82. The probability of incomplete heat sealing defect is 0.15, the probability of seal contamination defect is 0.03, and the probability of normal area is 0.82. The maximum probability value of 0.82 is extracted from these probability values as the area defect probability score output.
[0135] In this embodiment, by combining multi-level feature extraction with attention-weighted fusion, the effective information in the regional feature data is fully explored, which improves the accuracy and reliability of defect classification and provides a reliable scoring basis for subsequent defect judgment.
[0136] To further improve the accuracy of light spot feature extraction, in some embodiments, step 101: acquiring light spot morphology feature data and multi-wavelength transmitted light spot images transmitted through the whole package of instant lottery ticket packaging film, includes:
[0137] Step 401: Preprocess the multi-wavelength transmitted light spot image using an image morphology processing algorithm.
[0138] In step 401, preprocessing refers to the process of improving image quality through image processing techniques.
[0139] In this embodiment, an image morphology processing algorithm is used to perform a dilation-erosion operation on a multi-wavelength transmitted light spot image to fill small holes in the image and eliminate noise points, thereby improving image quality.
[0140] Step 402: Superimpose and average the images of the same location at different wavelengths in the preprocessed multi-wavelength transmission spot image to obtain the fused image.
[0141] In step 402, the fused image refers to the enhanced image obtained by integrating image information from different wavelengths.
[0142] In this embodiment of the application, the preprocessed multi-wavelength transmitted light spot image is arranged in wavelength order, and the gray values of pixels at the same spatial location under different wavelengths are weighted and averaged to obtain a fused image containing multi-wavelength information.
[0143] Step 403: Perform spatial difference processing on the fused image to obtain the difference-processed image.
[0144] In step 403, the image after differential processing refers to the image whose feature information is enhanced by calculating the differences between pixels.
[0145] In this embodiment of the application, spatial domain processing is performed on the fused image to calculate the difference in grayscale value between each pixel and its neighboring pixels, and the edge and feature information in the image is highlighted by amplifying the difference.
[0146] Step 404: Identify the light spot contour information and light spot region from the differentially processed image, and calculate the light spot ellipticity based on the light spot contour information.
[0147] In step 404, the spot contour information and the spot region refer to the outer boundary curve of the spot and the internal region enclosed by the boundary, respectively. The spot contour information is the set of edge pixels describing the shape of the spot, while the spot region is the complete region composed of all pixels enclosed by these contour boundaries. The spot ellipticity is a parameter describing how close the spot shape is to a circle.
[0148] In this embodiment of the application, a set of light spot contour points is extracted from the image after differential processing, the best matching ellipse is calculated by an ellipse fitting algorithm, and the ellipticity value is calculated based on the ratio of the major and minor axes of the ellipse.
[0149] Step 405: Analyze the gray-scale distribution characteristics within the light spot area, and statistically analyze the luminous flux distribution characteristics based on the gray-scale distribution characteristics.
[0150] In step 405, the grayscale distribution feature within the light spot area refers to the statistical distribution of all pixels within the light spot at different grayscale levels. This feature is derived by counting the number of pixels at each grayscale level within the light spot area and calculating the frequency distribution of each grayscale level, and is used to quantitatively describe the brightness distribution pattern within the light spot. The luminous flux distribution feature refers to the statistical characteristics of the light intensity distribution within the light spot area.
[0151] In this embodiment of the application, within the identified spot area, the grayscale value distribution of all pixels is statistically analyzed, the frequency of occurrence of each grayscale level is calculated, and a luminous flux distribution characteristic curve is formed.
[0152] Step 406: Calculate the gray-weighted center point coordinates of the light spot region, and use the gray-weighted center point coordinates as the energy center coordinates.
[0153] In step 406, the energy center coordinates refer to the weighted center position of the light energy within the light spot area.
[0154] In this embodiment of the application, the gray value of each pixel is used as a weight to calculate the weighted average of the coordinates of all pixels within the spot area, thereby obtaining the coordinates of the energy center.
[0155] Step 407: Combine the ellipticity of the light spot, the luminous flux distribution characteristics, and the energy center coordinates to form light spot morphology feature data.
[0156] In this embodiment of the application, the three parameters of the calculated spot ellipticity, luminous flux distribution characteristics and energy center coordinates are standardized and combined into a complete spot morphology feature dataset.
[0157] Here is a specific example:
[0158] Taking the inspection station of a lottery production line as an example, when a well-packaged lottery ticket passes through the inspection area, the linear array sensor collects transmitted light spot images at two wavelengths: 850 nm and 550 nm. First, the images of these two wavelengths are preprocessed using an image morphology processing algorithm. A 3x3 circular structuring element is used to first perform an expansion operation to fill the holes and then an erosion operation to eliminate noise points. The two preprocessed wavelength images are then superimposed and averaged, with the 850 nm image weight set to 0.6 and the 550 nm image weight set to 0.4, to obtain the fused image. Spatial difference processing is performed on the fused image. A 3x3 difference operator is used to calculate the average grayscale difference between each pixel and its eight surrounding pixels to obtain the difference-processed image. The light spot contour information and light spot region are identified from the difference-processed image. Based on the light spot contour information, the ellipticity of the light spot is calculated using the formula: ellipticity equals 4π times the area divided by the square of the perimeter. Here, the area refers to the total number of pixels contained in the light spot region, which is 400 square pixels, and the perimeter refers to the total length of the boundary formed by connecting the light spot contour pixels, which is 80 pixels. Substituting these values into the formula, the ellipticity is calculated to be 4π / 4. Multiplying by 400 and dividing by 6400 yields approximately 0.92. The grayscale distribution characteristics within the spot area are analyzed, and the number of pixels corresponding to each of the 256 grayscale levels is counted. Based on the grayscale distribution characteristics, the luminous flux distribution characteristics are statistically analyzed to obtain the distribution curve. The grayscale weighted center point coordinates of the spot area are calculated using the formula: the X-coordinate equals the sum of the products of all pixel x-coordinates and grayscale values divided by the sum of all pixel grayscale values; the Y-coordinate equals the sum of the products of all pixel y-coordinates and grayscale values divided by the sum of all pixel grayscale values. The total sum of x-coordinates is 50000, the total sum of y-coordinates is 40000, and the total sum of grayscale values is 32000. The calculated energy center coordinates are 156.25 and 125.00. Finally, the spot ellipticity of 0.92, the luminous flux distribution characteristic curve, and the energy center coordinates of 156.25 and 125.00 are combined to form complete spot morphology feature data, providing input for subsequent deviation calculations.
[0159] In this embodiment, the extraction quality of light spot features is effectively improved by combining multi-wavelength image fusion with spatial difference processing, providing an accurate and reliable data foundation for subsequent sealing detection.
[0160] To further improve the image preprocessing quality, in some embodiments, step 401: preprocessing the multi-wavelength transmission spot image using an image morphology processing algorithm includes:
[0161] Step 501: Using multi-scale circular structural elements, dilate the transmission spot image of each wavelength in the multi-wavelength transmission spot image, and then erode the dilated transmission spot images.
[0162] In step 501, the multi-scale circular structuring element refers to a circular template with different diameters, used to extract image features of different sizes. Dilation is the process of expanding bright areas in an image, while erosion is the process of shrinking bright areas in an image.
[0163] In this embodiment, a small circular structuring element is first used to dilate the transmitted light spot image for each wavelength to fill the tiny holes. Then, an erosion operation is performed using a structuring element of the same size to restore the original shape. Next, a large structuring element is used to repeat the above process to process larger features.
[0164] Step 502: Weighted grayscale superposition of the etched images at different wavelengths to obtain the superimposed image.
[0165] In step 502, weighted grayscale overlay refers to the process of fusing the grayscale values of multiple images according to preset weights.
[0166] In this embodiment, images subjected to erosion at different wavelengths are assigned different weight coefficients according to their wavelength characteristics. Then, the gray value of each pixel is weighted and calculated. Finally, all weighted images are merged into a superimposed image.
[0167] Step 503: Calculate the adaptive average gray value of each pixel in the superimposed image.
[0168] In step 503, the adaptive average gray value refers to the average gray value dynamically calculated based on the characteristics of the pixel's surrounding area.
[0169] In this embodiment, a local window is taken centered on each pixel, and the average gray value of all pixels within the window is calculated. This average value is used as the adaptive average gray value of the pixel, and the window size is dynamically adjusted according to the image characteristics.
[0170] Step 504: Based on the adaptive average gray value, perform adaptive contrast enhancement on the superimposed image to obtain a preprocessed multi-wavelength transmission spot image.
[0171] In step 504, adaptive contrast enhancement refers to the process of dynamically adjusting the image contrast based on local grayscale features.
[0172] In this embodiment, a contrast enhancement coefficient is calculated based on the adaptive average gray value of each pixel, and then this coefficient is used to adjust the gray value of the pixel and its surrounding area to make the image features more obvious.
[0173] Here is a specific example:
[0174] The system first processes the transmitted light spot images at two wavelengths, 850 nm and 550 nm, using multi-scale circular structuring elements. A 3x3 structuring element is used to dilate the 850 nm image to fill small holes, followed by erosion to eliminate noise. Then, a 5x5 structuring element is used to repeat the process for larger features, with the same procedure applied to the 550 nm image. The eroded images at different wavelengths are then weighted and superimposed, with a weight of 0.6 for the 850 nm image and 0.4 for the 550 nm image. The superposition formula is: superimposed image = 0.6 x 850 nm image + 0.4 x 550 nm image. The adaptive average gray value of each pixel in the superimposed image is calculated. A 3x3 local window is taken centered on each pixel, and the gray values of the nine pixels within the window are calculated. The arithmetic mean of the gray values is calculated using the formula: the average gray value equals the sum of the gray values of all pixels within the window divided by 9. For example, a pixel with an original gray value of 120 has eight surrounding pixels with gray values of 115, 118, 122, 119, 121, 117, 123, and 116, resulting in an average gray value of 119. Adaptive contrast enhancement is then applied to the superimposed image based on the adaptive average gray value. The enhancement coefficient is 1.5 when the average gray value is below 100, 1.2 when it is between 100 and 200, and 1.0 when it is above 200. The enhancement formula is: the new gray value equals the original gray value multiplied by the enhancement coefficient. For the pixel with an average gray value of 119, a 1.2-fold enhancement coefficient is used to enhance its original gray value of 120 to 144. Finally, a preprocessed multi-wavelength transmitted light spot image is obtained, showing significantly improved image quality and laying the foundation for subsequent feature extraction.
[0175] In this embodiment, the image quality is effectively improved by combining multi-scale morphological processing and adaptive enhancement, providing a clearer and more reliable image foundation for subsequent feature extraction.
[0176] To address the issue of the rationality of multi-dimensional deviation fusion, in some embodiments, step 103: using a fuzzy logic control model to weight and combine the ellipticity deviation, the distribution deviation, and the positional deviation to generate a transmission characteristic deviation, includes:
[0177] Step 601: Input the ellipticity deviation, the distribution deviation, and the position deviation into the fuzzy logic control model. Convert each deviation into a corresponding fuzzy membership degree through the fuzzification layer of the fuzzy logic control model to form a fuzzy set of deviations.
[0178] In step 601, fuzzy membership degree refers to the degree to which a precise numerical value belongs to a certain fuzzy concept, and its value ranges from 0 to 1. The set of fuzzified deviations is a set composed of multiple fuzzy membership degrees corresponding to each deviation.
[0179] In this embodiment, the ellipticity deviation, distribution deviation, and position deviation are input into the fuzzy logic control model. The precise value of each deviation is converted into the membership degree of the corresponding fuzzy set through the preset membership function in the fuzzification layer, forming a fuzzy set containing multiple membership degree values.
[0180] Step 602: Based on the preset fuzzy rule base in the fuzzy logic control model, perform inference calculation on the fuzzified deviation set.
[0181] In step 602, the fuzzy rule base is a collection of multiple if-law rules used to describe the fuzzy relationship between the input and the output.
[0182] In this embodiment of the application, the fuzzy set of deviation values is input into the fuzzy inference engine. The engine matches the values according to the preset rules in the rule base, finds the applicable rules, and performs inference calculations to obtain the fuzzy set of output variables.
[0183] Step 603: Convert the inference results into weight coefficients through the defuzzification layer of the fuzzy logic control model.
[0184] In step 603, the weighting coefficients are numerical values representing the importance of each deviation, which are obtained from the fuzzy set through defuzzification processing.
[0185] In this embodiment of the application, the output fuzzy set obtained by reasoning is input into the defuzzification layer, the centroid method is used to calculate the centroid position of the fuzzy set, and the precise value corresponding to the position is used as the weight coefficient of each deviation.
[0186] Step 604: Based on the weighting coefficients, perform a weighted fusion calculation on the ellipticity deviation, the distribution deviation, and the position deviation to generate the transmission characteristic deviation.
[0187] In step 604, weighted fusion calculation refers to the process of combining multiple deviations into a single value according to weighting coefficients.
[0188] In this embodiment of the application, the obtained weighting coefficients are multiplied by the corresponding deviations, and then all the product results are added together to obtain the final transmission characteristic deviation value.
[0189] Here is a specific example:
[0190] The calculated ellipticity deviation (0.03), distribution deviation (0.08), and position deviation (5.42) are input into the fuzzy logic control model. First, the model's fuzzification layer converts each deviation into a corresponding fuzzy membership degree. Specifically, the ellipticity deviation (0.03) has a membership degree of 0.8 for small deviations and 0.2 for medium deviations; the distribution deviation (0.08) has a membership degree of 0.7 for low deviations and 0.3 for medium deviations; and the position deviation (5.42) has a membership degree of 0.9 for large deviations and 0.1 for medium deviations, forming the fuzzified deviations. The set of weights is based on a pre-defined fuzzy rule base in the fuzzy logic control model. This rule base contains 27 rules. For example, if the ellipticity deviation is small, the distribution deviation is low, and the position deviation is large, the weight combination is [0.3, 0.4, 0.3]. Inference calculations are performed on the fuzzified set of deviations to match applicable rules. The inference results are converted into precise weight coefficients using the centroid method in the model's defuzzification layer. The weights for ellipticity deviation (0.3), distribution deviation (0.4), and position deviation (0.3) are calculated. A weighted fusion calculation is then performed based on these weight coefficients, using the following formula: ,in This indicates that the weight of the ellipticity deviation is 0.3. This indicates that the ellipticity deviation is measured to be 0.03. The weight of the distribution deviation is 0.4. This indicates that the distribution deviation is taken as 0.08. This indicates that the weight of the position deviation is 0.3. The positional deviation is taken as 5.42. Substituting it into the formula, the transmission characteristic deviation is calculated to be 0.3 multiplied by 0.03 plus 0.4 multiplied by 0.08 plus 0.3 multiplied by 5.42, which equals 1.65. The final transmission characteristic deviation value is generated for subsequent defect judgment.
[0191] In this embodiment of the application, intelligent weight allocation of each deviation quantity is realized through fuzzy logic reasoning, so that the fusion result can better reflect the real sealing state and improve the accuracy of detection and judgment.
[0192] To achieve precise automatic sorting, in some embodiments, step 105: generating sorting instructions based on the defect type and the location coordinates, and controlling the actuator based on the sorting instructions to complete the automatic sorting of the entire package of instant lottery tickets, includes:
[0193] Step 701: Generate a corresponding sorting grade code based on the defect type. The sorting grade code includes a complete rejection code and a partial rejection code.
[0194] In step 701, the sorting level code is a processing level identifier based on the severity of the defect. A complete rejection code indicates that the entire package of products needs to be removed, while a partial rejection code indicates that only the defect location needs to be marked.
[0195] In this embodiment of the application, the system queries a preset defect level comparison table based on the identified defect type, finds the corresponding processing level, and generates the corresponding sorting level code.
[0196] Step 702: Generate sorting instructions based on the sorting grade code and the location coordinates.
[0197] In this embodiment of the application, the sorting grade code is combined with the defect location coordinates, and information such as timestamp and product number is added to form a complete sorting instruction data packet.
[0198] Step 703: Convert the sorting instruction into a control signal that can be recognized by the actuator.
[0199] In step 703, the control signal is a signal format that converts the sorting instructions into a signal format that the actuator can directly recognize.
[0200] In this embodiment, a specific encoding protocol is used to convert the sorting instructions and generate binary control signals containing information such as position coordinates, action type, and parameter settings.
[0201] Step 704: Transmit the control signal to the control system of the actuator in real time, and drive the multi-axis robot to position itself at the defective packaging location according to the three-dimensional position information in the sorting instruction.
[0202] In step 704, the three-dimensional position information refers to the spatial coordinates of the defect on the entire package of lottery tickets. This information is obtained from the two-dimensional image coordinates through coordinate transformation, specifically including the X-axis horizontal position, Y-axis vertical position, and Z-axis depth information. The X and Y coordinates are directly derived from the pixel coordinates of the defect location in the image coordinate system, which are then proportionally converted to obtain the actual millimeter coordinates. The Z-axis depth information is obtained through parallax calculation of multi-angle transmitted light spot images, ultimately forming three-dimensional coordinate data capable of accurately locating the defect's spatial position. The defect packaging position refers to the specific physical coordinates of the entire package of lottery tickets on the sorting line, while the sealed defect area refers to the image coordinates of the specific defect location detected on the lottery ticket packaging film.
[0203] In this embodiment of the application, the control system parses the received control signal, extracts the three-dimensional position information therein, and drives the multi-axis robot to move to the specified coordinate position.
[0204] Step 705: Based on the location of the defective packaging, select the corresponding sorting mode from the sorting level codes: When it is a complete rejection code, control the vacuum suction cup to pick up the entire package of instant lottery tickets and move it to the waste area. When it is a partial rejection code, control the laser marking device to mark the location of the defective packaging.
[0205] In step 705, the sorting mode is the specific operating method selected based on the sorting grade code. Vacuum suction cups are deployed on the end effector of the multi-axis robot for handling entire packages of lottery tickets. Laser marking devices are deployed at fixed positions beside the sorting line for marking defective packages.
[0206] In this embodiment, when the sorting grade code is completely rejected, the vacuum suction cup adsorption device is activated to move the defective product to the waste area; when it is partially rejected, the laser marking device is controlled to mark the defective location.
[0207] Step 706: Verify the completion status of the sorting operation using photoelectric sensors and feed the verification result back to the control system.
[0208] In step 706, a photoelectric sensor is deployed at the end of the actuator to detect the sorting completion status. The sorting operation completion status refers to the result feedback after the actuator completes the specified action.
[0209] In this embodiment, the photoelectric sensor detects the execution result of the sorting action and feeds the detection signal back to the control system, which records the sorting completion status.
[0210] Here is a specific example:
[0211] Upon receiving the identified incomplete heat seal defect and its location coordinates 135 and 105, the system first generates a corresponding sorting level code based on the defect type. Since incomplete heat seal is a serious defect, a complete rejection code 1 is generated. Based on the sorting level code 1 and location coordinates 135 and 105, a sorting instruction is generated. This instruction includes action type code 1 and location coordinate data 135 and 105. The sorting instruction is converted into a control signal recognizable by the actuator, using a binary encoding format. The first four bits (1101) represent the action type, the middle twelve bits (001011010000) represent the location coordinates, and the last four bits (0001) represent the checksum, forming the complete control signal 110100101101000. 00001; The control signal is transmitted to the control system of the actuator in real time. The system resolves the three-dimensional position information as X coordinate 135 mm, Y coordinate 105 mm, and Z coordinate 0 mm, driving the six-axis robot to move to the designated position; Based on the defective packaging position, the corresponding sorting mode is selected from the sorting level code. Since the code is 1, the complete rejection mode is selected. The vacuum suction cup is controlled to pick up the whole package of instant lottery tickets with a negative pressure of 80 kPa, and the robot moves it to the waste area; The completion status of the sorting operation is verified by photoelectric sensors. When the lottery ticket passes through the waste area entrance, the sensor generates a high-level signal and feeds back the verification result to the control system. The system records the sorting completion timestamp and operation result, thus completing the entire automatic sorting process.
[0212] In this embodiment, the combination of a graded processing mechanism and precise positioning control enables rapid and accurate sorting of defective products, ensuring the continuous and stable operation of the production line.
[0213] Figure 3 A schematic diagram of an automatic sorting system for instant lottery tickets with packaging seal detection provided in this application embodiment is shown. The specific implementation section describes the following:
[0214] The acquisition module 31 is used to acquire light spot morphology feature data and multi-wavelength transmitted light spot images through the whole package of instant lottery packaging film. The light spot morphology feature data includes: light spot ellipticity, light flux distribution characteristics and energy center coordinates.
[0215] The comparison module 32 is used to compare the ellipticity of the light spot and the luminous flux distribution characteristics with the preset standard ellipticity reference value and the preset standard luminous flux distribution template, respectively, to obtain the ellipticity deviation and the distribution deviation, and to calculate the Euclidean distance between the energy center coordinates and the preset standard coordinates to obtain the position deviation.
[0216] The combination module 33 is used to use a fuzzy logic control model to perform a weighted combination of the ellipticity deviation, the distribution deviation, and the position deviation to generate a transmission characteristic deviation.
[0217] The identification module 34 is used to identify the sealing defect area from the multi-wavelength transmission spot image based on the transmission characteristic deviation and using a pre-built packaging film transmission model, and to determine the defect type and location coordinates based on the sealing defect area.
[0218] The generation module 35 is used to generate sorting instructions based on the defect type and the location coordinates, and to control the execution mechanism to complete the automatic sorting of the whole package of instant lottery tickets based on the sorting instructions.
[0219] The automatic sorting system for ready-to-open lottery tickets with packaging seal detection in this application embodiment is used to implement the aforementioned automatic sorting method for ready-to-open lottery tickets with packaging seal detection. Therefore, the specific implementation of the automatic sorting system for ready-to-open lottery tickets with packaging seal detection can be found in the embodiment section of the automatic sorting method for ready-to-open lottery tickets with packaging seal detection above. The specific implementation can be referred to the description of the corresponding embodiments, and will not be repeated here.
[0220] This application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of the above-described automatic sorting method for instant lottery tickets with packaging seal detection.
[0221] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described automatic sorting method for packaged instant lottery tickets with packaging seal detection.
[0222] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory, random access memory, portable hard drives, magnetic disks, or optical disks.
[0223] The embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the automatic sorting method for fully packaged instant lottery tickets with packaging seal detection.
[0224] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0225] The above provides a detailed description of the automatic sorting method, system, electronic device, and storage medium for instant lottery tickets with packaging seal detection provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.
Claims
1. An automatic sorting method for whole packages of instant lottery tickets with packaging seal detection, characterized in that, include: Acquire light spot morphology data and multi-wavelength transmitted light spot images through the packaging film of an instant lottery ticket. The light spot morphology data includes: light spot ellipticity, luminous flux distribution characteristics, and energy center coordinates. The ellipticity of the light spot and the luminous flux distribution characteristics are compared with the preset standard ellipticity reference value and the preset standard luminous flux distribution template, respectively, to obtain the ellipticity deviation and the distribution deviation. The Euclidean distance between the energy center coordinates and the preset standard coordinates is calculated to obtain the position deviation. Using a fuzzy logic control model, the ellipticity deviation, the distribution deviation, and the positional deviation are weighted and combined to generate the transmission characteristic deviation. Based on the transmission characteristic deviation, using a pre-constructed packaging film transmission model, the sealing defect area is identified from the multi-wavelength transmission spot image, and the defect type and location coordinates are determined based on the sealing defect area; Based on the defect type and the location coordinates, a sorting instruction is generated, and the execution mechanism is controlled based on the sorting instruction to complete the automatic sorting of the entire package of instant lottery tickets.
2. The method according to claim 1, characterized in that, The step of identifying sealing defect areas from the multi-wavelength transmitted light spot image based on the transmission characteristic deviation using a pre-constructed packaging film transmission model, and determining the defect type and location coordinates based on the sealing defect areas, includes: The transmission characteristic deviation is compared with multiple preset deviation thresholds in a graded manner. When the graded comparison result indicates that the transmission characteristic deviation is greater than the preset first-level threshold, the corresponding position in the multi-wavelength transmission spot image is marked as a preliminary suspicious area. Based on the packaging film transmission model, multi-scale morphological analysis is performed on the initially suspected area to obtain the area shape factor and texture feature parameters. Based on the area shape factor and texture feature parameters, area feature data is generated. The regional feature data is input into a deep learning classification network, and the deep learning classification network performs deep feature extraction and classification on the regional feature data, outputting a regional defect probability score. The defect probability score of the region is matched and compared with the standard feature data stored in the packaging film transmission model. Based on the matching and comparison results, the sealing defect region is identified. The defect type is determined based on the image feature patterns of the sealing defect area; A connected component analysis is performed on the sealing defect region to calculate the minimum bounding rectangle of the sealing defect region in the image coordinate system; The location coordinates of the defect are determined based on the geometric center coordinates and dimensions of the minimum bounding rectangle.
3. The method according to claim 2, characterized in that, The step of inputting the regional feature data into a deep learning classification network, extracting and classifying the regional feature data through the deep learning classification network, and outputting a regional defect probability score includes: The region feature data is input into a deep learning classification network, and the region feature data is extracted layer by layer through multiple convolutional layers of the deep learning classification network to obtain a multi-level feature representation. The attention mechanism in the deep learning classification network is used to adaptively weight and fuse the multi-level feature representations to generate fused features. The fused features are nonlinearly transformed through the fully connected layer of the deep learning classification network to obtain a deep feature representation; The probability classifier in the deep learning classification network is used to calculate the deep feature representation, generate the probability distribution of each defect category, and extract the maximum probability value from the probability distribution as the regional defect probability score.
4. The method according to claim 1, characterized in that, The acquisition of light spot morphology data and multi-wavelength transmitted light spot images through the packaging film of the instant lottery ticket includes: The multi-wavelength transmitted light spot image is preprocessed using an image morphology processing algorithm; The images of the same location at different wavelengths in the preprocessed multi-wavelength transmission spot image are superimposed and averaged to obtain the fused image; The fused image is then subjected to spatial difference processing to obtain a difference-processed image; Identify the light spot contour information and light spot region from the image after differential processing, and calculate the light spot ellipticity based on the light spot contour information; Analyze the grayscale distribution characteristics within the light spot area, and statistically analyze the luminous flux distribution characteristics based on the grayscale distribution characteristics; Calculate the gray-weighted center point coordinates of the light spot region, and use the gray-weighted center point coordinates as the energy center coordinates; The ellipticity of the light spot, the luminous flux distribution characteristics, and the coordinates of the energy center are combined to form light spot morphology characteristic data.
5. The method according to claim 4, characterized in that, The preprocessing of the multi-wavelength transmitted light spot image using an image morphology processing algorithm includes: Using multi-scale circular structural elements, a dilation operation is performed on the transmission spot image of each wavelength in the multi-wavelength transmission spot image, and an erosion operation is performed on each dilated transmission spot image. The images obtained after etching at different wavelengths are weighted and superimposed to obtain the superimposed image; Calculate the adaptive average gray value of each pixel in the superimposed image; Based on the adaptive average gray value, the superimposed image is subjected to adaptive contrast enhancement to obtain a preprocessed multi-wavelength transmission spot image.
6. The method according to claim 1, characterized in that, The method of using a fuzzy logic control model to weight and combine the ellipticity deviation, the distribution deviation, and the positional deviation to generate transmission characteristic deviation includes: The ellipticity deviation, the distribution deviation, and the position deviation are input into the fuzzy logic control model. The fuzzification layer of the fuzzy logic control model converts each deviation into a corresponding fuzzy membership degree, forming a fuzzy set of deviations. Based on the preset fuzzy rule base in the fuzzy logic control model, inference calculations are performed on the fuzzified deviation set; The reasoning results are converted into weight coefficients through the defuzzification layer of the fuzzy logic control model. Based on the weighting coefficients, the ellipticity deviation, the distribution deviation, and the position deviation are weighted and fused to generate the transmission characteristic deviation.
7. The method according to claim 1, characterized in that, The process of generating sorting instructions based on the defect type and the location coordinates, and controlling the actuator based on the sorting instructions to complete the automatic sorting of the entire package of instant lottery tickets, includes: Based on the defect type, a corresponding sorting grade code is generated, which includes a complete rejection code and a partial rejection code. Based on the sorting grade code and the location coordinates, a sorting instruction is generated; The sorting instructions are converted into control signals that can be recognized by the actuator; The control signal is transmitted to the control system of the actuator in real time, and the multi-axis robot is driven to position itself to the defective packaging location according to the three-dimensional position information in the sorting instruction; Based on the location of the defective packaging, the corresponding sorting mode is selected from the sorting level code: when it is a complete rejection code, the vacuum suction cup is controlled to pick up the whole package of instant lottery tickets and move it to the waste area; when it is a partial rejection code, the laser marking device is controlled to mark the location of the defective packaging. The completion status of the sorting operation is verified by photoelectric sensors, and the verification result is fed back to the control system.
8. An automatic sorting system for instant lottery tickets with packaging seal detection, characterized in that, include: The acquisition module is used to acquire light spot morphology feature data and multi-wavelength transmitted light spot images through the whole package of instant lottery packaging film. The light spot morphology feature data includes: light spot ellipticity, luminous flux distribution characteristics and energy center coordinates. The comparison module is used to compare the ellipticity of the light spot and the luminous flux distribution characteristics with the preset standard ellipticity reference value and the preset standard luminous flux distribution template, respectively, to obtain the ellipticity deviation and the distribution deviation, and to calculate the Euclidean distance between the energy center coordinates and the preset standard coordinates to obtain the position deviation. The combination module is used to use a fuzzy logic control model to weight and combine the ellipticity deviation, the distribution deviation, and the position deviation to generate the transmission characteristic deviation. The identification module is used to identify sealing defect areas from the multi-wavelength transmitted light spot image based on the transmission characteristic deviation and using a pre-constructed packaging film transmission model, and to determine the defect type and location coordinates based on the sealing defect areas; The generation module is used to generate sorting instructions based on the defect type and the location coordinates, and to control the execution mechanism to complete the automatic sorting of the entire package of instant lottery tickets based on the sorting instructions.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the automatic sorting method for whole-package instant lottery tickets with packaging seal detection as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, enables the automatic sorting method for packaged instant lottery tickets with packaging seal detection as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Small-angle X-ray scattering measurement device and method based on multi-beam incidence
CN118328914A
Pixel-region-to-be-changed extraction device, image processing system, pixel-region-to-be-changed extraction method, image processing method, and program
JP2020057037A