Method for detecting deflection and movement defects of labeling in rectangular film

Through machine vision and image processing technology, combined with multiple image processing algorithms, the deflection and movement defects of labels in rectangular films are automatically detected, which solves the problems of low detection efficiency and poor accuracy in the existing technology, and achieves efficient and accurate quality control.

CN119090830APending Publication Date: 2024-12-06HUAQIAO UNIVERSITY +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411152696.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The existing technology lacks automated methods for detecting in-module labeling skew and moving defects in rectangular molds, which leads to error-prone, low efficiency, high cost, and difficult to ensure consistency and continuity of quality control. The detection method is single and not taken into consideration. The label position and angle increase the misjudgment rate, and the texture and background are not further processed in image processing, so the calculation complexity is high.

Method used

Using machine vision and image processing technology, through the setting of angle threshold and center range threshold, combined with grayscale conversion, mask operation, Gaussian filtering, adaptive histogram equalization, Canny algorithm, morphological closed operation and Hough transformation, automatically Detect and identify the skew and movement defects of labels in rectangular films, reduce edge detection complexity, and improve detection accuracy.

Benefits of technology

Automatic detection of labeling in rectangular films is realized, which improves detection efficiency and accuracy, takes into account the label position and angle, reduces the calculation complexity, and ensures the continuity and accuracy of quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119090830A_ABST
    Figure CN119090830A_ABST
Patent Text Reader

Abstract

The invention relates to a method for detecting deflection and movement defects of labeling in a rectangular film. The method comprises the following steps: acquiring an image which completely covers a label, locking a region of interest by implementing a mask technology, removing impurities by Gaussian filtering, improving and comparing a self-adaptive histogram in a balanced manner, and accurately extracting an edge by using a Canny algorithm. And refining the contour through morphological closed operation, accurately detecting line segments through Hough transform, and classifying and screening out four-side line segments. And determining a vertex according to line segment extension, calculating a boundary inclination angle and center offset, comparing a preset threshold value, and automatically identifying label deflection and displacement defects. According to the method, efficient and accurate detection of deflection and movement defects of the labeling in the rectangular film is achieved through the image processing technology, meanwhile, the label position and the inclination angle are considered, the image processing complexity is reduced through mask operation, and the detection accuracy of the rectangular labeling is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine vision technology and image processing methods, and in particular to a method for detecting deflection and movement defects of labeling inside a rectangular film. Background Art

[0002] In-mold labeling is a common process used in production and packaging to attach labels to the surface of products. However, due to transportation, equipment errors, vibration and instability of the machine, and improper operation on the production line, the labels of in-mold labeling often shift or tilt, affecting the appearance and quality of the product, and even causing misreading of information and incorrect use.

[0003] At present, there are few detection methods for the skew and movement defects of rectangular in-mold labeling, and there are the following problems: First, there is no automated detection, manual inspection is prone to errors, low efficiency, high cost, and it is difficult to ensure the consistency and continuity of quality control; second, the detection method is single, and does not take into account the position of the rectangular label and the angle of inclination of the label, thereby increasing the misjudgment rate; third, when processing the rectangular label image, the texture and background of the image are not further processed, which makes the calculation complexity relatively large. Summary of the invention

[0004] In order to solve the above problems, the present invention proposes a method for detecting the deflection and movement defects of rectangular in-mold labeling. The method uses machine vision and image processing technology to realize automatic detection and identification of deflection and movement defects of in-mold labeling.

[0005] The specific plan is as follows:

[0006] A method for detecting the deflection and movement defects of labeling in a rectangular film, wherein an angle threshold k and a center range threshold p are set, the center of the whole image is set as a reference to (X, Y), the whole image is set as a rectangle A, and the label is regarded as a rectangle and set as B; the method comprises the following steps:

[0007] S1, collect the image of the in-mold labeling label. The collected image includes the entire labeling position. The labeling position completely includes the label. The label does not cover the entire labeling position. The labeling position can completely include the entire product label and there is a certain amount of blank space on the top, bottom, left and right. The label skew and movement are within the blank range;

[0008] S2, grayscale conversion is performed on the collected image and pixel values ​​are bitwise inverted to enhance the image. After inversion, a rectangular area is first defined. The length and width of the rectangular area are both smaller than the length and width of the label rectangle. A mask operation is set to clear the defined rectangular area and obtain the region of interest. The image is then subjected to Gaussian filtering and adaptive histogram equalization to enhance the image contrast. The Canny algorithm is then used for edge detection to obtain a rectangular label B image containing various contours.

