A printed cement packaging bag image registration method and system

By performing edge detection and probability calculation on the surface image of cement packaging bags, combined with least squares fitting, the edges of the printed parts are screened out, which solves the problem of surface texture and crease interference of cement packaging bags and achieves more accurate identification and identification of printed parts. Registration.

CN118365680BActive Publication Date: 2024-10-18ZHAOQING DINGHU LIANSHENG PAPER PACKAGING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410515624.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-26
Publication Date
2024-10-18
Estimated Expiration
2044-04-26

AI Technical Summary

Technical Problem

During the printing process of cement packaging bags, the image edge detection results are inaccurate due to factors such as surface texture and creases of the cement bag, affecting the edge recognition and registration of the printed part.

Method used

By obtaining the surface image of the printed cement packaging bag for preprocessing, edge detection and morphological processing are performed, the edge chain code is constructed, the probability and growth coefficient of the edge are calculated, the least squares method is used to fit the edge, and the edges of the printed part are screened out, and Registration is completed based on relative relationships.

Benefits of technology

It improves the recognition accuracy of the edges of the printed part, reduces the influence of texture and crease interference, and improves the accuracy of the printing adjustment and the accuracy of the registration results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118365680B_ABST
    Figure CN118365680B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to a method and system for image registration of printed cement packaging bags. The method comprises: obtaining a grayscale image of the surface of a cement packaging bag; obtaining a partially connected domain and an internal edge of the cement packaging bag by edge detection; constructing an edge chain code for the internal edge; calculating the probability that the internal edge belongs to the edge of the printed part based on the edge chain code and the surrounding grayscale values ​​of the pixel points on the internal edge; fitting the internal edge with the m other internal edges closest to the endpoint, and obtaining the growth coefficient corresponding to each internal edge based on the difference information; determining the edge of the printed part based on the growth coefficient and the probability that the internal edge belongs to the edge of the printed part; and completing the registration according to the relative relationship between the edge of the printed part and the partially connected domain of the cement packaging bag. Through this method, the interference caused by factors such as wrinkles and textures on the surface of the cement packaging bag can be removed, and the accuracy of the registration result can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image processing, and in particular to a printed cement packaging bag image registration method and system. Background Art

[0002] When printing cement bags, the operator needs to place the printed bags on the printing machine, ensure the correct position, and then start the printing machine to print the design pattern and text on the bags. Since the printing content and the packaging bag may be inaccurately positioned during the printing process (for example, the pattern or text deviates from the predetermined position), causing visual inconsistency, the operator needs to constantly check the printing quality during the printing process and adjust the position as needed.

[0003] With the development of machine vision technology, it is currently possible to try to automatically register cement bag images through machine vision technology (for example, edge detection of cement bag images), and then achieve automatic adjustment based on the registration results. However, due to factors such as creases on the surface texture of cement bags, there may be some interference edges in the image, which affects the accuracy of the edge detection results of the printed part. Based on this, it is necessary to study a printed cement bag image registration method and system that can accurately identify the printed part. Summary of the invention

[0004] In order to solve the above technical problems, the purpose of the present invention is to provide a printed cement packaging bag image registration method and system, and the technical solution adopted is as follows:

[0005] One aspect of the present invention provides a method for printing cement packaging bag image registration, the method comprising:

[0006] Acquire the surface image of the cement packaging bag after printing and perform preprocessing to obtain a grayscale image of the surface of the cement packaging bag;

[0007] Performing edge detection on the grayscale image of the cement packaging bag surface to obtain a partially connected domain and an internal edge of the cement packaging bag;

[0008] Constructing an edge chain code for each pixel point on the internal edge;

[0009] Calculate the probability that each of the internal edges belongs to the edge of the printed portion based on the edge chain code and the surrounding grayscale values ​​of the pixels on the internal edge;

[0010] Using the least square method to fit each of the internal edges to the m other internal edges closest to the endpoints, and obtaining a growth coefficient corresponding to each of the internal edges based on the difference between the internal edge and the m other internal edges;

[0011] determining a printed portion edge based on the growth coefficient and the probability that the inner edge belongs to a printed portion edge;

[0012] The edge of the printed portion is positioned, and registration is completed according to the relative relationship between the edge of the printed portion and the connected domain of the cement packaging bag portion.

[0013] In some embodiments, the performing edge detection on the grayscale image of the cement packaging bag surface to obtain a partially connected domain and an internal edge of the cement packaging bag includes:

[0014] Canny edge detection is performed on the grayscale image of the cement packaging bag surface, and binary dilation is used to perform morphological processing on the edges of the cement packaging bag that are not completely closed, so that the edges of the cement packaging bag are completely closed, and a partially connected domain of the cement packaging bag and an internal edge located inside the partially connected domain of the cement packaging bag are obtained.

[0015] In some embodiments, constructing an edge chain code for each pixel point on the internal edge includes:

