Surface printing device and method for packaging box production
By designing a surface printing device for image acquisition from multiple angles in packaging box production, combining similarity and differential processing, the problems of insufficient accuracy and high error detection rate of existing automatic detection methods are solved, and the accurate detection of complex printed materials is achieved and qualification judgment.
Patent Information
- Application Number
- CN202411029510.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-07-30
AI Technical Summary
The existing automatic detection methods based on machine vision have problems such as insufficient accuracy and high error detection rate in the surface quality detection of printed materials, especially in the case of complex and variable printing images and external interference, which are difficult to accurately detect printing defects.
A surface printing device for packaging box production is designed, including a shooting platform, a camera system and a light source system. Through the rotation table and motor driving the angle adjustment of the camera and light source, multi-angle images are collected, combined with similarity and differential processing, Image preprocessing, positioning registration and defect feature extraction to improve detection accuracy.
It improves the accuracy of print product detection and reduces the error detection rate, can accurately extract multiple defect features in complex printed images, and enhances the judgment of print product qualification.
Smart Images

Figure CN118810222B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of surface printing, and in particular to a surface printing device and method for producing packaging boxes. Background Art
[0002] In the process of modern high-speed printing production (speed reaches 200m / min, electric spindle printing reaches 400 / dmin), due to the imperfection of printing technology and the influence of uncertain factors such as production equipment, process flow, and production environment, various printing defects and flaws will inevitably appear in the printing process. At present, most small and medium-sized enterprises in my country still use operator manual sampling to conduct quality inspections, but there are many disadvantages in using this method. For example, the operator's inspection is highly subjective, and the evaluation standards for the same type of printed products may be inconsistent; the reliability is low, the operator's manual sampling method cannot guarantee continuous monitoring of the production line, resulting in a large number of missed inspections, and eye fatigue will cause inconsistent detection rates during the inspection process; the human eye cannot guarantee long-term observation, resulting in low detection efficiency, and the use of sampling can only detect continuous defects but not occasional defects.
[0003] Because manual inspection of printed surface quality has many drawbacks and cannot meet the automation needs of contemporary society and industrial production, the demand for real-time online automated inspection technology for printed products is becoming more and more urgent, so as to solve the problems and shortcomings of manual sampling methods.
[0004] Based on the defects of existing manual inspection, people have gradually developed the technology of automatic inspection of printed surface quality using machine vision. However, the existing automatic inspection method based on machine vision has the following disadvantages:
[0005] (1) Faced with complex and ever-changing printed images, existing automatic detection methods based on machine vision can only extract relatively single defect features. However, the defect features existing in actual printed patterns are not single. Therefore, if the printing quality detection is only based on the extraction of a single defect feature, the obtained detection results are not accurate enough.
[0006] (2) The existing automatic detection methods based on machine vision use single-direction acquisition when collecting images, so the collected images are often difficult to accurately reflect the actual printing situation, which further leads to inaccurate detection results;
[0007] (3) Existing automatic detection methods based on machine vision cannot detect external interference and failures in a timely manner, which is prone to false detection. Summary of the invention
[0008] In order to overcome the shortcomings of the prior art, the present invention provides a surface printing device and method for packaging box production, which are used to solve the technical problems of inaccurate detection results and easy false detection in the existing automatic detection methods based on machine vision, thereby achieving the purpose of improving detection accuracy and reducing false detection rate.
[0009] To solve the above problems, the technical solution adopted by the present invention is as follows:
[0010] A surface printing device for packaging box production, characterized by comprising:
[0011] A packaging box printing assembly comprises: a bracket, a printing mechanism body, an electric guide rail and a conveyor belt; the printing mechanism body is movably connected to the bracket through the electric guide rail, and is used to print on the surface of the packaging box; the conveyor belt is drivingly connected to the inner side of the bracket, and is used to convey the packaging box to be printed to the printing area, and convey the printed packaging box to the shooting platform;
[0012] A shooting platform, comprising a first motor and a rotating platform, wherein the rotating platform is driven by the first motor to adjust the position of the printed packaging box;
[0013] A camera system, comprising a second motor, a third motor, a first camera and a second camera, wherein the second motor and the third motor are respectively used to adjust the angles of the first camera, the second camera and the midline of the surface of the rotating table;
[0014] The light source system comprises a fourth motor, a fifth motor, a first light source and a second light source, wherein the fourth motor and the fifth motor are respectively used to adjust the angles of the first light source, the second light source and the midline of the rotating table surface.
[0015] A surface printing method for producing packaging boxes, using the surface printing device according to claim 1, comprising the following steps:
[0016] After the printed packaging box is rotated to a preset position, the first light source and the first camera are started to capture a first image of the packaging box, and the second light source and the second camera are started to capture a second image of the packaging box;
[0017] Based on the preset position of the rotating stage in the first and second images, acquiring corresponding first and second standard images;
[0018] Preprocessing the image to obtain a preprocessed first image, a preprocessed first standard image, a preprocessed second image, and a preprocessed second standard image;
[0019] Performing positioning feature extraction to obtain first and second feature information, and obtaining first and second images to be extracted based on the feature information;
[0020] Extracting defect features from the image to be extracted, and judging whether the printed packaging box is a qualified product based on information of the defect features;
[0021] Wherein, the rotating table has multiple preset positions.
[0022] As a preferred implementation mode of the present invention, when obtaining the first and second pieces of feature information, it includes:
[0023] The similarity between the preprocessed first image and the preprocessed first standard image, and between the preprocessed second image and the preprocessed second standard image are obtained, and positioning and registration are performed based on the similarity to obtain the first and second feature information.
[0024] As a preferred embodiment of the present invention, when obtaining the first and second images to be extracted, the method includes:
[0025] Differential processing is performed based on the first and second feature information to obtain first and second difference information, and image correction is performed based on the first and second difference information, followed by extraction processing to obtain first and second images to be extracted.
[0026] As a preferred embodiment of the present invention, when preprocessing an image, it includes: graying the image to obtain a grayed image and a grayed standard image, and performing noise reduction processing on the grayed image and the grayed standard image.
[0027] As a preferred embodiment of the present invention, the grayscale conversion includes: main color detection based on histogram peak, energy function establishment, remapping, grayscale propagation based on local linear embedding, grayscale adjustment and grayscale detection;
[0028] The denoising process includes: differential curvature operator and image block extraction, normalization, and denoising based on weight coefficients.
[0029] As a preferred embodiment of the present invention, when obtaining the similarity between images, it includes:
[0030] Based on the matrix size, the mean of the preprocessed image, and the mean of the preprocessed standard image, the similarity between the images is obtained;
[0031] When performing positioning and registration, it includes:
[0032] Acquire a three-dimensional translation vector of a preprocessed image and a preprocessed standard image, and perform back-projection on the three-dimensional translation vector to obtain a two-dimensional translation vector of the preprocessed image and the preprocessed standard image;
[0033] The two-dimensional translation vector is used for the similarity between images, and a search is performed within a preset range to obtain an optimal solution, and positioning and registration are completed based on the optimal solution.
[0034] As a preferred embodiment of the present invention, when performing differential processing, it includes:
[0035] Obtaining a Sobel transverse operator and a Sobel longitudinal operator, and obtaining a gradient amplitude according to the Sobel transverse operator and the Sobel longitudinal operator;
[0036] Combining the gradient amplitude and the grayscale value of the pixel point to obtain a combined threshold;
[0037] The combined threshold is compared with the preset threshold Y, and whether the pixel point is qualified is determined based on the comparison result.
[0038] As a preferred embodiment of the present invention, when performing extraction processing, it includes: enhancement processing, noise reduction processing, threshold segmentation, edge detection and morphological processing;
[0039] The enhancement process includes: obtaining the image edge detail information amount Pnk1, the image entropy evaluation function Pnk2, obtaining the image visual quality evaluation function Pnk3, and the contrast evaluation function Pnk4;
[0040] Based on the preset weights, Pnk1, Pnk2, Pnk3 and Pnk4, a target fitness function for image enhancement is obtained, and enhancement processing is performed using the target fitness function for image enhancement.
[0041] As a preferred embodiment of the present invention, when extracting defect features, it includes:
[0042] Searching for starting points of all curves in the first and second images to be extracted;
[0043] Starting from each starting point, the curve is traced, and the neighboring points other than the searched point in the n×n neighborhood of the current pixel point are searched. The position, slope and curvature of the searched neighboring points are recorded. The searched neighboring point is used as the next point of the current pixel point and as the starting point of the next search. The next information collection is performed until the end point of the curve is searched, and the feature information of several pixel points is obtained.
[0044] Compared with the prior art, the present invention has the following beneficial effects:
[0045] (1) The surface printing device provided by the present invention is provided with a shooting platform, and a rotating table in the shooting platform is used to rotate the printed packaging box to a preset position, so that the camera system can collect the first image and the second image of the printed packaging box at different positions, and perform the subsequent surface printing effect judgment step based on the first image and the second image at different positions, thereby greatly improving the accuracy of the judgment;
[0046] (2) The present invention sets a first light source, a second light source, a first camera and a second camera, and the first light source and the second camera are set on one side of the rotating table, and the second light source and the first camera are set on the other side of the rotating table. The light sources and the cameras are adjusted by the second and third motors and the fourth and fifth motors so that the first angle is equal to the third angle, and the second angle is equal to the fourth angle; thereby ensuring that the first camera and the second camera can capture a clear and complete image of the packaging box; in addition, by collecting the image of the packaging box through the first camera and the second camera, when one of the cameras is interfered with by the outside world or fails, there will be obvious differences between the collected first image and the second image, thereby timely eliminating inaccurate recognition results caused by external interference or failure; secondly, since the first camera and the second camera are set in different orientations, the first image and the second image are images under different camera orientations. Therefore, judging the printing effect based on the combination of the first image and the second image can further improve the accuracy of the judgment;
[0047] (3) The defect feature extraction method provided by the present invention can simultaneously and accurately extract multiple defect features in the printed pattern. Compared with the existing extraction method that can only extract a relatively single defect feature, it is more suitable for complex and changeable printed images. It combines multiple defect features to judge the printing effect and can accurately judge whether the printed packaging box is a qualified product.
[0048] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a structural schematic diagram of the shooting platform provided by the present invention;
[0050] Figure 2 It is a schematic diagram of the setting position of the power supply and the camera provided by the present invention;
[0051] Figure 3 It is a schematic diagram of the angles between the power supply, the camera and the midline provided by the present invention;
[0052] Figure 4 It is a step diagram of the surface printing method for packaging box production provided by the present invention.
[0053] Explanation of the accompanying drawings: 1. rotating table; 2. first motor; 3. first camera; 4. second camera; 5. first light source; 6. second light source; 7. printed packaging box; 8. center line; 9. second angle; 10. fourth angle. DETAILED DESCRIPTION
[0054] The surface printing device for packaging box production provided by the present invention comprises: a packaging box printing component, a shooting platform, a camera system and a light source system.
[0055] The packaging box printing assembly includes: a bracket, a printing mechanism body, an electric guide rail and a conveyor belt; the printing mechanism body is movably connected to the bracket through the electric guide rail, and is used for printing on the surface of the packaging box; the conveyor belt is connected to the inner side of the bracket, and is used for conveying the packaging box to be printed to the printing area, and conveying the printed packaging box 7 to the shooting platform.
[0056] like Figure 1 As shown, the shooting platform includes a first motor 2 and a rotating platform 1 . The rotating platform 1 adjusts the position of the printed packaging box 7 under the drive of the first motor 2 .
[0057] The camera system includes a second motor, a third motor, a first camera 3 and a second camera 4. The second motor is used to adjust a first angle between the first camera 3 and the center line 8 of the surface of the rotating table 1. The third motor is used to adjust a second angle 9 between the second camera 4 and the center line 8 of the surface of the rotating table 1.
[0058] The light source system includes a fourth motor, a fifth motor, a first light source 5 and a second light source 6. The fourth motor is used to adjust a third angle between the first light source 5 and the center line 8 of the surface of the rotating table 1. The fifth motor is used to adjust a fourth angle 10 between the second light source 6 and the center line 8 of the surface of the rotating table 1.
[0059] Among them, Figure 2 As shown, the first light source 5 and the second camera 4 are arranged on one side of the rotating stage 1, and the second light source 6 and the first camera 3 are arranged on the other side of the rotating stage 1;
[0060] like Figure 3 As shown, the first angle is equal to the third angle, and the second angle 9 is equal to the fourth angle 10.
[0061] Specifically, the surface printing device provided by the present invention sets up a shooting platform, and uses the rotating table 1 in the shooting platform to rotate the printed packaging box 7 to a preset position, so that the camera system can capture the first image and the second image of the printed packaging box 7 at different positions, and perform subsequent surface printing effect judgment steps based on the first image and the second image at different positions, thereby greatly improving the accuracy of the judgment.
[0062] The present invention is provided with a first light source 5, a second light source 6, a first camera 3 and a second camera 4, and the first light source 5 and the second camera 4 are arranged on one side of the rotating platform 1, and the second light source 6 and the first camera 3 are arranged on the other side of the rotating platform 1, and the light source and the camera are adjusted by the second and third motors and the fourth and fifth motors, so that the first angle is equal to the third angle, and the second angle 9 is equal to the fourth angle 10; thereby ensuring that the first camera 3 and the second camera 4 can capture a clear and complete image of the packaging box. In addition, the first camera 3 and the second camera 4 are used to collect the image of the packaging box. When one of the cameras is disturbed by the outside world or fails, there will be obvious differences between the collected first image and the second image, thereby timely eliminating the inaccurate recognition results caused by the outside world or the failure. Secondly, since the first camera 3 and the second camera 4 are set in different orientations, the first image and the second image are images under different camera orientations. Therefore, judging the printing effect based on the combination of the first image and the second image can further improve the accuracy of the judgment.
[0063] The surface printing method for packaging box production provided by the present invention adopts the above-mentioned surface printing device, such as Figure 4 As shown, the following steps are included:
[0064] Step S1: After the printed packaging box 7 is rotated to a preset position by the rotating table 1, the first light source 5 and the first camera 3 are started to capture a first image of the printed packaging box 7, and the second light source 6 and the second camera 4 are started to capture a second image of the printed packaging box 7;
[0065] Step S2: based on the preset position of the rotating stage 1 in the first image and the second image, obtaining the corresponding first standard image and second standard image;
[0066] Step S3: preprocessing the first image and the first standard image to obtain a preprocessed first image and a preprocessed first standard image;
[0067] Step S4: preprocessing the second image and the second standard image to obtain a preprocessed second image and a preprocessed second standard image;
[0068] Step S5: obtaining the similarity between the preprocessed first image and the preprocessed first standard image, and between the preprocessed second image and the preprocessed second standard image, and performing positioning and registration based on the similarity to obtain the first and second feature information;
[0069] Step S6: performing differential processing based on the first and second feature information to obtain first and second difference information, and performing image correction based on the first and second difference information, and then performing extraction processing to obtain first and second images to be extracted;
[0070] Step S7: extracting defect features from the first and second images to be extracted, and judging whether the printed packaging box 7 is a qualified product based on information of the first and second defect features;
[0071] The rotating platform 1 has multiple preset positions.
[0072] In the above steps S3 and S4, when performing preprocessing, the steps include: graying the image and the standard image to obtain a grayed image and a grayed standard image;
[0073] Grayscale, including:
[0074] The image is subjected to a primary color detection based on a histogram peak to obtain a candidate primary color set, and the candidate primary colors in the candidate primary color set are screened and eliminated to obtain a final primary color set;
[0075] An energy function is established based on the final primary color set, and the first primary color grayscale value of each primary color in the final primary color set is obtained through the energy function;
[0076] Remap the primary color grayscale values according to the grayscale colors in the final primary color set to obtain the second primary color grayscale value of each primary color after remapping;
[0077] The grayscale value of the second primary color and the grayscale value of the grayscale color are used as propagation sources, and the propagation sources are propagated to pixels whose grayscale value difference is less than a threshold based on grayscale propagation of local linear embedding to obtain a grayscale image;
[0078] Adjusting the grayscale image based on a fitting error detection mechanism to obtain an adjusted grayscale image;
[0079] The adjusted grayscale image is tested, and after passing the test, a final grayscale image is obtained.
[0080] Furthermore, when the dominant color detection based on the histogram peak is used for the image, it includes:
[0081] The colors are classified according to the intensity and saturation of the image, as shown in Formula 20:
[0082]
[0083] Where v is any color in the image, n is the intensity of the image, d is the saturation of the image; a is a-class, used to represent black; b is b-class, used to represent grayish white; c is c-class, used to represent color;
[0084] Get any two colors v in the image o and v k The similarity is shown in Formula 21:
[0085]
[0086] Where j is the chromaticity of the image, |Δj|=min{|j o -j k |,360°-|j o -j k |}; |Δd|=|d o -d k |;|Δn|=|n o -n k |;j d ,d d 、n d and n′ d is the preset threshold;
[0087] Specifically, the threshold j d =20°, threshold d d =0.3, threshold n d =1 and threshold n′ d =0.3.
[0088] If the color v o and v k If any of the conditions in formula 21 is met, the color v is considered o and v k similar, otherwise the color v o and v k not similar;
[0089] Get the spatial concentration of any pixel, as shown in formula 22:
[0090]
[0091] Where q is any pixel, t q is the number of pixels around any pixel q, z q is the number of pixels with similar colors to any pixel q among the pixels around it, and DSF(q) is the spatial aggregation degree of any pixel;
[0092] Pixels whose spatial aggregation is greater than the spatial aggregation threshold are extracted to form a feature vector set, as shown in Formula 23:
[0093] G={(v u ,c u ),u=1,2,…,m G} (twenty three);
[0094] In the formula, G is the feature vector set, v u is the color value of the pixel whose spatial aggregation is greater than the spatial aggregation threshold, c u is the coordinate of the pixel whose spatial concentration is greater than the spatial concentration threshold, mG is the number of colors whose spatial aggregation is greater than the spatial aggregation threshold;
[0095] Specifically, the spatial aggregation thresholds include: 0.75-0.85.
[0096] Get the color value v u Among all colors whose distance is less than a preset distance, the color with the largest number of pixels is taken as the peak color, and several peak colors are obtained, and the several peak colors are taken as candidate primary colors to form an initial candidate primary color set;
[0097] The non-peak colors are classified into the candidate primary colors that are closest in the RGB color space to obtain a candidate primary color set.
[0098] Furthermore, when establishing an energy function, it includes:
[0099] Based on the brightness value of the main color in the final main color set in the CIE Lab color space, an energy function is established, as shown in Formula 1:
[0100]
[0101] In the formula, h o is the main color fv to be solved o The corresponding gray value, h k is the main color fv to be solved k The corresponding gray value, m l is the number of primary colors in the final primary color set, a o is the main color fv to be solved o Brightness value in CIE Lab color space, fob(o,k) is the primary color fv o and main color fv k The gradient between
[0102] The gradient fob(o,k) is shown in Formula 2:
[0103]
[0104] In the formula, Main color fv o With the main color fv k The absolute value of the RGB color difference, s ok is the sign direction;
[0105] Compare the main colors fv in order o With the main color fv k The brightness channel L, the sum of the three RGB channels, the G channel, and the R channel. If the primary color fv o One of the items is greater than the main color fv k , then S ok =1, otherwise Sok =-1, if they are equal, continue to compare the next item;
[0106] When obtaining the first primary color grayscale value of each primary color in the final primary color set, it includes:
[0107] For h in Formula 1 o Calculate the partial derivative and set it to 0 to get Formula 3. According to Formula 3, the first primary color grayscale value of each primary color is obtained. Formula 3 is as follows:
[0108]
[0109] Furthermore, when remapping the primary color grayscale value, it includes:
[0110] Get the two colors with the largest and smallest brightness in the image to be preprocessed, and add the color with the largest brightness and the color with the smallest brightness to the final primary color set for remapping, as shown in Formula 4:
[0111]
[0112] In the formula, h q 、h w and h y They are respectively the main color fv q , main color fv w and any primary color fv y The corresponding grayscale value before remapping; a w 、a q Main color fv w and main color fv q Brightness value in CIE Lab color space; h′ y Any primary color fv y The corresponding new grayscale value after remapping.
[0113] Furthermore, when the source of transmission is transmitted, it includes:
[0114] A grayscale propagation model is established, and the propagation source is propagated through the grayscale propagation model, as shown in formula 24:
[0115] R = R1 + R2 (24);
[0116] Wherein, R1 is the grayscale constraint term of the propagation source, which is used to specify the grayscale value of the second primary color and the grayscale value of the grayscale color as the propagation source; R2 is the grayscale constraint term of the propagation source, which is used to diffuse the grayscale value of the propagation source by adopting local linear embedding.
[0117] Among them, the grayscale constraint term R1 of the propagation source is as shown in formula 25:
[0118]
[0119] In the formula, x o For color v o The corresponding gray value, i o For color v o The target gray value; m0 is the total number of colors in the image; μ o Used to mark the color v o Is it the main color or grayscale color? If so, then μ o =1,i o Use the grayscale value of the second primary color and the grayscale value of the grayscale color. If not, then μ o =0,i o =0;
[0120] The grayscale constraint term R2 of the propagation source is shown in formula 26:
[0121]
[0122] In the formula, for color v o Search for σ in the image color set o The color v whose difference between colors is less than the threshold k ;e ok For the o Color v k Refit color v o The coefficient of ok By minimizing; x k For color v k The corresponding gray value;
[0123] For x in Formula 26 o The partial derivative is calculated and made equal to 0, and several partial derivative equations are obtained. The system of equations formed by all partial derivative equations is combined and solved to obtain the grayscale image formed by the diffusion of the grayscale value of the second primary color and the grayscale color.
[0124] Specifically, when graying, the present invention first detects the main color of the input image based on the histogram peak to obtain the corresponding candidate main color set, and then screens and eliminates the candidate main color set to ensure the accuracy of the main color, and then obtains the corresponding propagation source through the established energy function and remapping, and adopts grayscale propagation based on local linear embedding based on the propagation source to obtain a grayscale image; the graying method provided by the present invention can ensure the accuracy of image graying, so that the similarity between the image and the standard image can be accurately obtained subsequently, and accurate positioning and registration can be achieved.
[0125] Furthermore, after obtaining the grayscale image and the grayscale standard image, the method includes: performing noise reduction processing on the grayscale image and the grayscale standard image;
[0126] Noise reduction processing, including:
[0127] Obtain the differential curvature of each pixel in the grayscale image and the grayscale standard image;
[0128] According to the differential curvature, a differential curvature operator and an image block centered at pixels o and k are extracted respectively;
[0129] According to the differential curvature operator and the image block, a normalization parameter is obtained, and a weight coefficient is obtained according to the normalization parameter;
[0130] The grayscale image and the grayscale standard image are denoised based on the weight coefficients to obtain the preprocessed first and second images and the preprocessed first and second standard images.
[0131] Furthermore, when obtaining the differential curvature of each pixel point, it includes:
[0132] According to the derivatives of the image in the x and y directions, the second-order derivative of the image along the gradient direction is obtained, as shown in formula 27:
[0133]
[0134] In the formula, i εε is the second-order derivative along the gradient direction, i x is the first-order derivative of the image in the x direction, i y is the first-order derivative of the image in the y direction, i xx is the second-order derivative of the image in the x direction, i yy is the second-order derivative of the image in the y direction, i xy is the first-order derivative of the image in the x and y directions;
[0135] According to the derivatives of the image in the x and y directions, the second-order derivative of the image perpendicular to the gradient direction is obtained, as shown in formula 28:
[0136]
[0137] In the formula, is the second-order derivative perpendicular to the gradient direction;
[0138] According to the second-order derivative along the gradient direction and the second-order derivative perpendicular to the gradient direction, the differential curvature of each pixel in the image is obtained, as shown in Formula 29:
[0139]
[0140] Where F is the differential curvature;
[0141] When obtaining the normalized parameters, including:
[0142] According to the Gaussian-weighted Euclidean distance of the differential curvature operator centered at pixels o and k, and the Gaussian-weighted Euclidean distance of the image block centered at pixels o and k, the normalization parameter is obtained, as shown in formula 30:
[0143]
[0144] Where Θ is the search area, is the Gaussian weighted Euclidean distance, u(M o ) is the image block centered at pixel o, u(M k ) is the image block centered at pixel k, F(M o ) is the differential curvature operator centered at pixel o, F(M k ) is the differential curvature operator centered at pixel k, j is the smoothing parameter, and X(o) is the normalization parameter;
[0145] When the weight coefficient is obtained, as shown in formula 31:
[0146]
[0147] Where, E(o,k) is the weight coefficient;
[0148] When performing noise reduction based on weight coefficients, it includes:
[0149] By introducing Gaussian white noise into the original noise-free image, a noisy image model is established, as shown in Formula 32:
[0150] u(o)=i(o)+m(o) (32);
[0151] Where i(o) is the original noise-free image, and m(o) is Gaussian white noise;
[0152] Based on the noisy image model and weight coefficients, weighted averaging is performed on similar image blocks with the pixel to be estimated as the center point to obtain an estimate of each pixel in the image block, as shown in Formula 33:
[0153]
[0154] In the formula, is an estimate of each pixel in the image patch.
[0155] Specifically, the denoising method provided by the present invention extracts the differential curvature operator of each image block and uses the differential curvature operator to detect the image, so that the edge area, smooth area and isolated noise in the image can be well detected. In addition, by obtaining the normalization parameters and obtaining the weight coefficients based on the normalization parameters, accurate estimation of each pixel point can be achieved, thereby obtaining better denoising performance and good detail preservation.
[0156] In the above step S5, when obtaining the similarity between images, it includes:
[0157] Based on the matrix size, the mean of the preprocessed image, and the mean of the preprocessed standard image, the similarity between the images is obtained, as shown in Formula 5:
[0158]
[0159] In the formula, η is the similarity, the matrix size is Z×M, g1(o,k) is the preprocessed image, g2(o,k) is the preprocessed standard image, is the mean of the preprocessed image, is the mean of the preprocessed standard image, (i,b) is the two-dimensional translation vector;
[0160] When performing positioning and registration, it includes:
[0161] The three-dimensional translation vector of the preprocessed image and the preprocessed standard image is obtained, and the three-dimensional translation vector is back-projected to obtain the two-dimensional translation vector of the preprocessed image and the preprocessed standard image, as shown in Formula 6:
[0162]
[0163] Where (i, b) is a two-dimensional translation vector, and (c, u, x) is a three-dimensional translation vector; is the intrinsic parameter projection matrix, is the transformation matrix between world coordinates and camera coordinates;
[0164] The two-dimensional translation vector is used for the similarity between images, and a search is performed within a preset range to obtain the optimal solution, and positioning and registration are completed based on the optimal solution.
[0165] Specifically, the present invention obtains a two-dimensional translation vector by back-projecting the three-dimensional translation vector of the image and the standard image, and introduces the two-dimensional translation vector into the acquisition of image similarity, thereby obtaining the optimal solution by searching within a preset range and achieving high-precision positioning and registration.
[0166] In the above step S6, when performing differential processing based on a number of feature information, it includes:
[0167] The Sobel horizontal operator and the Sobel vertical operator are obtained as shown in Formula 7 and Formula 8 respectively:
[0168]
[0169] According to the Sobel transverse operator and the Sobel longitudinal operator, the gradient amplitude is obtained, as shown in Formula 9:
[0170] g m (x,y)=|g(x,y)*J C |+|g(x,y)*J U | (9);
[0171] In the formula, g m (x, y) is the gradient amplitude, g(x, y) is the gray value of the pixel;
[0172] The gradient amplitude and the gray value of the pixel are combined to obtain the joint threshold, as shown in formula 10:
[0173] F m (x,y)=|g(x,y)-g m (x,y)| (10);
[0174] In the formula, F m (x,y) is the joint threshold;
[0175] The joint threshold F m (x, y) is compared with the preset threshold Y, and based on the comparison result, it is determined whether the pixel is qualified, as shown in formula 11:
[0176]
[0177] If N m (x,y) is 1, then the pixel is a defective point. If N m If (x,y) is 0, the pixel is a qualified point.
[0178] Specifically, the present invention realizes rapid acquisition of image gradient amplitude through transverse operators and longitudinal operators, and performs differential processing in combination with image grayscale information, so that even in the face of complex and changeable printed images, better processing effects can be obtained and faster processing speed can be achieved.
[0179] In the above step S6, when performing the extraction process, it includes: enhancement process, noise reduction process, threshold segmentation, edge detection and morphological process;
[0180] Among them, enhanced processing includes:
[0181] The Sobel operator is used to extract edge pixels to obtain the image edge detail information, as shown in Formula 12:
[0182]
[0183] Where Pnk1 is the amount of image edge detail information, t×v is the image size, and R(O d ) is the sum of the intensities of all edge pixels in the image, m ris the sum of the number of edge pixels in the image;
[0184] The evaluation function for obtaining image entropy is shown in Formula 13:
[0185]
[0186] In the formula, O r To enhance the image, q o is the pixel with gray value o;
[0187] Get the mean square error between the original image and the enhanced image, as shown in Formula 14:
[0188]
[0189] In the formula, t×v is the image size, O0(o,k) is the original image, and O r (o, k) is the enhanced image;
[0190] According to the maximum grayscale and mean square error of the image, the evaluation function of the image visual quality is obtained, as shown in Formula 15:
[0191]
[0192] In the formula, Q z is the maximum grayscale of the image;
[0193] The contrast evaluation function is obtained as shown in Formula 16:
[0194]
[0195] Where Q(o,k) is the number of co-occurrences of image grayscale values o and k;
[0196] Based on the preset first weight, second weight, third weight and fourth weight, the target fitness function of image enhancement is obtained, as shown in Formula 17:
[0197] Pnk=E1Pnk1+E2Pnk2+E3Pnk3+E4Pnk4 (17);
[0198] Wherein, E1 is the first weight, E2 is the second weight, E3 is the third weight and E4 is the fourth weight;
[0199] The enhancement process is performed through the target fitness function of image enhancement.
[0200] Specifically, the present invention measures various performance aspects of enhanced images by introducing image edge detail information, image entropy, image visual quality and contrast, and constructs a target fitness function based on the above-mentioned introduced multiple evaluation information combined with corresponding weights. The target fitness function is used to perform image enhancement processing, so that the details in the image (including curves) are clearer, so that the starting point and end point of the curve can be accurately determined subsequently, and the defect features can be accurately extracted.
[0201] In the above step S7, when extracting defect features from the first and second images to be extracted, it includes:
[0202] Searching for the starting points of all curves in the first and second to-be-extracted images, the starting points satisfying the following conditions, including:
[0203] The advancing direction from the starting point to the adjacent points on the curve is the direction in which the number of pixel columns increases;
[0204] The sum of the grayscale values of the neighborhood with the starting point as the midpoint and a width of n is 1, as shown in Formula 18:
[0205]
[0206] Where (o, k) is the starting point, g(o, k) is the grayscale of the starting point, and g(o+l, k+a) is the grayscale of the neighborhood;
[0207] Start tracing the curve from each starting point, search for neighboring points other than the searched point in the n×n neighborhood of the current pixel, and record the position, slope and curvature of the searched neighboring points. Set the searched neighboring point as the next point of the current pixel and as the starting point of the next search, and collect the next information until the end point of the curve is found, and obtain the feature information of several pixel points.
[0208] If the distance between the searched start point or end point and the frame is greater than a preset threshold, it is determined that a breakpoint occurs in the printed pattern;
[0209] If the sum of the grayscale values of a certain pixel point (n×n) neighborhood is greater than or equal to n, it is determined that the printed pattern has intersections or impurities, as shown in Formula 19:
[0210]
[0211] The chord arc distance-chord length ratio, slope and curvature of the curve are obtained to determine whether any one of the first condition, the second condition or the third condition is met. If so, it is determined that the printed pattern is curved.
[0212] Specifically, the defect feature extraction method provided by the present invention can simultaneously and accurately extract multiple defect features in the printed pattern. Compared with the existing extraction method that can only extract a relatively single defect feature, it is more suitable for complex and changeable printed images. By combining multiple defect features to judge the printing effect, it can accurately judge whether the printed packaging box 7 is a qualified product.
[0213] Among them, the first condition is as shown in formula 34:
[0214]
[0215] In the formula, a is the chord length, f is the chord arc distance, and Y f / a is the chord arc distance-chord length ratio threshold;
[0216] The second condition is shown in formula 35:
[0217] Q1>Y Q1 (35);
[0218] Where Q1 is the slope, Y Q1 is the slope threshold;
[0219] The third condition is shown in Formula 36:
[0220] Q2>Y Q2 (36);
[0221] Where Q2 is the curvature, Y Q2 is the curvature threshold.
[0222] In the above step S7, when judging whether the printed packaging box 7 is a qualified product, it includes:
[0223] Determine whether the number of breakpoints, intersections or impurities, and bends in the extracted first and second defect features are all less than a preset threshold value. If so, determine whether the current preset position is the last preset position. If not, rotate the printed packaging box 7 to the next preset position through the rotating table 1;
[0224] If not, it is considered that the printed packaging box 7 is a non-conforming product;
[0225] After rotating to the next preset position, the process includes: restarting the first light source 5 and the first camera 3 to collect the image of the printed packaging box 7 , and restarting the second light source 6 and the second camera 4 to collect the image of the printed packaging box 7 .
[0226] The above-mentioned embodiments are only preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantial changes and substitutions made by technicians in this field on the basis of the present invention shall fall within the scope of protection required by the present invention.
Claims
1. A surface printing device for packaging box production, characterized in that: include: A packaging box printing assembly comprises: a bracket, a printing mechanism body, an electric guide rail and a conveyor belt; the printing mechanism body is movably connected to the bracket through the electric guide rail, and is used to print on the surface of the packaging box; the conveyor belt is drivingly connected to the inner side of the bracket, and is used to convey the packaging box to be printed to the printing area, and convey the printed packaging box to the shooting platform; A shooting platform, comprising a first motor and a rotating platform, wherein the rotating platform is driven by the first motor to adjust the position of the printed packaging box; A camera system, comprising a second motor, a third motor, a first camera and a second camera, wherein the second motor and the third motor are respectively used to adjust the angles of the first camera, the second camera and the midline of the surface of the rotating table; A light source system, comprising a fourth motor, a fifth motor, a first light source and a second light source, wherein the fourth motor and the fifth motor are respectively used to adjust the angles of the first light source, the second light source and the midline of the surface of the rotating table; After the shooting platform rotates the printed packaging box to a preset position, the camera system collects the image of the packaging box, performs preprocessing and positioning feature extraction, and obtains the first and second feature information; When obtaining the first and second pieces of characteristic information, it includes: Acquire the similarity between the preprocessed first image and the preprocessed first standard image, and between the preprocessed second image and the preprocessed second standard image, and perform positioning and registration based on the similarity to obtain the first and second feature information; When obtaining the similarity between images, it includes: Based on the matrix size, the mean of the preprocessed image, and the mean of the preprocessed standard image, the similarity between the images is obtained; When performing positioning and registration, it includes: Acquire a three-dimensional translation vector of a preprocessed image and a preprocessed standard image, and perform back-projection on the three-dimensional translation vector to obtain a two-dimensional translation vector of the preprocessed image and the preprocessed standard image; The two-dimensional translation vector is used for the similarity between images, and a search is performed within a preset range to obtain an optimal solution, and positioning and registration are completed based on the optimal solution.
2. A surface printing method for packaging box production, characterized in that: The surface printing device according to claim 1 comprises the following steps: After the printed packaging box is rotated to a preset position, the first light source and the first camera are started to capture a first image of the packaging box, and the second light source and the second camera are started to capture a second image of the packaging box; Based on the preset position of the rotating stage in the first and second images, acquiring corresponding first and second standard images; Preprocessing the image to obtain a preprocessed first image, a preprocessed first standard image, a preprocessed second image, and a preprocessed second standard image; Performing positioning feature extraction to obtain first and second feature information, and obtaining first and second images to be extracted based on the feature information; Extracting defect features from the image to be extracted, and judging whether the printed packaging box is a qualified product based on information of the defect features; Wherein, the rotating table has multiple preset positions; When obtaining the first and second pieces of characteristic information, it includes: Acquire the similarity between the preprocessed first image and the preprocessed first standard image, and between the preprocessed second image and the preprocessed second standard image, and perform positioning and registration based on the similarity to obtain the first and second plurality of feature information; When obtaining the similarity between images, it includes: Based on the matrix size, the mean of the preprocessed image, and the mean of the preprocessed standard image, the similarity between the images is obtained; When performing positioning and registration, it includes: Acquire a three-dimensional translation vector of a preprocessed image and a preprocessed standard image, and perform back-projection on the three-dimensional translation vector to obtain a two-dimensional translation vector of the preprocessed image and the preprocessed standard image; The two-dimensional translation vector is used for the similarity between images, and a search is performed within a preset range to obtain an optimal solution, and positioning and registration are completed based on the optimal solution.
3. The surface printing method for packaging box production according to claim 2, characterized in that: When obtaining the first and second images to be extracted, comprising: Differential processing is performed based on the first and second feature information to obtain first and second difference information, and image correction is performed based on the first and second difference information, followed by extraction processing to obtain first and second images to be extracted.
4. The surface printing method for packaging box production according to any one of claims 2 or 3, characterized in that: When preprocessing an image, it includes: graying the image to obtain a grayed image and a grayed standard image, and performing noise reduction processing on the grayed image and the grayed standard image.
5. The surface printing method for packaging box production according to claim 4, characterized in that: The grayscale conversion includes: main color detection based on histogram peak, energy function establishment, remapping, grayscale propagation based on local linear embedding, grayscale adjustment and grayscale detection; The denoising process includes: differential curvature operator and image block extraction, normalization, and denoising based on weight coefficients.
6. The surface printing method for packaging box production according to claim 3, characterized in that: When performing differential processing, it includes: Get Transverse operator and The longitudinal operator, according to The transverse operator and the Longitudinal operator, obtains the gradient amplitude; Combining the gradient amplitude and the grayscale value of the pixel point to obtain a combined threshold; The combined threshold and the preset threshold Compare and determine whether the pixel is qualified based on the comparison result.
7. The surface printing method for packaging box production according to claim 3, characterized in that: When performing extraction processing, it includes: enhancement processing, noise reduction processing, threshold segmentation, edge detection and morphological processing; The enhancement process includes: obtaining the image edge detail information , Image entropy evaluation function , obtain the evaluation function of image visual quality , Contrast evaluation function ; Based on preset weights, , , as well as , obtain the target fitness function of image enhancement, and perform enhancement processing using the target fitness function of image enhancement.
8. The surface printing method for packaging box production according to claim 2, characterized in that: When extracting defect features, it includes: Searching for starting points of all curves in the first and second images to be extracted; Start tracing the curve from each starting point and search for the current pixel point The neighboring points other than the searched point in the neighborhood are searched, and the position, slope and curvature of the searched neighboring points are recorded. The searched neighboring point is taken as the next point of the current pixel point and used as the starting point for the next search to collect the next information until the end point of the curve is searched to obtain the feature information of several pixel points.