[0009] S3, after filtering out the contours that do not meet the edge features in the image, perform morphological closing operations to smooth and fill the filtered contours to make the contours continuous, and then use Hough transform to detect line segments;

[0010] S4, performing histogram calculation on the smoothed and padded image to obtain pixel distribution of the label in the horizontal and vertical directions, identifying the horizontal and vertical line segments of the image, and grouping the detected line segments according to the four boundary line segments of top, bottom, left, and right;

[0011] S5, each line segment in the four boundary line segment groups is screened. The starting coordinates of the boundary line segment are (x1, y1) and the ending coordinates are (x2, y2). First, the longest line segment in the left boundary line segment group is selected. The center coordinates of the line segment are set to (a, b), where Construct a horizontal line segment through the center coordinate. The ordinates of the start and end points of the horizontal line segment are the ordinates of the center point of the current line segment. The range of the abscissa is consistent with the image width. Let the start coordinates of the horizontal line segment be (x3, y3) and the end coordinates be (x4, y4). Determine whether there are other left boundary line segments that intersect with the horizontal line segment. If there is an intersection, calculate the abscissa of the center coordinate of the line segment. If the abscissa is less than a, it is recorded as an edge line segment. If there is no intersection, record the longest line segment as an edge line segment. Then, filter the remaining three boundary line segment groups in this way, and finally obtain the top line segment, the bottom line segment, the leftmost line segment, and the rightmost line segment, four groups of target edge line segments.

[0012] S6, extending the four groups of target line segments to obtain corresponding intersection points, obtaining four vertices, obtaining angle deviations between the corresponding four sides and the horizontal vertical line segments according to the coordinates of the four vertices, and comparing the obtained angles with the set angle threshold k. If the average angle deviation of the four sides is greater than the set angle threshold k, the label is considered to be skewed;

[0013] S7, extend the four groups of target line segments to obtain the corresponding intersection points, obtain four vertices, connect them in pairs to obtain the four sides of the corresponding target label, obtain the four midpoint coordinates of the four sides respectively, and connect the upper and lower midpoints, left and right midpoints in pairs to obtain the center point coordinates of the target label, and make a difference between the horizontal coordinate and the vertical coordinate of the center point coordinate of the target label and the horizontal coordinate X and vertical coordinate Y of the center point coordinate of the image, respectively, and take the absolute value to obtain the center offset range, which is compared with the set center threshold p. If the offset difference in any direction is greater than the set center threshold p, it is considered that the label has moved.

[0014] Furthermore, in step S2, Gaussian filtering is performed to reduce image noise before adaptive histogram equalization of the image, ensuring that the adaptive histogram equalization process can more accurately enhance the image contrast, not amplify the image noise, and maintain the image quality. The two-dimensional Gaussian function used by Gaussian filtering is used for denoising, and the formula is as follows:

[0015]

[0016] Among them, G(x,y) represents a Gaussian distribution function in two-dimensional space, x and y represent the horizontal and vertical coordinates in the two-dimensional space respectively; σ is the width parameter of the Gaussian distribution, which controls the degree of expansion of the Gaussian kernel in the x and y directions.

[0017] Furthermore, in step S2, adaptive histogram equalization is used to enhance the image, and the formula is as follows:

[0018]

[0019] Among them, P(i) represents the cumulative probability of gray level i and all gray levels below it, k represents the index variable of summation used to traverse all items that need to be added in the summation process, and p(k) represents the probability that the random variable takes the value k.

[0020] Furthermore, in step S2, when using the Canny algorithm for edge detection, it is necessary to calculate the gradient amplitude and gradient angle of the image. The formula for calculating the gradient amplitude is:

[0021]

[0022] The formula for calculating the gradient angle is:

[0023]

[0024] Among them, Gx and Gy represent the gradients in the x direction and y direction respectively.

[0025] Furthermore, step S4 identifies the horizontal and vertical line segments of the image, specifically: according to the accuracy requirements of the label, the line segment angle deviation is set to j, and the slope of the boundary segment is converted into an angle. If the absolute value of the angle is less than or equal to j, the line segment is classified as a horizontal line segment. If the absolute value of the difference between the angle and 90° is less than or equal to j, the line segment is classified as a vertical line segment.

[0026] Further, in step S5, the intersection of the left boundary line segment and the horizontal line segment is calculated, specifically: whether the two line segments have an intersection is determined, and the formula is as follows:

[0027] denominator=(x1-x2)(y3-y4)-(y1-y2)(x3-x4)

[0028] The two points on the boundary line segment are (x1, y1) and (x2, y2), and the two points on the horizontal line segment are (x3, y3) and (x4, y4). If denominator is zero, it means that the two line segments are parallel or coincident.

[0029] The formula for calculating the horizontal and vertical coordinates of the intersection point is as follows:

[0030] Horizontal axis

[0031] Vertical axis

[0032] The present invention adopts the above technical solution and has the following beneficial effects:

[0033] (1) A detection method for the deflection and movement defects of rectangular film inner labels is proposed. By using automated image processing technology, the detection of rectangular film inner labels can be completed without human intervention, thereby improving the detection efficiency and accuracy.

[0034] (2) The detection method takes into account both the position of the label and the tilt angle of the label, effectively improving the accuracy of labeling detection in rectangular films.

[0035] (3) Masking operation is used to obtain the region of interest, and the image is further processed to reduce the complexity of edge detection and contour screening. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 is a flow chart of an embodiment of the present invention;

[0037] Figure 2 is a positive label detection result that meets the skew threshold in an embodiment of the present invention; wherein (a) represents the original image, and (b) represents the detection result image;

[0038] Figure 3 is a detection result of a skew label that does not meet the skew threshold in an embodiment of the present invention; wherein (a) represents the original image, and (b) represents the detection result image;

[0039] Figure 4 After edge detection in the embodiment of the present invention, a rectangular label B image containing various contours is obtained. DETAILED DESCRIPTION

[0040] The present invention is further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.

[0041] This embodiment takes a rectangular label on a plastic square barrel as an example for detection. The overall image size is 800*800, the angle threshold is set to 0.4° and the center range threshold is set to 8. The center of the overall image is set as (X, Y) as the reference, the overall image is set to rectangle A, and the label is regarded as a rectangle and set to B;

[0042] like Figure 1 As shown, the present invention provides a method for detecting the deflection and movement defects of labeling in a rectangular film, comprising the following steps:

[0043] S1, after calibration and correction, the industrial camera collects the image of the plastic square barrel after in-mold labeling. The labeling position of the image completely includes the label, and the label does not cover the entire labeling position. It can completely include the entire product label and have a certain amount of blank space on the top, bottom, left and right. The label skew and movement must be within the blank range, that is, the reserved position for labeling.

[0044] S2, grayscale conversion is performed on the collected image and pixel values ​​are bitwise inverted to enhance the image. After inversion, a mask operation is set to selectively modify the region of interest of the image, specifically: a rectangular area is defined, wherein the length and width of the rectangular area are smaller than the label rectangle. In this embodiment, the upper left corner of the rectangle starts at 1 / 14 of the image width and 1 / 10 of the height, while the lower right corner ends at 13 / 14 of the width and 15 / 16 of the height. The defined rectangular area is removed from the inverted image through a mask operation, and then the image is subjected to Gaussian filtering and adaptive histogram equalization to enhance the contrast of the image. The Canny algorithm is used for edge detection to obtain a rectangular label B image containing various contours. Therefore, step S2 can be divided into three parts, the first part is Gaussian filtering, the second part is adaptive histogram equalization, and the third part is Canny edge detection, wherein the first part of Gaussian filtering uses a two-dimensional Gaussian function for denoising, and the formula is as follows:

[0045]

[0046] Where x and y are coordinates in two-dimensional space, σ represents the standard deviation, which is used to measure the width parameter of the Gaussian distribution. The specific steps for using the two-dimensional Gaussian function are as follows:

[0047] S2 Part 1, Step 1: Select any pixel point (i, j) in the image, determine the neighborhood of the current pixel point according to the Gaussian kernel size, and take a Gaussian kernel of size 3x3;

[0048] S2 Part 1, Step 2: Substitute each element in the kernel into the two-dimensional Gaussian function G(x,y) and calculate the weight of the pixel in the neighborhood relative to the center point (i,j);

[0049] S2 Part 1, Step 3: Multiply the grayscale value of each pixel in the neighborhood by its corresponding Gaussian kernel weight, and then add these weighted values ​​to obtain the new pixel value;

[0050] S2 Part 1, Step 4: Assign the calculated new pixel value to the original pixel point (i, j);

[0051] S2 Part 1, Step 5: Repeat the above process for each pixel in the image.