[0016] Taking the pixel point at one end of the inner edge as the starting point, traverse each adjacent pixel point in the inner edge, and characterize the relative position relationship between each pixel point and the previous pixel point through preset parameters to obtain the edge chain code corresponding to the inner edge.

[0017] In some embodiments, the calculating the probability that each of the internal edges belongs to the edge of the printed portion based on the edge chain code and the surrounding grayscale values ​​of the pixels on the internal edge includes:

[0018] Calculate the average of the difference between two adjacent code numbers in the edge chain code corresponding to each of the internal edges to obtain a first mean value;

[0019] According to the difference between the gray value of each pixel point on the internal edge and the gray mean value of the corresponding eight neighborhood pixels, the mean variance corresponding to the internal edge is obtained;

[0020] Obtaining a first parameter based on the product of the first mean and the mean variance;

[0021] An exponential operation is performed on the first parameter to obtain a probability that the internal edge belongs to an edge of a printed portion.

[0022] In some embodiments, obtaining the mean variance corresponding to the internal edge according to the difference between the grayscale value of each pixel point on the internal edge and the grayscale mean value of the corresponding eight neighborhood pixels includes:

[0023] Calculate the grayscale mean of eight neighborhood pixels corresponding to each pixel on the internal edge to obtain a second mean;

[0024] The squares of the differences between the grayscale value of each pixel on the internal edge and the corresponding second mean are summed and divided by the number of pixels on the internal edge to obtain the mean variance corresponding to the internal edge.

[0025] In some embodiments, performing an exponential operation on the first parameter to obtain a probability that the internal edge belongs to an edge of a printed portion includes:

[0026] An exponential operation is performed with the natural constant e as the base and the inverse of the product of the first mean and the mean variance as the exponent to obtain the probability that the internal edge belongs to the edge of the printed portion.

[0027] In some embodiments, the method of fitting each of the internal edges with the m other internal edges closest to the endpoints by the least square method, and obtaining the growth coefficient corresponding to each of the internal edges based on the difference between the internal edge and the m other internal edges, includes:

[0028] For m other internal edges that fit with the target internal edge, calculate the loss value when each other internal edge fits with the target internal edge, the gradient difference between the average gradient value of the pixels on each other internal edge and the average gradient value of the pixels on the target internal edge, and the grayscale difference between the average grayscale value of the pixels on each other internal edge and the average grayscale value of the pixels on the target internal edge;

[0029] Performing an exponential operation based on the product of the loss value, the gradient difference and the grayscale difference to obtain a second parameter corresponding to each of the m other internal edges;

[0030] The maximum value of the second parameters corresponding to the m other internal edges is selected as the growth coefficient corresponding to the target internal edge.

[0031] In some embodiments, performing an exponential operation based on the product of the loss value, the gradient difference, and the grayscale difference to obtain a second parameter corresponding to each of the m other internal edges includes:

[0032] An exponential operation is performed with the natural constant e as the base and the inverse of the product of the loss value, the gradient difference and the grayscale difference as the exponent to obtain a second parameter corresponding to each of the m other internal edges.

[0033] In some embodiments, determining the edge of the printed portion based on the growth coefficient and the probability that the internal edge belongs to the edge of the printed portion comprises:

[0034] An internal edge for which the product of the growth coefficient and the probability that the internal edge belongs to the edge of the printed portion is greater than a preset threshold is taken as the edge of the printed portion, wherein the preset threshold is 0.8.

[0035] Another aspect of the present invention also provides a printed cement packaging bag image registration system, the system comprising:

[0036] An acquisition module is used to acquire the surface image of the cement packaging bag after printing and perform preprocessing to obtain a grayscale image of the surface of the cement packaging bag;

[0037] An edge detection module is used to perform edge detection on the grayscale image of the cement packaging bag surface to obtain a partially connected domain and an internal edge of the cement packaging bag;

[0038] An edge chain code construction module, used to construct an edge chain code for each pixel point on the internal edge;

[0039] A probability calculation module, used for calculating the probability that each of the internal edges belongs to the edge of the printed part based on the edge chain code and the surrounding grayscale values ​​of the pixels on the internal edge;

[0040] A growth coefficient calculation module, used for fitting each of the internal edges with the m other internal edges closest to the endpoints by using the least square method, and obtaining the growth coefficient corresponding to each of the internal edges based on the difference between the internal edge and the m other internal edges;

[0041] a printed portion edge determination module, configured to determine a printed portion edge based on the growth coefficient and the probability that the internal edge belongs to the printed portion edge;

[0042] The registration module is used to locate the edge of the printed part and complete the registration according to the relative relationship between the edge of the printed part and the connected domain of the cement packaging bag part.

[0043] The present invention has the following beneficial effects:

