Contact lens packaging box sealing detection system based on machine vision
Automatically detect the sealing of contact lens packaging boxes through the machine vision detection system, solving the problems of low manual detection efficiency and insufficient accuracy, and achieving efficient and accurate sealing detection.
Patent Information
- Application Number
- CN202510453864.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-07-29
AI Technical Summary
The sealing inspection of existing contact lens packaging boxes relies on manual visual inspection with low efficiency, insufficient accuracy and poor mechanical inspection flexibility, making it difficult to adapt to different specifications and identify subtle defects.
The machine vision-based detection system is adopted, including preprocessing module, positioning module, defect detection module and defect analysis module, and automated detection is achieved through image preprocessing, sealing area positioning, defect detection and feature analysis.
It improves the accuracy and efficiency of inspection, improves production efficiency and product quality, and realizes automatic inspection of packaging boxes of different specifications.
Smart Images

Figure CN120387988A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine vision, and more specifically, to a sealing detection system for contact lens packaging boxes based on machine vision. Background Art
[0002] As a medical product that directly contacts the eyes, the sealing of contact lens packaging is crucial for the safety and hygiene of the product. Currently, the sealing detection of contact lens packaging boxes mainly relies on manual visual inspection or simple mechanical detection methods, which have the following problems:
[0003] Low efficiency of manual detection: The speed of manual visual inspection is slow, making it difficult to meet the requirements of large-scale production.
[0004] Insufficient detection accuracy: Manual detection is easily affected by fatigue and subjective factors, resulting in missed or false detections.
[0005] Poor flexibility of mechanical detection: Traditional mechanical detection methods are difficult to adapt to packaging boxes of different specifications and cannot identify subtle sealing defects. Summary of the Invention
[0006] In view of this, the purpose of the present invention is to provide a sealing detection system for contact lens packaging boxes based on machine vision to solve the problems in the background art.
[0007] To achieve the above purpose, the present invention adopts the following technical solutions:
[0008] A sealing detection system for contact lens packaging boxes based on machine vision of the present invention includes the following steps:
[0009] A preprocessing module for preprocessing the collected image of the packaging box seal to obtain a preprocessed image;
[0010] A positioning module for extracting the seal area and the center of the seal area of the preprocessed image;
[0011] A defect detection module for detecting defects in the seal area based on a pre-constructed defect detection model to obtain a detection result;
[0012] A defect analysis module for extracting candidate defect features from the detection result and analyzing the candidate defect features based on the center of the seal area and pre-configured defect screening parameters to obtain defect features within the seal area.
[0013] In an embodiment of the present application, preprocessing the collected image of the packaging box seal to obtain a preprocessed image includes:
[0014] Loading and decoding the collected image of the packaging box seal to obtain an image in a target format;
[0015] Perform Gaussian filtering on the target format image to obtain a preprocessed image.
[0016] In an embodiment of the present application, extracting the sealing area and the center of the sealing area of the preprocessed image includes:
[0017] Perform adaptive threshold binaryzation processing on the preprocessed image to obtain a binary image;
[0018] Extract the contour features in the binary image;
[0019] Filter the contour features based on preconfigured contour filtering parameters to obtain the lower border contour and the right border contour that meet the preconfigured contour filtering parameters;
[0020] Calculate the circumscribed rectangles of the lower border contour and the right border contour respectively to obtain the geometric parameters of the circumscribed rectangles, where the geometric parameters include the upper left coordinate point, the length, and the width;
[0021] Construct the center coordinates of the sealing area based on the geometric parameters of the circumscribed rectangle of the lower border contour and the geometric parameters of the circumscribed rectangle of the right border contour;
[0022] Construct the sealing area based on the center coordinates of the sealing area and the preset inner and outer ring radii of the sealing area.
[0023] In an embodiment of the present application, the calculation formula for the center coordinates C(c x , c y ) of the sealing area is:
[0024] c x = x right + w right + α
[0025] c y = y down + h down + β
[0026] In the formula, x right is the abscissa of the upper left coordinate point of the circumscribed rectangle of the right border contour, w right is the width of the circumscribed rectangle of the right border contour, y down is the ordinate of the upper left coordinate point of the circumscribed rectangle of the lower border contour, h down is the height of the circumscribed rectangle of the lower border contour, and both α and β are preset position deviation parameters.
[0027] In an embodiment of the present application, defect detection is performed on the sealing area based on a pre-constructed defect detection model to obtain a detection result, including:
[0028] Compare the size of the preprocessed image with a preset size, and when the size of the preprocessed image is inconsistent with the preset size, adjust the size of the preprocessed image to be consistent with the preset size;
[0029] When the size of the preprocessed image is consistent with the preset size, use the sealing area in the preprocessed image as the region of interest, and input the preprocessed image into the pre-constructed defect detection model to obtain a detection result, where the detection result includes multiple candidate defects.
[0030] In an embodiment of the present application, extracting candidate defect features from the detection result includes:
[0031] Calculate the circumscribed rectangle of each candidate defect in the detection result, and crop the preprocessed image based on the circumscribed rectangle of the candidate defect to obtain multiple defect images;
[0032] Perform adaptive threshold binaryzation on the defect image to obtain a binary defect image; and extract the contour of the binary defect image;
[0033] Extract the geometric features, gray features, and shape features of the contour of the binary defect image to obtain candidate defect features, where the geometric features include the minimum length, aspect ratio, and roundness; the gray features include the average gray value, gray variance, maximum gray value, and minimum gray value; the shape features include the center coordinates of the contour.
[0034] In an embodiment of the present application, analyzing the candidate defect features based on the center of the sealing area and pre-configured defect screening parameters to obtain defect features within the sealing area, including:
[0035] Calculate the Euclidean distance d between the center coordinates of the contour and the center of the sealing area, and use the candidate defect with the Euclidean distance d satisfying R1 < d < R2 as a valid defect, where R1 is the inner ring radius parameter and R2 is the outer ring radius parameter;
[0036] Compare the gray features and geometric features of the valid defect with pre-configured gray verification parameters and geometric verification parameters respectively, and when the gray features and geometric features of the valid defect match the pre-configured gray verification parameters and geometric verification parameters respectively, use the defect features of the valid defect as the defect features within the sealing area.
[0037] In an embodiment of the present application, it further includes:
[0038] Take the defect features within the sealing area as the output result, and output the result after information encapsulation of the output structure.
[0039] In an embodiment of the present application, when the number of candidate defects in the detection result is 0, the detection process is ended and the passing information is returned.
[0040] In an embodiment of the present application, when the number of defect features within the sealing area is 0, the detection process is ended and the passing information is returned.
[0041] The beneficial effects of the present invention are as follows: A sealing detection system for contact lens packaging boxes based on machine vision according to the present invention first preprocesses the collected packaging box sealing image using a preprocessing module to obtain a preprocessed image; then extracts the sealing area and the center of the sealing area of the preprocessed image through a positioning module; next, uses a defect detection module to perform defect detection on the sealing area based on a pre-constructed defect detection model to obtain a detection result; finally, extracts the candidate defect features in the detection result through a defect analysis module, and analyzes the candidate defect features based on the center of the sealing area and pre-configured defect screening parameters to obtain the defect features within the sealing area. This application is based on image acquisition, processing, and analysis technologies to achieve automatic detection of packaging box seals. Compared with traditional manual detection methods, this application has the advantages of high accuracy, high efficiency, and high automation, and can greatly improve production efficiency and product quality. Description of the Drawings
[0042] The present invention will be further described below in conjunction with the drawings and embodiments:
[0043] Figure 1 It is a structural diagram of a sealing detection system for contact lens packaging boxes based on machine vision shown in an embodiment of the present application;
[0044] Figure 2 It is a schematic diagram of the initialization configuration process in an embodiment of the present application;
[0045] Figure 3 It is a schematic diagram of the positioning process in an embodiment of the present application;
[0046] Figure 4 It is a schematic diagram of the sealing area effect in an embodiment of the present application;
[0047] Figure 5 It is a schematic diagram of the defect detection process in an embodiment of the present application;
[0048] Figure 6 It is a schematic diagram of the defect analysis process in an embodiment of the present application;
[0049] Figure 7 It is a schematic diagram of the defect advance process in an embodiment of the present application. Detailed implementation manners
[0050] The following uses specific specific examples to illustrate the implementation manners of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific implementation manners. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other.
[0051] It should be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner. Therefore, only the layers related to the present invention are shown in the diagrams, rather than being drawn according to the number, shape, and size of the layers in actual implementation. The type, quantity, and ratio of each layer in actual implementation can be arbitrarily changed, and the layer layout type may also be more complex.
[0052] In the following description, a large number of details are explored to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details.
[0053] Figure 1 is a structural diagram of a contact lens packaging box sealing detection system based on machine vision shown in an embodiment of the present application, as Figure 1 shown: A contact lens packaging box sealing detection system based on machine vision in this embodiment includes:
[0054] A preprocessing module, configured to preprocess the collected packaging box sealing image to obtain a preprocessed image;
[0055] A positioning module, configured to extract the sealing area and the center of the sealing area of the preprocessed image;
[0056] A defect detection module, configured to perform defect detection on the sealing area based on a pre-constructed defect detection model to obtain a detection result;
[0057] A defect analysis module, configured to extract candidate defect features in the detection result, and analyze the candidate defect features based on the center of the sealing area and pre-configured defect screening parameters to obtain defect features in the sealing area;
[0058] A result output module, configured to use the defect features in the sealing area as an output result, and output the output result after information encapsulation.
[0059] Among them, the preprocessing module is responsible for initializing and configuring the detection system, as well as reading, loading, and denoising the packaging box sealing images collected by the camera, so as to reduce the interference caused by environmental noise. The positioning module binarizes the preprocessed image, extracts the features of the sealing area, and calculates the center of the sealing area. The defect detection module sends the image to the cloud server, and uses a deep learning object detection algorithm combined under this server to detect the defects (such as abnormal pressing and foreign objects) in the sealing area, and outputs the inference result. The defect analysis module uses the inference result in the defect detection module to extract the defect features, filters and screens the candidate defect features using the parameters pre-configured in A, and judges whether there are defects in the sealing image.
[0060] The specific implementation process is as follows:
[0061] A. Preprocessing: Responsible for loading and denoising the image; initializing the settings of the involved systems and loading the algorithm parameters.
[0062] A1. Initialization configuration
[0063] Figure 2 This is the schematic diagram of the initialization configuration process in an embodiment of the present application. The process of initialization configuration is as Figure 2 shown, including:
[0064] (1) Read the parameter configuration file, which contains algorithm configuration parameters, system setting parameters, etc.
[0065] (2) Load the algorithm parameters from the local file, including extraction parameters and analysis parameters, such as selection threshold Threshold, minimum detection area minArea, shortest detection size minLength, detection aspect ratio range AspRange, detection gray value range GrayRange, detection gray variance range VarRange, detection gradient range GradRange... etc.
[0066] (3) Load the system configuration parameters, and set whether to enable the algorithm, whether to output the image... etc.
[0067] A2. Preprocessing
[0068] (1) Load and decode the collected packaging box sealing image to obtain the target format image;
[0069] (2) Perform Gaussian filtering on the target format image to obtain the preprocessed image. Specifically, perform Gaussian filtering with a kernel of 3×3 on the image to obtain the preprocessed image, aiming to reduce the interference caused by environmental noise.
[0070] In this application, the defect detection area (hereinafter simply referred to as ROI) is the sealing area of the packaging box. The ROI positioning is easily interfered by defects and is inaccurate. Therefore, the outer border of the packaging box is used to position the ROI.
[0071] B. Positioning: Using the physical relative position between the outer border of the packaging box and the sealing area, calculate the center of the ROI and the ROI.
[0072] Figure 3 It is a schematic diagram of the positioning process in an embodiment of this application. As Figure 3 shown, the positioning process in this application includes:
[0073] Perform adaptive threshold binaryzation processing on the preprocessed image to obtain a binary image;
[0074] B1. Extract the contour features in the binary image;
[0075] B2. Screen the contour features based on the preconfigured contour screening parameters to obtain the lower border contour and the right border contour that meet the preconfigured contour screening parameters;
[0076] Specifically, use the pre-loaded sealing geometric feature parameters, including the length, width, and aspect ratio of the contour; sequentially perform parameter verification on all the contours in B2, and respectively screen out the lower and right border contours of the outer border. If no border contour is found, terminate the program and return the result "positioning failed".
[0077] B3. Calculate the circumscribed rectangles of the lower border contour and the right border contour respectively to obtain the geometric parameters of the circumscribed rectangles, where the geometric parameters include the upper left coordinate point, length, and width;
[0078] Among them, the circumscribed rectangle of the border contour is denoted as rect X ={rect down , rect right}, where rect X ={x X , y X , w X , h X}, rect down , rect right respectively represent the circumscribed rectangles of the lower and right borders, x and y respectively represent the upper left coordinate points of the rectangle, and w and h represent the length and width of the rectangle.
[0079] B4. Construct the center coordinates of the sealing area based on the geometric parameters of the circumscribed rectangle of the lower border contour and the geometric parameters of the circumscribed rectangle of the right border contour;
[0080] The calculation formula for the central coordinates C(c x ,c y ) of the sealing area is as follows:
[0081] c x = x right + w right + α
[0082] c y = y down + h down + β
[0083] In the formula, x right is the abscissa of the upper - left coordinate point of the circumscribed rectangle of the right - hand side border contour, w right is the width of the circumscribed rectangle of the right - hand side border contour, y down is the ordinate of the upper - left coordinate point of the circumscribed rectangle of the lower - side border contour, h down is the height of the circumscribed rectangle of the lower - side border contour, and both α and β are preset position deviation parameters.
[0084] α and β respectively represent the deviation amounts between the outer border and the sealing center, which are obtained by averaging multiple measurements of the PP packaging box using a measuring tool.
[0085] B5. Construct a sealing area based on the central coordinates of the sealing area and the preset inner and outer ring radii of the sealing area.
[0086] According to the central point C and the preset inner and outer ring radius parameters R = {R1, R2} of the sealing area in process A, the ROI can be obtained, where R1 is the inner - ring radius parameter and R2 is the outer - ring radius parameter. Figure 4 This is a schematic diagram of the sealing area effect in an embodiment of the present application. The constructed ROI (sealing area) is as Figure 4 shown.
[0087] C. Defect detection: Use a deep - learning object - detection model to extract the sealing defect features.
[0088] Figure 5 This is a schematic diagram of the defect - detection process in an embodiment of the present application. As Figure 5 shown, the process of defect detection includes:
[0089] C1. Load the deep - learning object - detection model YOLOv8.
[0090] C2. Compare the size of the pre - processed image with the preset size, and when the size of the pre - processed image is inconsistent with the preset size, adjust the size of the pre - processed image to make it consistent with the preset size;
[0091] The size - adjustment method can be padding and resizing processing.
[0092] C3. When the size of the preprocessed image is consistent with the preset size, take the sealing area in the preprocessed image as the region of interest, and input the preprocessed image into a pre-constructed defect detection model to obtain a detection result, where the detection result includes multiple candidate defects.
[0093] The detection result is expressed as res = {r1, …, r n}, where r i = {x i , y i , w i , h i , f i , c i} (i ≤ n). x i , y i are the coordinates of the upper left corner of the detection box, w i , h i are the width and height of the detection box respectively, f i is the feature information, and c i is the type information.
[0094] D. Defect analysis: Use the inference result in C to extract candidate defect features, and use the algorithm parameters pre-loaded in A to verify the parameters of the defect features to determine whether there are defects in the image to be tested.
[0095] Figure 6 is a schematic diagram of the defect analysis process in an embodiment of the present application. The defect analysis process is as Figure 6 shown, including:
[0096] D1. Count the number of inference results in C. For the case where the number is less than 1, it is considered that there are no defects in the image, terminate the program and return the result "Pass", otherwise continue.
[0097] D2. Extract the candidate defect features in the detection result. For all inference results res = {r1, …, r n}, extract the defect features in sequence and store them in the feature set. Figure 7 is a schematic diagram of the defect extraction process in an embodiment of the present application. As Figure 7 shown, including:
[0098] D21. Calculate the circumscribed rectangle of each candidate defect in the detection result, and crop the preprocessed image based on the circumscribed rectangle of the candidate defect to obtain multiple defect images;
[0099] Since the inference result r i = {x i , t i , wi ,h i ,f i ,c i}(i≤n),rect=(x i ,y i ,w i ,h i ) represents the circumscribed rectangular frame of the corresponding defect, so rect can be used to crop the image to be tested to obtain the defect image sub.
[0100] D22. Performing adaptive threshold binarization on the defect image to obtain a binary defect image; and extracting the contour of the binary defect image;
[0101] Each sub in a is binarized using an adaptive threshold algorithm and the corresponding contour is extracted.
[0102] D23. Extract the geometric features, grayscale features, and shape features of the contour of the binary defect image to obtain candidate defect features, wherein the geometric features include minimum length, aspect ratio, and roundness; the grayscale features include average grayscale, grayscale variance, maximum grayscale, and minimum grayscale; and the shape features include the center coordinates of the contour.
[0103] The defect geometric features, grayscale features, and shape features are calculated based on the contour as defect features. The geometric features include the minimum length l, aspect ratio aspect, and roundness roundness; the grayscale features include the average grayscale MeanG, variance Var, maximum grayscale MaxG, and minimum grayscale MinG; and the shape features include the center coordinate M of the contour. The expression is as follows:
[0104] f geo =(l,solid,aspect,roundness)
[0105] l=min(w,h)
[0106] f gray =(MeanG,Var,MaxG,MinG)
[0107] MeanG=mean(sub)
[0108] MinG=min(sub)
[0109] MaxG=max(sub)
[0110] M=(m x ,m y )
[0111] D3. Calculate the Euclidean distance d between the central coordinates of the contour and the center of the sealing area, and regard the candidate defects that satisfy R1 < d < R2 as valid defects;
[0112] Specifically, calculate the Euclidean distance d between the center M of the defect contour and the detection center C in sequence. According to the inner and outer ring radius parameters R = {R1, R2} of the preset sealing area in process A, where R1 < R2, if d satisfies R1 < d < R2, it is considered that the defect is a valid defect in the detection area; otherwise, it is not a defect, and this defect is deleted from the defect set.
[0113] D4. Compare the gray-scale features and geometric features of the valid defects with the pre-configured gray-scale verification parameters and geometric verification parameters respectively, and when the gray-scale features and geometric features of the valid defects match the pre-configured gray-scale verification parameters and geometric verification parameters respectively, regard the defect features of the valid defects as the defect features in the sealing area.
[0114] D5. Count the number of defects in the feature set. If the number is greater than 1, return the minimum circumscribed rectangle of the defect contour as the defect annotation box and the result "NG"; otherwise, terminate the program and return the result "Pass".
[0115] E. Result output: Package and output the result in D.
[0116] E1. Combine the system parameters in A to package the output result. If the detection result is "NG", perform information encapsulation on the corresponding defect annotation box.
[0117] E2. Output the product detection result corresponding to the image analyzed in D.
[0118] A sealing detection system for contact lens packaging boxes based on machine vision of the present invention first preprocesses the collected image of the packaging box sealing by using a preprocessing module to obtain a preprocessed image; then extracts the sealing area and the center of the sealing area of the preprocessed image through a positioning module; then, uses a defect detection module to perform defect detection on the sealing area based on a pre-constructed defect detection model to obtain a detection result; finally, extracts the candidate defect features in the detection result through a defect analysis module, and analyzes the candidate defect features based on the center of the sealing area and the pre-configured defect screening parameters to obtain the defect features in the sealing area. This application is based on image acquisition, processing and analysis technologies to realize the automatic detection of the packaging box sealing. Compared with the traditional manual detection method, this application has the advantages of high accuracy, high efficiency and high automation, and can greatly improve production efficiency and product quality.
[0119] This embodiment also provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements any one of the methods in this embodiment, where the method is the execution logic of this system.
[0120] This embodiment also provides an electronic terminal, including: a processor and a memory;
[0121] The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory so that the terminal executes any one of the methods in this embodiment.
[0122] For the computer-readable storage medium in this embodiment, those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to the computer program. The foregoing computer program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the foregoing storage medium includes: ROM, RAM, magnetic disk or optical disc and other media that can store program codes.
[0123] The electronic terminal provided in this embodiment includes a processor, a memory, a transceiver, and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication with each other. The memory is used to store a computer program, the communication interface is used for communication, and the processor and the transceiver are used to run the computer program so that the electronic terminal executes each step of the above method.
[0124] In this embodiment, the memory may include a random access memory (Random Access Memory, abbreviated as RAM), and may also include a non-volatile memory, such as at least one disk memory.
[0125] The above-mentioned processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, abbreviated as CPU), a network processor (Network Processor, abbreviated as NP), etc.; it may also be a digital signal processor (Digital Signal Processing, abbreviated as DSP), an application specific integrated circuit (Application SpecificIntegrated Circuit, abbreviated as ASIC), a field programmable gate array (Field-Programmable Gate Array, abbreviated as FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0126] In the above embodiments, although the present invention has been described in conjunction with specific embodiments of the present invention, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art based on the foregoing description. The embodiments of the present invention are intended to cover all such alternatives, modifications, and variations that fall within the broad scope of the appended claims.
[0127] The above embodiments are only illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Any person familiar with this technology can modify or change the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by those with ordinary knowledge in the technical field without departing from the spirit and technical idea disclosed by the present invention should still be covered by the claims of the present invention.
Claims
1. A contact lens packaging box sealing detection system based on machine vision, characterized in that, Including: A preprocessing module for preprocessing the collected packaging box sealing image to obtain a preprocessed image; A positioning module for extracting the sealing area and the center of the sealing area of the preprocessed image; A defect detection module for performing defect detection on the sealing area based on a pre-constructed defect detection model to obtain a detection result; A defect analysis module for extracting candidate defect features in the detection result and analyzing the candidate defect features based on the center of the sealing area and pre-configured defect screening parameters to obtain defect features within the sealing area.
2. The sealing detection system for contact lens packaging boxes based on machine vision according to claim 1, characterized in that, Preprocessing the collected packaging box sealing image to obtain a preprocessed image, including: Loading and decoding the collected packaging box sealing image to obtain an image in a target format; Performing Gaussian filtering on the image in the target format to obtain a preprocessed image.
3. The sealing detection system for contact lens packaging boxes based on machine vision according to claim 1, wherein Extracting the sealing area and the center of the sealing area of the preprocessed image, including: Performing adaptive threshold binarization processing on the preprocessed image to obtain a binarized image; Extracting contour features in the binarized image; Filtering the contour features based on pre-configured contour screening parameters to obtain a lower side border contour and a right side border contour that meet the pre-configured contour screening parameters; Calculating the circumscribed rectangles of the lower side border contour and the right side border contour respectively to obtain the geometric parameters of the circumscribed rectangles, where the geometric parameters include the upper left coordinate point, the length, and the width; Constructing the center coordinates of the sealing area based on the geometric parameters of the circumscribed rectangle of the lower side border contour and the geometric parameters of the circumscribed rectangle of the right side border contour; Constructing the sealing area based on the center coordinates of the sealing area and the inner and outer ring radii preset inside and outside the sealing area.
4. The sealing detection system for contact lens packaging boxes based on machine vision according to claim 3, characterized in that, The central coordinates C(c x , c y ) of the sealing area are calculated by the following formula: c x = x right + w right + α c y = y down + h down + β where x right is the abscissa of the upper left coordinate point of the circumscribed rectangle of the right border contour, w right is the width of the circumscribed rectangle of the right border contour, y down is the ordinate of the upper left coordinate point of the circumscribed rectangle of the lower border contour, h down is the height of the circumscribed rectangle of the lower border contour, and both α and β are preset position deviation parameters.
5. A sealing detection system for contact lens packaging boxes based on machine vision according to claim 1, characterized in that, Performing defect detection on the sealing area based on a pre-constructed defect detection model to obtain a detection result, including: Comparing the size of the preprocessed image with a preset size, and when the size of the preprocessed image is inconsistent with the preset size, adjusting the size of the preprocessed image to be consistent with the preset size; When the size of the preprocessed image is consistent with the preset size, taking the sealing area in the preprocessed image as the region of interest and inputting the preprocessed image into a pre-constructed defect detection model to obtain a detection result, where the detection result includes a plurality of candidate defects.
6. The seal detection system for contact lens packaging boxes based on machine vision according to claim 1, characterized in that, Extracting candidate defect features in the detection result, including: Calculating the circumscribed rectangles of each candidate defect in the detection result and cropping the preprocessed image based on the circumscribed rectangles of the candidate defects to obtain a plurality of defect images; Performing adaptive threshold binarization processing on the defect images to obtain binarized defect images; and extracting the contours of the binarized defect images; Extracting the geometric features, gray level features, and shape features of the contours of the binarized defect images to obtain candidate defect features, where the geometric features include the minimum length, the aspect ratio, and the roundness; the gray level features include the average gray level, the gray level variance, the maximum gray level, and the minimum gray level; the shape features include the center coordinates of the contour.
7. The sealing detection system for contact lens packaging boxes based on machine vision according to claim 6, characterized in that Analyze the candidate defect features based on the center of the sealing area and pre-configured defect screening parameters to obtain the defect features within the sealing area, including: Calculate the Euclidean distance d between the center coordinates of the contour and the center of the sealing area, and regard the candidate defects that satisfy R1 < d < R2 as valid defects, where R1 is the inner ring radius parameter and R2 is the outer ring radius parameter; Compare the gray-scale features and geometric features of the valid defects with the pre-configured gray-scale verification parameters and geometric verification parameters respectively, and when the gray-scale features and geometric features of the valid defects match the pre-configured gray-scale verification parameters and geometric verification parameters respectively, regard the defect features of the valid defects as the defect features within the sealing area.
8. The sealing detection system for contact lens packaging boxes based on machine vision according to claim 1, characterized in that, It further includes: Regard the defect features within the sealing area as the output result, and output it after information encapsulation of the output structure.
9. The machine vision-based contact lens packaging box sealing detection system according to claim 5, characterized in that When the number of candidate defects in the detection result is 0, end the detection process and return the passing information.
10. A sealing detection system for contact lens packaging boxes based on machine vision according to claim 7, characterized in that, When the number of defect features within the sealing area is 0, end the detection process and return the passing information.
Citation Information
Cited By
Packaging box detection method and device
CN120807499A
Packaging box detection method and device
CN120807499B