[0052] The key formula for the second part of adaptive histogram equalization to enhance the image is as follows:

[0053]

[0054] P(i) represents the cumulative probability of gray levels i and below, k represents the index variable for summation, which is used to traverse all items that need to be added during the summation process, and p(k) represents the probability that the random variable takes the value k. The specific steps of using adaptive histogram equalization enhancement are as follows:

[0055] S2 Part 2, Step 1: Divide the image into N×N small blocks, in this embodiment, N=8, and set clipLimit=2.0, where the clipLimit parameter is used to control the degree of contrast enhancement in the histogram equalization process;

[0056] S2 Part 2, Step 2: Calculate the histogram (counting the number of pixels of each gray level in the area) and the cumulative distribution function (CDF) for each small block (CDF represents the proportion of pixels less than or equal to a certain gray level to the total pixels in the area);

[0057] S2 Part 2, Step 3: For each small block, create a mapping function that maps the original grayscale value to the new value, but only adjust the pixels whose CDF is lower than the cliplimit;

[0058] S2 Part II, Step 4: For overlapping areas, smooth the boundaries using interpolation methods;

[0059] S2 Part 2, Step 5: Synthesize all small blocks to form a contrast-enhanced image.

[0060] The third part uses the Canny algorithm to perform edge detection, which requires calculating the gradient amplitude and gradient angle of the image. The gradient amplitude represents the magnitude of the change in pixel intensity in the image and is used to measure the strength of the edge. It is calculated by applying a first-order derivative operator to the image. In this embodiment, the Canny algorithm uses the Sobel operator, including convolution kernels in the horizontal and vertical directions, where the horizontal direction (Sobel x): Vertical direction (Sobel y): Apply convolution kernels in two directions to each pixel of the image to obtain the gradient components Gx and Gy of the corresponding pixel in the horizontal and vertical directions. The formula for calculating the gradient amplitude Edge_Gradient(G) of the image is:

[0061]

[0062] The formula for calculating the gradient angle θ is:

[0063]

[0064] Where Gx and Gy represent the gradients in the x-direction and y-direction respectively;

[0065] S3, such as Figure 4 As shown, in the rectangular label B image, there are still many non-edge contours inside the boundary line segment, which will interfere with the detection of the line segment. It is necessary to first filter out the contours that do not meet the edge features in the image. At the same time, if the edge contour is discontinuous, a morphological closing operation is required to smooth and fill the filtered contours to make the contours continuous. Then, the Hough transform is used to detect the line segment. Therefore, step S3 can be divided into two parts. The first part is the morphological closing operation, and the second part is the Hough transform detection of the line segment.

[0066] Among them, the specific steps of the first part of morphological closing operation are:

[0067] S3 Part 1, Step 1: Perform a dilation operation to expand the foreground in the horizontal and vertical directions to cover the background points that overlap with the structural element;

[0068] S3 Part 1, Step 2: Perform an erosion operation to remove points that are not completely surrounded by the foreground inside the structural element;

[0069] S3 Part 1, Step 3: Perform a closing operation to fill the holes in the image and connect the separated objects in the image.

[0070] Among them, the specific steps of the second part of Hough line detection are:

[0071] S3 Part 2, Step 1: Traverse each edge pixel in the image and convert it into a point in the parameter space;

[0072] S3 Part 2, Step 2: “Vote” for the point corresponding to each edge pixel in the parameter space, and the accumulator counts the number of votes for each point;

[0073] S3 Part 2, Step 3: When the number of votes for a point in the parameter space exceeds a threshold, in this embodiment, threshold=60 is set, it is considered that a straight line is detected;

[0074] S3 Part II, Step 4: Extract all points that exceed the threshold and use the least squares method to determine the exact position of the line based on the distribution of these points.

[0075] S4, calculate the histogram of the smoothed and padded image to obtain the pixel distribution of the label in the horizontal and vertical directions, which is used to identify the horizontal and vertical line segments of the image, and group the detected line segments according to the four boundary line segments of upper, lower, left and right. Specifically, set the line segment angle deviation j to 10°, convert the slope of the boundary line segment into an angle, if the absolute value of the angle deviation from 0° is less than or equal to 10°, classify the line segment as a horizontal line segment, if the absolute value of the difference between the angle and 90° is less than or equal to 10°, classify the line segment as a vertical line segment, and finally classify the horizontal and vertical line segments into the four boundary line segment groups of upper, lower, left and right;