[0044] (1) In the printed cement bag image registration method and system provided in some embodiments of the present invention, by analyzing the growth coefficient of each internal edge and the probability that it belongs to the edge of the printed part, the edge of the printed part can be screened out from all the internal edges inside the connected domain of the cement bag part, eliminating the interference caused by factors such as the surface texture and folds of the cement bag, providing accurate information for subsequent positioning and registration of the printed part, thereby improving the accuracy of the registration result and the accuracy of the printing adjustment;

[0045] (2) In the printed cement packaging bag image registration method and system provided in some embodiments of the present invention, by constructing edge chain codes for the pixels on the internal edge, and then calculating the probability that each internal edge belongs to the edge of the printed part based on the edge chain code and the surrounding grayscale values ​​of the pixels on the internal edge, the edges of the printed part can be screened in combination with the smoothness of the edge and the surrounding grayscale conditions, thereby improving the accuracy of the screening results;

[0046] (3) In the printed cement packaging bag image registration method and system provided in some embodiments of the present invention, each internal edge is fitted with the m other internal edges closest to its endpoint by using the least squares method, and then the growth coefficient corresponding to each internal edge is obtained by analyzing the difference between the gradient mean of the internal edge and the gradient mean of the m other internal edges around it, and the edges of the printed part are screened in combination with the growth coefficient, which can further reduce the influence of interference factors on the edge recognition of the printed part. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 An exemplary flow chart of a printed cement packaging bag image registration method provided by one embodiment of the present invention;

[0049] Figure 2 An exemplary module diagram of a printed cement packaging bag image registration system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a printed cement packaging bag image registration method and system proposed by the present invention, its specific implementation, structure, features and effects, in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0051] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0052] The specific scheme of the printed cement packaging bag image registration method and system provided by the present invention is described in detail below with reference to the accompanying drawings.

[0053] See also Figure 1 , which shows an exemplary flow chart 100 of a printed cement packaging bag image registration method provided by an embodiment of the present invention.

[0054] S110, acquiring the surface image of the cement packaging bag after printing and preprocessing it to obtain a grayscale image of the surface of the cement packaging bag. In some embodiments, S110 may be executed by the acquisition module 210 mentioned below.

[0055] Specifically, in some embodiments of the present invention, an image acquisition device (such as a camera) can be installed above the cement packaging bag printing device, and then the image acquisition device is used to capture the image of the surface of the printed cement packaging bag to obtain the surface image of the cement packaging bag that needs to be inspected, and then the surface image of the cement packaging bag is pre-processed by graying it, thereby obtaining a grayscale image of the cement packaging bag surface.

[0056] It can be understood that in the embodiment of the present application, by converting the surface of the colored cement packaging bag into a grayscale image, the amount of image data can be reduced while retaining the shape features, which helps to speed up subsequent image processing and analysis and reduce the complexity of the calculation process.

[0057] S120, performing edge detection on the grayscale image of the cement bag surface to obtain a partially connected domain and internal edges of the cement bag. In some embodiments, S120 may be performed by the edge detection module 220 mentioned below.

[0058] In an embodiment of the present application, in order to filter out the printed part in the cement packaging bag, edge detection can be performed on the grayscale image of the surface of the cement packaging bag to obtain a partially connected domain and an internal edge of the cement packaging bag.

[0059] Specifically, in some embodiments, canny edge detection can be performed on the grayscale image of the cement bag surface, and binary dilation can be used to perform morphological processing on the incompletely closed edge of the cement bag (i.e., the outermost edge obtained by edge detection), so that the edge of the cement bag is completely closed, and the partially connected domain of the cement bag and the internal edge located inside the partially connected domain of the cement bag are obtained. It should be noted that in this specification, the partially connected domain of the cement bag refers to the area corresponding to the cement bag part in the image, and the internal edge refers to the edge located in the area obtained by edge detection.

[0060] Since the surface texture and folds (wrinkles) of the cement packaging bag will result in the detection of the edges generated by the folds and textures when performing canny edge detection on the grayscale image of the cement packaging bag surface, after obtaining the aforementioned internal edge through canny edge detection, the printed part in the aforementioned internal edge can be further screened using the printed part feature to obtain the printed part (such as printed patterns, text, etc.) on the surface of the cement packaging bag. For the specific screening process, refer to S130-S160.

[0061] S130, constructing an edge chain code for each pixel point on the internal edge. In some embodiments, S130 may be executed by the edge chain code construction module 230 mentioned below.

[0062] The edge chain code (also known as the Freeman chain code) is a method of describing a curve or boundary using the coordinates of the curve starting point and the boundary point direction code. In some embodiments, the edge chain code construction module 230 can take the pixel point at one end of the aforementioned internal edge as the starting point, traverse each adjacent pixel point in the internal edge, and characterize the relative position relationship between each pixel point and the previous pixel point through preset parameters, thereby obtaining the edge chain code corresponding to each internal edge.

[0063] For example, in some embodiments, numbers 0 to 7 can be used for encoding, where each number represents a different relative direction. For example, 0 means that the next pixel is to the right of the previous pixel, 1 means that the next pixel is to the upper right of the previous pixel, 2 means that the next pixel is above the previous pixel, and so on. The smaller the difference between the previous and next values, the smoother the edge.

[0064] S140, based on the edge chain code and the surrounding grayscale values ​​of the pixels on the internal edge, calculate the probability that each of the internal edges belongs to the edge of the printed portion. In some embodiments, S140 may be executed by the probability calculation module 240 mentioned below.

[0065] Specifically, for the internal edges within the connected domain of the cement packaging bag, since the printed part on the surface of the cement packaging bag is mainly text and logo, the corresponding internal edges are usually smoother, while the edges formed by wrinkles and textures on the surface of the cement packaging bag are usually irregular edges, and the corresponding internal edges are more uneven. Based on this, in some embodiments, the smoothness of each internal edge can be analyzed, and then combined with the surrounding gray value features of each pixel on the internal edge, the probability of each internal edge belonging to the edge of the printed part is calculated.

[0066] Specifically, in some embodiments, an edge chain code can be constructed for the pixel points on each internal edge within the connected domain of the cement packaging bag, and then the degree of fluctuation of the code number in the edge chain code corresponding to each internal edge is compared, so as to analyze the smoothness of each internal edge. Furthermore, since the grayscale values ​​of the font and background color of the printed part are usually relatively uniform, the smaller the difference in the mean grayscale values ​​of all the pixels on the internal edge, the greater the possibility that it belongs to the edge of the printed part. Based on this, in the embodiment of the present application, the difference in the grayscale mean of each pixel point on the internal edge relative to the corresponding eight neighborhood pixels can also be combined to further analyze the probability that each internal edge belongs to the edge of the printed part.

[0067] In some embodiments, the probability that each internal edge belongs to the edge of the printed portion can be calculated as follows:

[0068]

[0069] Among them, Y i is the probability that the ith internal edge belongs to the edge of the printed part, i represents the ith internal edge in the connected domain of the cement packaging bag, j is the number of bits in the edge chain code corresponding to the internal edge (i.e., the sequence number corresponding to each code in the edge chain code), n is the number of codes in the edge chain code corresponding to the ith internal edge, l i,j is the jth code in the edge chain code corresponding to the i-th internal edge, l i,j-1 is the j-1th code in the edge chain code corresponding to the i-th internal edge, EB i It is the mean variance of the grayscale values ​​around (eight neighborhoods) of each pixel on the i-th internal edge, and exp() is an exponential function with the natural constant e as the base.

[0070] In other words, after obtaining the edge chain code corresponding to each internal edge through the above steps, the probability calculation module 240 can calculate the average value of the difference between two adjacent code numbers in the edge chain code corresponding to each internal edge to obtain the first mean value: Then, according to the difference between the gray value of each pixel on the internal edge and the gray mean of the corresponding eight neighboring pixels, the mean variance (EB) corresponding to the internal edge is obtained. i ); Further, the probability calculation module 240 can obtain the first parameter based on the product of the first mean and the mean variance. Finally, the first parameter is subjected to exponential operation to obtain the probability Y that the internal edge belongs to the edge of the printed part. i Specifically, in some embodiments of the present specification, the natural constant e can be used as the base, and the inverse of the product of the first mean and the mean variance (that is, the first parameter ) is used as the exponent to perform exponential operation and obtain the probability that the internal edge belongs to the edge of the printed part.

[0071] Specifically, in some embodiments, the mean variance (EB) corresponding to the internal edge i ) can be calculated as follows: first, the second mean is obtained according to the grayscale mean of the eight neighboring pixels corresponding to each pixel on the internal edge (i.e., the grayscale mean of the eight pixels around each pixel on the internal edge is calculated); then, the square of the difference between the grayscale value of each pixel on the internal edge and the corresponding second mean is summed and divided by the number of pixels on the internal edge, thereby obtaining the mean variance EB corresponding to the internal edge. i .

[0072] It should be noted that for any internal edge inside the connected domain of the cement packaging bag, since the edge of the printed part is usually smoother, while the internal edges corresponding to other wrinkles and texture parts are more uneven, the first mean value is obtained by comparing the difference between the previous and next two codes in the edge chain code corresponding to each internal edge and averaging them. This value reflects the smoothness of the internal edge. The smaller the value, the smoother the internal edge is, and the higher the probability that it belongs to the edge of the printed part. Therefore, it is related to Y i Negative correlation; and, since the edge of the printed part separates the text pattern from the cement bag background, the grayscale values ​​around each pixel on the edge of the printed part are relatively close, so the variance EB is obtained by comparing the mean grayscale value of each edge pixel with the surrounding pixel. i The larger its value, the greater the change in the gray value of the internal edge, and the smaller the probability that it belongs to the edge of the printed part. i There is also a negative correlation.