[0076] S5, screen each line segment in the four boundary line segment groups, first select the longest line segment in the left boundary line segment group, set the starting coordinates of the boundary line segment to (x1, y1), the end coordinates to (x2, y2), and the center coordinates of the longest line segment to (a, b), that is Construct a horizontal line segment through the center coordinate. The ordinates of the start and end points of the horizontal line segment are the ordinates of the center point of the current line segment. The range of the abscissa is consistent with the image width. Suppose the start coordinate of the horizontal line segment is (x3, y3) and the end coordinate is (x4, y4). Determine whether there are other left boundary line segments that intersect with the horizontal line segment. If there is an intersection, calculate the abscissa of the center coordinate of the line segment. If the abscissa is less than a, it is recorded as an edge line segment. If there is no intersection, record the longest line segment as an edge line segment. Then, filter the remaining three boundary line segment groups in this way, and finally obtain four target line segments: the top line segment, the bottom line segment, the leftmost line segment, and the rightmost line segment.

[0077] In S5, it is determined whether there are other left boundary line segments that intersect with the horizontal line segment. The specific steps are as follows:

[0078] Step 1: Traverse all line segments in the left boundary line segment in turn, take the boundary line segment that has not been calculated, set its starting point coordinates to (x1, y1), and its end point coordinates to (x2, y2), then take the horizontal line segment, set its starting point coordinates to (x3, y3), and its end point coordinates to (x4, y4);

[0079] Step 2: Substitute the formula to determine whether the two line segments intersect. The formula is as follows:

[0080] denominator=(x1-x2)(y3-y4)-(y1-y2)(x3-x4)

[0081] If denominator is zero, it means that the two line segments are parallel or coincident and have no intersection;

[0082] Step 3: If there is no intersection point, go to Step 1 to calculate the next left boundary line segment. If there is an intersection point, calculate the coordinates of the intersection point. The formulas for calculating the abscissa and ordinate of the intersection point are as follows:

[0083]

[0084] Step 4: Determine the size relationship between the position x of the intersection point on the abscissa and the abscissa a of the leftmost line segment of the current target. If x > a, set the leftmost line segment of the target as the current line segment. If x < a, the leftmost line segment of the target remains unchanged;

[0085] Step 5: Repeat the above Steps 1 to 4 until the final leftmost line segment of the target is found.

[0086] S6. Extend the four groups of target line segments to obtain the corresponding intersection points, getting four vertices. Calculate the average value of the angle deviations between the corresponding four sides and the horizontal and vertical line segments according to the coordinates of the four vertices. Compare it with the angle threshold of 0.4° set according to the standard sample. If the average value of the angle deviations of the four sides is greater than the set angle threshold of 0.4°, it is considered that the label is skewed. As Figure 3 shown, where the angle skew threshold is set to 0.4°. 0.24 indicates that the included angle between the upper edge line segment and the horizontal line segment is 0.24°, with a deviation of 0.24° from the standard 0°. 89.52 indicates that the included angle between the left edge line segment and the horizontal line segment is 89.52°, with a deviation of 0.48° from the standard 90°. Similarly, the deviation of the right edge line segment is 0.08°, and the deviation of the lower edge line segment is 0.4°. The average skew is 0.24° + 0.48° + 0.08° + 0.4° ≤ the angle skew threshold of 0.4°. It is judged that the skew is normal and the label detection is qualified. As Figure 2 shown; conversely, if the average skew > 0.4° as Figure 3 shown, it is judged that the skew is too large and the detection is unqualified.

[0087] S7. Extend the four groups of target line segments to obtain the corresponding intersection points, getting four vertices. Connect the four vertices in pairs to obtain the four sides of the corresponding target label. Calculate the coordinates of the four midpoints for the four sides respectively, and connect the upper and lower sides, and the left and right sides in pairs to obtain the center point coordinates of the target label. Take the absolute value of the difference between the abscissa and ordinate of the center point coordinates of the target label and the abscissa X and ordinate Y of the image center point coordinates respectively to obtain the center offset range. Compare it with the set center threshold. If the offset difference is greater than the set center threshold, it is considered that the label has moved. In this embodiment: the set center threshold is 8, that is, when the abscissa deviation value and the ordinate deviation value are both ≤ 8, it is qualified, otherwise it is unqualified.