[0073] At this point, by analyzing the smoothness of each internal edge and the grayscale value characteristics of the pixel points on the internal edge and the surrounding, the probability Y of each internal edge belonging to the edge of the printed part can be obtained. i .

[0074] S150, using the least square method to fit each of the internal edges to the m other internal edges closest to the endpoints, and based on the difference between the internal edge and the m other internal edges, obtain the growth coefficient corresponding to each of the internal edges. In some embodiments, S150 can be executed by the growth coefficient calculation module 250 mentioned below.

[0075] For the edge of the printed part, due to factors such as interference, the edge of the printed part may be divided and incomplete. Therefore, in some embodiments, for each internal edge, the m other internal edges (m=5 in the embodiment of the present application) closest to its endpoints can be selected for fitting, and then their growth coefficients are obtained by comparison.

[0076] Specifically, in some embodiments, for each internal edge, the growth coefficient calculation module 250 can use the least square method to fit each internal edge with the m other internal edges closest to its endpoints. The better the fitting effect, the more likely the temporal edge is to belong to the printed part. At the same time, by analyzing the difference between the gradient mean of the internal edge and the gradient mean of the surrounding m other internal edges, the growth coefficient corresponding to each internal edge can be obtained.

[0077] In some embodiments, the calculation process of the growth coefficient can be expressed as follows:

[0078] SZ i =max[exp(-ω i,a ×|t i,a -t i |×|h i,a -h i |)]

[0079] Among them, SZ i represents the growth coefficient of the ith internal edge, a represents any one of the m other internal edges closest to the endpoint of the ith internal edge (in the embodiment of the present application, the value of a is 1, 2, 3, 4, 5), ω i,a is the loss value when fitting the i-th internal edge with the nearest a-th other internal edge, t i,a is the average gradient value of the pixel points of the ath other internal edge closest to the endpoint of the i-th internal edge, t i is the average gradient value of the pixel points on the i-th internal edge, h i,a is the average gray value of the ath internal edge closest to the endpoint of the ith internal edge, h i is the average gray value of the i-th internal edge, exp() is an exponential function with the natural constant e as the base, and max[] represents the exponential function value corresponding to the m other internal edges (exp(-ω i,a ×|t i,a -t i |×|h i,a -h i |)) takes the maximum value as the growth coefficient corresponding to the i-th internal edge.

[0080] In other words, in some embodiments of the present application, the growth coefficient calculation module 250 can calculate the loss value (ω ... i,a ), the average gradient value of the pixels on each other internal edge (t i,a ) and the average gradient value of the pixel points on the internal edge of the target (t i )’s gradient difference (|t i,a -t i |), and the average grayscale value of the pixels on each other internal edge (h i,a ) and the average gray value of the pixels on the internal edge of the target (h i ) grayscale difference (|h i,a -h i |); Further, the growth coefficient calculation module 250 can perform an exponential operation based on the product of the aforementioned loss value, gradient difference and grayscale difference to obtain a second parameter (exp(-ω) corresponding to each of the aforementioned m other internal edges. i,a ×|t i,a -t i |×

[0081] |h i,a -h i |)); Finally, the growth coefficient calculation module 250 can select the maximum value of the second parameters corresponding to the aforementioned m other internal edges as the growth coefficient corresponding to the target internal edge.

[0082] As an example only, in some embodiments of the present application, the exponential operation may refer to an exponential function with the natural constant e as the base. Specifically, the growth coefficient calculation module 250 may use the natural constant e as the base, and the inverse of the product of the above loss value, gradient difference and grayscale difference (-ω i,a ×|t i,a -t i |×|h i,a -h i |) is used as the exponent to perform exponential operation to obtain the second parameter corresponding to each of the m other internal edges.

[0083] It should be noted that, in the embodiment of the present application, the m other internal edges closest to the endpoints of each internal edge are recorded as growth edges, and then the least squares method is used to fit each internal edge and its corresponding growth edge to obtain the loss value ω i,a The smaller the value, the better the fit between the growth edge and the internal edge. Therefore, the higher the growth coefficient corresponding to the internal edge, the closer it is to SZ. iAt the same time, by comparing the average gradient value of the pixel points on the internal edge with the gradient value between its growth edge, the gradient difference |t i,a -t i |, since the grayscale value of the edge pixels of the printed part changes more consistently, the smaller the gradient difference is, the larger the corresponding growth coefficient is, so it is consistent with SZ i In addition, by analyzing the average grayscale value of the eight neighboring pixels (excluding the edge pixel itself) of the internal edge and its growth edge pixel, since the grayscale values ​​of the printed part are similar, the grayscale difference |h i,a -h i |The smaller it is, the more it needs to be grown, so it is similar to SZ i Finally, by calculating the exponential function value (exp(-ω) corresponding to each internal edge and the m other internal edges (i.e., the aforementioned growth edges) corresponding to each internal edge i,a ×|t i,a -t i |×|h i,a -h i |)) and take the maximum value to get the growth coefficient corresponding to each internal edge.

[0084] S160, determining the printed portion edge based on the growth coefficient and the probability that the internal edge belongs to the printed portion edge. In some embodiments, S160 may be performed by the printed portion edge determination module 260 mentioned below.

[0085] Since the growth coefficient of the edge of the printed part is relatively large, in some embodiments, the printed part edge determination module 260 may i ×SZ i Compare it with the preset threshold σ, and then i ×SZ i The inner edge of >σ is used as the edge of the printed part.

[0086] In some embodiments, the preset threshold σ may be 0.8. It should be understood that the preset threshold σ is only an exemplary description, and in some embodiments, the preset threshold σ may be set to other values, such as 0.85, 0.75, 0.78, 0.82, etc.

[0087] By analyzing the growth coefficient of each internal edge and the probability that it belongs to the edge of the printed part through the above steps, the edge of the printed part can be screened out from all the internal edges located inside the connected domain of the cement packaging bag, thereby eliminating the interference caused by factors such as the surface texture and creases of the cement packaging bag.

[0088] S170, positioning the edge of the printed portion, and completing the registration according to the relative relationship between the edge of the printed portion and the connected domain of the cement bag portion. In some embodiments, S170 may be performed by the registration module 270 mentioned below.

[0089] After the edge of the printed part is screened out through the above steps, the registration module 270 can locate the edge of the screened printed part, and then complete the registration according to the relative relationship between the edge of the printed part and the aforementioned connected domain of the cement packaging bag part. Specifically, during the configuration process, the registration module 270 can analyze whether there is an inaccurate printing position caused by a printing problem according to the relative relationship between the edge of the printed part and the aforementioned connected domain of the cement packaging bag part. If it is inaccurate, the printing operation (for example, adjusting the printing position) is adjusted according to the edge of the printed part and the edge of the cement packaging bag part, so that the cement packaging bag pattern and text are finally printed at the correct position.

[0090] It can be understood that in the embodiment of the present application, the edge of the printed part is screened out from all the internal edges obtained by canny detection through the above method, and then a registration analysis is performed based on this, which can reduce the influence of the interference part on the edge detection effect, and provide accurate information for the subsequent positioning of the printed part and registration, thereby improving the accuracy of the registration result and the accuracy of the printing adjustment.

[0091] See also Figure 2 , which shows an exemplary module diagram 200 of a printed cement bag image registration system provided by an embodiment of the present invention. In some embodiments, the system may include an acquisition module 210, an edge detection module 220, an edge chain code construction module 230, a probability calculation module 240, a growth coefficient calculation module 250, a printed portion edge determination module 260, and a registration module 270. Among them:

[0092] The acquisition module 210 can be used to acquire the surface image of the cement packaging bag after printing and perform preprocessing to obtain a grayscale image of the surface of the cement packaging bag.

[0093] The edge detection module 220 can be used to perform edge detection on the grayscale image of the cement packaging bag surface to obtain a partially connected domain and internal edges of the cement packaging bag.

[0094] The edge chain code construction module 230 may be used to construct an edge chain code for each pixel point on the internal edge.

[0095] The probability calculation module 240 may be used to calculate the probability that each of the internal edges belongs to the edge of the printed portion based on the edge chain code and the surrounding grayscale values ​​of the pixels on the internal edge.

[0096] The growth coefficient calculation module 250 can be used to fit each of the internal edges with the m other internal edges closest to the endpoints using the least squares method, and obtain the growth coefficient corresponding to each of the internal edges based on the difference between the internal edge and the m other internal edges.

[0097] The printed portion edge determination module 260 may be configured to determine the printed portion edge based on the growth coefficient and the probability that the internal edge belongs to the printed portion edge.

[0098] The registration module 270 can be used to locate the edge of the printed portion and complete the registration according to the relative relationship between the edge of the printed portion and the connected domain of the cement packaging bag portion.

[0099] It should be understood that Figure 2 The printed cement bag image registration system and its modules shown can be implemented in various ways. For example, in some embodiments, the system and its modules can be implemented by hardware, software, or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or a dedicated design hardware. Those skilled in the art will understand that the above methods and systems can be implemented using computer executable instructions and / or included in processor control codes, such as such as carrier media such as disks, CDs or DVD-ROMs, programmable memories such as read-only memories (firmware), or data carriers such as optical or electronic signal carriers. Such codes are provided on. The system and its modules of this specification can not only be implemented by hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., but can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above hardware circuits and software (e.g., firmware).

[0100] For more details about the above modules, please refer to other places in this manual (for example Figure 1 part and its related description), which will not be repeated here.