[0088] Although the present invention has been specifically shown and described in conjunction with the preferred embodiments, it should be understood by those skilled in the art that various changes may be made to the present invention in form and details without departing from the spirit and scope of the present invention as defined by the appended claims, all of which are within the scope of protection of the present invention.

Claims

1. A method for detecting the deflection and movement defects of labeling in rectangular films, It is characterized in that Taking the qualified labeled product as the standard, setting the angle threshold and the center range threshold, setting the center of the overall image of the labeled product as the reference as (X, Y), setting the overall image as rectangle A, and setting the label as rectangle B; the method comprises the following steps: S1, collects rectangular in-mold label images; S2, convert the collected image into grayscale and invert the pixel value bit by bit, set the mask operation to obtain the region of interest, perform Gaussian filtering and adaptive histogram equalization on the image to enhance the image contrast, and use the Canny algorithm for edge detection; S3, after contour screening, morphological closing operation is performed to smooth the contour, and then Hough transform is used to detect line segments; S4, performing histogram calculation on the smoothed image to obtain pixel distribution of the label in the horizontal and vertical directions, identifying the horizontal and vertical line segments of the image, and grouping the detected line segments according to the four boundary line segments of top, bottom, left, and right; S5, screening each line segment in the four boundary line segment groups to obtain four groups of target line segments, namely, the top line segment, the bottom line segment, the leftmost line segment, and the rightmost line segment; S6, extending the four groups of target line segments to obtain corresponding intersection points, obtaining four vertices, and obtaining the angle deviations of the corresponding four edges and the horizontal and vertical line segments according to the coordinates of the four vertices. If the average angle deviation of the four edges is greater than the set angle threshold k, the label is considered to be skewed; S7, taking the absolute value of the difference between the horizontal coordinate and the vertical coordinate of the center point of the target tag and the horizontal coordinate X and the vertical coordinate Y of the center point of the image, and comparing the absolute difference with the set center threshold p. If the difference in any direction is greater than the set center threshold p, it is considered that the tag has moved.

2. A method for detecting deflection and movement defects of labeling in a rectangular film according to claim 1, It is characterized in that In step S2, the Gaussian filtering noise reduction is to use a two-dimensional Gaussian function to perform noise reduction processing, as follows: Among them, G(x,y) represents a Gaussian distribution function in two-dimensional space, x and y represent the horizontal and vertical coordinates in the two-dimensional space respectively; σ is the width parameter of the Gaussian distribution, which controls the degree of expansion of the Gaussian kernel in the x and y directions.

3. A method for detecting deflection and movement defects of labeling in a rectangular film according to claim 1, It is characterized in that In step S2, the adaptive histogram equalization enhances the contrast of the image, which is expressed as follows: Among them, P(i) represents the cumulative probability of gray level i and all gray levels below it, k represents the index variable of summation used to traverse all items that need to be added in the summation process, and p(k) represents the probability that the random variable takes the value k.

4. A method for detecting deflection and movement defects of labeling in rectangular film according to claim 1, It is characterized in that In step S2, the Canny algorithm needs to calculate the gradient amplitude and gradient angle of the image when performing edge detection, as follows: The formula for calculating the gradient amplitude is: The formula for calculating the gradient angle is: Among them, Gx and Gy represent the gradients in the x direction and y direction respectively.

5. A method for detecting deflection and movement defects of labeling in a rectangular film according to claim 1, It is characterized in that Identify the horizontal and vertical line segments of the image, specifically: according to the accuracy requirements of the label, set the line segment angle deviation to j, convert the slope of the boundary segment into an angle, if the absolute value of the angle is less than or equal to j, classify the line segment as a horizontal line segment, if the absolute value of the difference between the angle and 90° is less than or equal to j, classify the line segment as a vertical line segment.

6. A method for detecting deflection and movement defects of labeling in rectangular film according to claim 1, It is characterized in that In step S5, each line segment in the four boundary line segment groups is screened to determine whether two line segments have an intersection. The formula is as follows: denominator=(x 1 -x 2 )(and 3 -and 4 )-(and 1 -and 2 )(x 3 -x 4 ) The two points on the boundary segment are (x 1 ,y 1 ),(x 2 ,y 2 ), the two points of the horizontal line segment are (x 3 ,y 3 ),(x 4 ,y 4 ), if denominator is zero, it means that the two line segments are parallel or coincident; The formula for calculating the horizontal and vertical coordinates of the intersection point is:

Citation Information

Cited By

  • Label image correction processing method, device and equipment

    CN121527769A