[0101] In summary, the beneficial effects that may be brought about by the present invention include but are not limited to: (1) In the printed cement packaging bag image registration method and system provided in some embodiments of the present specification, by analyzing the growth coefficient of each internal edge and the probability that it belongs to the edge of the printed part, the edge of the printed part can be screened out from all the internal edges in the partially connected domain of the cement packaging bag, eliminating the interference caused by factors such as the surface texture and creases of the cement packaging bag, and providing accurate information for subsequent positioning and registration of the printed part, thereby improving the accuracy of the registration result and the accuracy of the printing adjustment; (2) In the printed cement packaging bag image registration method and system provided in some embodiments of the present specification, by constructing an edge chain code for the pixel points on the internal edge, and then based on the edge chain code, and the surrounding grayscale values ​​of the pixels on the internal edge to calculate the probability that each internal edge belongs to the edge of the printed part, and the smoothness of the edge and the surrounding grayscale conditions can be considered at the same time to screen the edges of the printed part, thereby improving the accuracy of the screening results; (3) In the printed cement packaging bag image registration method and system provided in some embodiments of the present specification, each internal edge is fitted with the m other internal edges closest to its endpoint by using the least squares method, and then the growth coefficient corresponding to each internal edge is obtained by analyzing the difference between the gradient mean of the internal edge and the gradient mean of the m other surrounding internal edges, and the printed part edges are screened in combination with the growth coefficient, which can further reduce the influence of interference factors on the recognition of the printed part edges.

[0102] It should be noted that different embodiments may produce different beneficial effects. In different embodiments, the beneficial effects that may be produced may be any one or a combination of the above, or may be any other beneficial effects that may be obtained.

[0103] It should also be noted that the order of the above embodiments of the present invention is for description only and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0104] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0105] The basic concepts of the present invention have been described above. Obviously, for those skilled in the art, the above detailed disclosure is only for example. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements and corrections to this specification. Such modifications, improvements and corrections are suggested in this specification, so such modifications, improvements and corrections still belong to the scope of the exemplary embodiments of this specification.

Claims

1. A printed cement packaging bag image registration method, It is characterized in that The method comprises: Acquire the surface image of the cement packaging bag after printing and perform preprocessing to obtain a grayscale image of the surface of the cement packaging bag; Performing edge detection on the grayscale image of the cement packaging bag surface to obtain a partially connected domain and an internal edge of the cement packaging bag; Constructing an edge chain code for each pixel point on the internal edge; Calculate the probability that each of the internal edges belongs to the edge of the printed portion based on the edge chain code and the surrounding grayscale values ​​of the pixels on the internal edge; Using the least square method to fit each of the internal edges to the m other internal edges closest to the endpoints, and obtaining a growth coefficient corresponding to each of the internal edges based on the difference between the internal edge and the m other internal edges; determining a printed portion edge based on the growth coefficient and the probability that the inner edge belongs to a printed portion edge; Positioning the edge of the printed portion, and completing registration according to the relative relationship between the edge of the printed portion and the connected domain of the cement packaging bag portion; The step of performing edge detection on the grayscale image of the cement packaging bag surface to obtain a partially connected domain and an internal edge of the cement packaging bag includes: Performing canny edge detection on the grayscale image of the cement packaging bag surface, and using binary dilation to perform morphological processing on the edges of the cement packaging bag that are not completely closed, so that the edges of the cement packaging bag are completely closed, and obtaining a partially connected domain of the cement packaging bag and an internal edge located inside the partially connected domain of the cement packaging bag; The method of fitting each of the internal edges with the m other internal edges closest to the endpoints by using the least square method, and obtaining the growth coefficient corresponding to each of the internal edges based on the difference between the internal edge and the m other internal edges, includes: For m other internal edges that fit with the target internal edge, calculate the loss value when each other internal edge fits with the target internal edge, the gradient difference between the average gradient value of the pixels on each other internal edge and the average gradient value of the pixels on the target internal edge, and the grayscale difference between the average grayscale value of the pixels on each other internal edge and the average grayscale value of the pixels on the target internal edge; Performing an exponential operation based on the product of the loss value, the gradient difference and the grayscale difference to obtain a second parameter corresponding to each of the m other internal edges; Selecting the maximum value of the second parameters corresponding to the m other internal edges as the growth coefficient corresponding to the target internal edge; The connected domain of the cement packaging bag part refers to the area corresponding to the cement packaging bag part in the image, and the internal edge refers to the edge located in the area obtained by edge detection.

2. The method according to claim 1, It is characterized in that The step of constructing an edge chain code for each pixel point on the internal edge includes: Taking the pixel point at one end of the inner edge as the starting point, traverse each adjacent pixel point in the inner edge, and characterize the relative position relationship between each pixel point and the previous pixel point through preset parameters to obtain the edge chain code corresponding to the inner edge.

3. The method according to claim 2, It is characterized in that The calculating the probability that each of the internal edges belongs to the edge of the printed portion based on the edge chain code and the surrounding grayscale values ​​of the pixels on the internal edge includes: Calculate the average of the difference between two adjacent code numbers in the edge chain code corresponding to each of the internal edges to obtain a first mean value; According to the difference between the gray value of each pixel point on the internal edge and the gray mean value of the corresponding eight neighboring pixels, the mean variance corresponding to the internal edge is obtained; Obtaining a first parameter based on the product of the first mean and the mean variance; An exponential operation is performed on the first parameter to obtain a probability that the internal edge belongs to an edge of a printed portion.

4. The method according to claim 3, It is characterized in that The method of obtaining the mean variance corresponding to the internal edge according to the difference between the grayscale value of each pixel point on the internal edge and the grayscale mean value of the corresponding eight neighborhood pixels includes: Calculate the grayscale mean of eight neighborhood pixels corresponding to each pixel on the internal edge to obtain a second mean; The squares of the differences between the grayscale value of each pixel on the internal edge and the corresponding second mean are summed and divided by the number of pixels on the internal edge to obtain the mean variance corresponding to the internal edge.

5. The method according to claim 4, It is characterized in that The performing an exponential operation on the first parameter to obtain a probability that the internal edge belongs to an edge of a printed portion includes: The natural constant An exponential operation is performed with the inverse of the product of the first mean and the mean variance as the base, to obtain the probability that the internal edge belongs to the edge of the printed part.

6. The method according to claim 1, It is characterized in that The exponential operation is performed based on the product of the loss value, the gradient difference and the grayscale difference to obtain a second parameter corresponding to each of the m other internal edges, including: The natural constant An exponential operation is performed with the inverse of the product of the loss value, the gradient difference and the grayscale difference as the base to obtain a second parameter corresponding to each of the m other internal edges.

7. The method according to claim 1, It is characterized in that The determining the edge of the printed portion based on the growth coefficient and the probability that the internal edge belongs to the edge of the printed portion comprises: An internal edge whose product of the growth coefficient and the probability that the internal edge belongs to the edge of the printed portion is greater than a preset threshold is taken as the edge of the printed portion, wherein the preset threshold is 0.

8.

8. A printed cement packaging bag image registration system, It is characterized in that The system comprises: An acquisition module is used to acquire the surface image of the cement packaging bag after printing and perform preprocessing to obtain a grayscale image of the surface of the cement packaging bag; An edge detection module is used to perform edge detection on the grayscale image of the cement packaging bag surface to obtain a partially connected domain and an internal edge of the cement packaging bag; An edge chain code construction module, used to construct an edge chain code for each pixel point on the internal edge; A probability calculation module, used for calculating the probability that each of the internal edges belongs to the edge of the printed part based on the edge chain code and the surrounding grayscale values ​​of the pixels on the internal edge; A growth coefficient calculation module, used for fitting each of the internal edges with the m other internal edges closest to the endpoints by using the least square method, and obtaining the growth coefficient corresponding to each of the internal edges based on the difference between the internal edge and the m other internal edges; a printed portion edge determination module, configured to determine a printed portion edge based on the growth coefficient and the probability that the internal edge belongs to the printed portion edge; A registration module, used for locating the edge of the printed part and completing the registration according to the relative relationship between the edge of the printed part and the connected domain of the cement packaging bag part; The step of performing edge detection on the grayscale image of the cement packaging bag surface to obtain a partially connected domain and an internal edge of the cement packaging bag includes: Performing canny edge detection on the grayscale image of the cement packaging bag surface, and using binary dilation to perform morphological processing on the edges of the cement packaging bag that are not completely closed, so that the edges of the cement packaging bag are completely closed, and obtaining a partially connected domain of the cement packaging bag and an internal edge located inside the partially connected domain of the cement packaging bag; The method of fitting each of the internal edges with the m other internal edges closest to the endpoints by using the least square method, and obtaining the growth coefficient corresponding to each of the internal edges based on the difference between the internal edge and the m other internal edges, includes: For m other internal edges that fit with the target internal edge, calculate the loss value when each other internal edge fits with the target internal edge, the gradient difference between the average gradient value of the pixels on each other internal edge and the average gradient value of the pixels on the target internal edge, and the grayscale difference between the average grayscale value of the pixels on each other internal edge and the average grayscale value of the pixels on the target internal edge; Performing an exponential operation based on the product of the loss value, the gradient difference and the grayscale difference to obtain a second parameter corresponding to each of the m other internal edges; Selecting the maximum value of the second parameters corresponding to the m other internal edges as the growth coefficient corresponding to the target internal edge; The connected domain of the cement packaging bag part refers to the area corresponding to the cement packaging bag part in the image, and the internal edge refers to the edge located in the area obtained by edge detection.

Citation Information

Patent Citations

  • Bridge crack detection method and system

    CN117237368A

  • Paper product printing defect detection method

    CN117541588A