Label detection method and apparatus for curved containers
By obtaining image reference points for curved containers through image processing techniques and using regression equations to predict rotation and offset, the problem of low detection efficiency in existing technologies is solved, and efficient and accurate label detection is achieved.
Patent Information
- Application Number
- CN202210524062.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-13
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2042-05-13
AI Technical Summary
Existing technologies require frequent fixture operations when inspecting labels on curved containers on automated production lines, resulting in low production efficiency and inaccurate determination of label misalignment due to rough inspection.
By employing image processing technology, image reference points of curved containers are obtained, and regression equations are used to predict container rotation and label offset, avoiding fixture operations and improving detection accuracy.
This technology enables accurate detection of whether curved containers are rotated and whether labels are offset without the use of fixtures, improving the accuracy of detection results and production efficiency.
Smart Images

Figure CN117094932B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine vision technology, specifically to a label detection method and apparatus for curved containers. Background Technology
[0002] Curved containers are containers whose outer surfaces include curved surfaces, such as bottles with curved bodies or cups with curved bodies. On curved containers, product labels are typically located within a region of the curved surface. Currently, in automated production lines, label inspection of curved containers usually involves using a fixture to rotate the container and determine the label's position on the surface. This method of label positioning requires frequent fixture manipulation, reducing production efficiency. When rapid production is required, only coarse inspections can be performed, such as checking for the presence of a label on the curved container. Summary of the Invention
[0003] In view of this, this application provides a label detection method and apparatus for curved containers, which does not require the use of fixtures and can determine whether the label on the curved container has shifted.
[0004] This application provides a label detection method for a curved container. The label detection method includes: acquiring a first image containing a label of the curved container; acquiring multiple reference points from the first image; acquiring a first width of the curved container and first position data of the label based on the multiple reference points; determining whether the curved container has rotated based on the first width and a preset standard width; predicting a second width of the curved container based on the first position data and a preset regression equation when the curved container has rotated; and determining whether the label has shifted based on the first width and the second width.
[0005] The label detection method of this embodiment can detect both whether the curved container has rotated and whether the label on the curved container has shifted. Furthermore, it avoids the influence of the curved container's rotation on the label detection results, thus improving the accuracy of the label detection.
[0006] A second aspect of this application provides a label detection device, which includes a processor and a memory. The processor can run computer programs or code stored in the memory to implement the label detection method of the embodiments of this application.
[0007] It is understood that the specific implementation methods and beneficial effects of the second aspect of this application are the same as those of the first aspect of this application, and will not be repeated here. Attached Figure Description
[0008] Figure 1 This is a schematic diagram illustrating the detection of a curved container label on a production line.
[0009] Figure 2 One example Figure 1 The corresponding top view.
[0010] Figure 3 This is a schematic diagram illustrating the marking of reference points on a curved container, as shown in one example.
[0011] Figure 4 One example Figure 3 The corresponding top view.
[0012] Figure 5 This is a top view of a curved container in an example where it has not been rotated.
[0013] Figure 6 This is a top view of the curved container in another example where it has not been rotated.
[0014] Figure 7 This is a top view of a curved container that has been rotated in an example.
[0015] Figure 8 This is a flowchart of the label detection method provided in this application.
[0016] Figure 9 yes Figure 8 The flowchart for obtaining the regression equation before step S106.
[0017] Figure 10 This is a schematic diagram of linear fitting in one example.
[0018] Figure 11 This is a top view of the curved container in another example where it has not been rotated.
[0019] Figure 12 This is a top view of the curved container in another example where it has not been rotated.
[0020] Figure 13 This is a top view of a curved container that has been rotated, in another example.
[0021] Figure 14 This is a schematic diagram of the label detection device provided in this application.
[0022] Explanation of main component symbols
[0023] Conveyor Belt 21
[0024] Guide rail 22
[0025] Guardrail 23
[0026] Curved Container 200
[0027] Tag 201
[0028] Camera equipment 101
[0029] Tag detection device 100
[0030] Processor 102
[0031] Memory 103 Detailed Implementation
[0032] It should be noted that in the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone, where A and B can be singular or plural. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and drawings of this application are used to distinguish similar objects, not to describe a specific order or sequence.
[0033] It should also be noted that the methods disclosed in the embodiments of this application or the methods shown in the flowcharts include one or more steps for implementing the method. Without departing from the scope of the claims, the execution order of multiple steps can be interchanged, and some steps can also be deleted.
[0034] The following describes some of the terms used in the embodiments of this application.
[0035] 1. Image coordinate system
[0036] An image coordinate system is established based on the image of the curved container without rotation. The horizontal direction of the image coordinate system is the x-axis, which represents the maximum thickness direction of the curved container without rotation. The vertical direction of the image coordinate system is the y-axis, which represents the maximum width direction of the curved container without rotation. In this paper, the maximum thickness direction of the curved container without rotation is the same as the width direction of the conveyor belt on the production line, and the maximum width direction of the curved container without rotation is the same as the length direction of the conveyor belt.
[0037] 2. Distance and Vector
[0038] In this paper, the distance between two points in the image coordinate system is represented by the symbol "||", and the vector formed by the two points is represented by the symbol "→". For example, "|AB|" represents the distance between points A and B. Let A be the vector formed by points A and B, and let B be the vector whose direction is from point A to point B.
[0039] The following describes the application scenarios of the label detection method provided in this application.
[0040] Please refer to them together. Figure 1 and Figure 2 , Figure 1 This is a schematic diagram of inspecting labels on curved containers on a production line. Figure 2 One example Figure 1 The corresponding top view.
[0041] like Figure 1 As shown, the production line includes a conveyor belt 21, guide rails 22, and guardrails 23. A curved container 200 is placed on the conveyor belt 21. The control unit of the production line can control the movement of the conveyor belt 21, causing the curved container 200 to move. The guide rails 22 and guardrails 23 are positioned above the conveyor belt 21. The guardrails 23 prevent the curved container 200 from moving to the outside of the conveyor belt 21. The guide rails 22 are positioned in a fixed location area and are fixedly connected to the guardrails 23, without contacting the conveyor belt 21. That is, the position of the guide rails 22 is fixed, and the movement of the conveyor belt 21 will not cause the guide rails 22 to move. A label 201 is provided on the curved container 200. A camera device 101 is used to photograph the curved container 200 to obtain an image of the curved container including the label 201.
[0042] like Figure 2 As shown, two rows of guardrails 23 are installed on both sides of the conveyor belt 21 along its width direction (i.e., the x-axis direction). Two rows of guide rails 22 are installed in a fixed position area of the two rows of guardrails 23. The distance between the two rows of guide rails 22 is at least greater than the maximum thickness of the curved container 200, allowing the curved container 200 to pass between the two rows of guide rails 22. When the curved container 200 moves to the position area of the guide rails 22, the guide rails 22 can adjust the rotation angle of the curved container 200 relative to the length direction (i.e., the y-axis direction) of the conveyor belt 21, so that the rotation angle returns to the normal angle range. The normal angle range refers to the angle range within which the camera device 101 can capture the label 201; for example, the rotation angle θ satisfies: -15 ≤ θ ≤ 15 degrees. The positive and negative directions of this rotation angle can be set as needed.
[0043] In some embodiments, the guide rail 22 is a ball bearing guide rail, which can reduce the friction generated during the contact with the curved container 200 when adjusting the rotation angle of the curved container 200.
[0044] It is understood that the camera device 101 is shooting towards the side of the curved container 200 where the label 201 is located, and the shooting range of the camera device 101 can cover the maximum width of the curved container 200.
[0045] In this embodiment, the camera device 101 sends the captured image of the curved container containing the label 201 to the label detection device. The label detection device uses the label detection method of this embodiment to detect the image of the curved container containing the label 201 to determine whether the label 201 has shifted.
[0046] The technical principles of the label detection method provided in this application will be explained below.
[0047] Please refer to them together. Figure 3 and Figure 4 , Figure 3 This is a schematic diagram showing reference points marked on a curved container. Figure 4 One example Figure 3 The corresponding top view.
[0048] like Figure 3 As shown, five reference points C, L, R, A, and B are marked on the curved container 200. Reference point C is a point on the central axis (i.e., the z-axis) of label 201. Reference points L and R are two points obtained by extending from reference point C to both sides of the width direction of the curved container 200. Reference points C, L, and R are all located on label 201. Reference point A is located from reference point L... The direction extends to the point on the edge of the curved container 200, and the reference point B is from the reference point R towards... The direction extends to the point on the edge of the curved container 200.
[0049] like Figure 4 As shown, from the shooting perspective of camera device 101, reference points A and B are points on both sides of the curved container 200 in the width direction that camera device 101 can capture. It can be understood that in the image of the curved container captured by camera device 101, the distance between reference points A and B in the length direction (i.e., the y-axis direction) of conveyor belt 21 is less than the maximum width of the curved container 200.
[0050] It is understandable that since the position of label 201 on the curved container 200 is fixed, the distance between any two points among reference points C, L, and R on label 201 remains unchanged regardless of whether label 201 is offset. When label 201 is offset, the relative position between any point among reference points C, L, and R and any point among reference points A and B also changes. If the change in relative position is used to determine whether label 201 has been offset, then when the curved container 200 rotates, over-judgment may occur. Over-judgment refers to misclassifying normal data as abnormal data.
[0051] For example, see also Figures 5 to 7 , Figure 5 and Figure 6 This is the top view of the curved container without rotation. Figure 7 It is a top view of a curved container that has been rotated.
[0052] like Figure 5 As shown, the curved container 200 did not rotate, and the relative position of any point among reference points C, L, and R to any point among reference points A and B did not change, so it can be determined that the label 201 did not shift.
[0053] like Figure 6 As shown, the curved container 200 has not rotated, but the relative position of any point among reference points C, L, and R with any point among reference points A and B has changed, which indicates that label 201 has shifted.
[0054] like Figure 7 As shown, the curved container 200 rotates. From the shooting perspective of the camera device 101, the camera device 101 can capture the points on both sides of the curved container 200's width direction changing to reference points A' and B'. At this time, the relative position of any point among reference points C, L, and R with any point among reference points A' and B' changes, which can determine that label 201 has shifted. However, label 201 has not actually shifted, and the judgment result is overcorrected.
[0055] To address the aforementioned issues, the label detection method provided in this application employs regression analysis to predict the distance between reference points A' and B' when the curved container rotates. The predicted distance between reference points A' and B' is compared with the actual distance, and the label is determined to have shifted based on the comparison results.
[0056] For details, please refer to Figure 8 , Figure 8 This is a flowchart of the label detection method provided in this application.
[0057] Label detection methods can be applied to label detection devices. For example... Figure 8 As shown, the label detection method may include the following steps:
[0058] S101, Obtain the first image.
[0059] The first image refers to the surface container image containing the label.
[0060] In this embodiment, the camera device captures a first image. The tag detection device can acquire the first image from the camera device.
[0061] S102, Obtain reference points C, L, R, A', B' from the first image.
[0062] In this embodiment, the label detection device can perform template matching between the first image and the template image marked with reference points to obtain a template image that matches the first image, and then mark each reference point on the first image according to the relative position of each reference point on the template image.
[0063] It is understandable that the template image may be derived from the test sample.
[0064] S103, obtain the distance |CL| between reference points C and L, the distance |CR| between reference points C and R, and the distance |A′B′| between reference points A' and B' in the vertical direction of the image coordinate system.
[0065] Understandable, such as Figure 7 As shown, |CL|, |CR|, and |A′B′| all refer to the distance between two points in the vertical direction (i.e., the y-axis direction) of the image coordinate system on the first image.
[0066] S104, obtain reference points A and B on both sides of the curved container in the width direction on the standard image, and obtain the distance |AB| between reference points A and B in the vertical direction in the image coordinate system.
[0067] The standard image is an image of a curved container that has not been rotated and whose label has not been offset.
[0068] In this embodiment, the label detection device can retrieve a standard image from the test sample, and then calculate the distance |AB| between reference points A and B in the vertical direction (i.e., the y-axis direction) of the image coordinate system based on the positions of reference points A and B on the standard image.
[0069] S105, determine whether ||A′B′|-|AB|| / |AB| is greater than the preset first threshold.
[0070] If ||A′B′|-|AB|| / |AB| is greater than the first threshold, then proceed to step S106. Otherwise, proceed to step S110.
[0071] In this embodiment, ||A′B′|-|AB|| / |AB| represents the difference between the first width and the preset standard width after normalization. The first width refers to the distance |A′B′| between reference points A' and B' in the vertical direction in the image coordinate system of the first image. The standard width refers to the distance |AB| between reference points A and B in the vertical direction in the image coordinate system of the standard image.
[0072] When ||A′B′|-|AB|| / |AB| is less than or equal to the first threshold, it indicates that the distance between the reference points on both sides of the curved container's width direction on the first image and the standard image is similar, and it can be determined that the curved container has not rotated.
[0073] When ||A′B′|-|AB|| / |AB| is greater than the first threshold, it indicates that there is a difference in the distance between the reference points on both sides of the curved container's width direction in the first image and the standard image. At this time, it can be determined that the curved container has rotated.
[0074] In some embodiments, the first threshold μ satisfies: 0 < μ ≤ 0.01. It is understood that the first threshold can be set as needed. The ranges of the second and third thresholds described below are the same as those of the first threshold, and will not be repeated hereafter.
[0075] S106, predict the distance |A″B″| between reference points A” and B” on the reference image based on |CL| / |CR| and the preset regression equation.
[0076] The reference image refers to the image where the curved container is rotated at the same angle as the first image and the label has not shifted. Reference points A” and B” are reference points on the image coordinate system of the reference image, located at the vertical edges of the curved container along its width direction.
[0077] |CL| / |CR| represents the first position data of the label. That is, the first position data refers to the ratio of the distance |CL| between reference points C and L in the vertical direction in the image coordinate system on the first image to the distance |CR| between reference points C and R.
[0078] In this embodiment, the regression equation is used to describe the correspondence between |CL| / |CR| and |A″B″| when the labels have not shifted. For a method to obtain the regression equation, please refer to [link to relevant documentation]. Figure 9 The steps.
[0079] It is understandable that regardless of whether the label is offset, the relative positions between any two points among the reference points C, L, and R on the first image remain unchanged. Therefore, the distances |CL| between reference points C and L and |CR| between reference points C and R in the vertical direction of the image coordinate system can be obtained based on the positions of the reference points C, L, and R on the first image. Then, |CL| / |CR| can be substituted into the regression equation to calculate the distance |A″B″| between reference points A” and B” in the vertical direction of the image coordinate system on the reference image.
[0080] S107, Determine whether ||A″B″|-|A′B′|| / |A′B′| is greater than the preset second threshold.
[0081] If ||A″B″|-|A′B′|| / |A′B′| is greater than the second threshold, then proceed to step S108. Otherwise, proceed to step S109.
[0082] In this embodiment, ||A″B″|-|A′B′|| / |A′B′| represents the difference between the first width and the second width after normalization. The second width refers to the distance |A″B″| between reference points A” and B” in the vertical direction of the image coordinate system on the reference image.
[0083] S108, the test is confirmed to be invalid.
[0084] In this embodiment, since ||A′B′|-|AB|| / |AB| is greater than the first threshold, it is determined that the curved container has rotated. Furthermore, since ||A″B″|-|A′B′|| / |A′B′| is greater than the second threshold, it indicates that there is a difference in the distance between the reference points on both sides of the curved container's width direction in the first image and the reference image. At this point, it cannot be determined whether the difference in the two distances (i.e., ||A″B″|-|A′B′||) is caused by the rotation of the curved container or by the offset of the label; therefore, the detection is deemed invalid.
[0085] In step S108, when it is determined that the detection is invalid, the process returns to step S101, that is, the first image is reacquired and detection is performed.
[0086] S109, confirm that the label has not been offset.
[0087] In this embodiment, when ||A″B″|-|A′B′|| / |A′B′| is less than or equal to the second threshold, it indicates that the distance between the reference points on both sides of the curved container width direction on the first image and the reference image is similar, and it can be determined that the label has not shifted.
[0088] S110, determine whether ||CA′|-|CA|| / |CA| is greater than the preset third threshold.
[0089] If ||CA′|-|CA|| / |CA| is greater than the third threshold, then proceed to step S111. Otherwise, proceed to step S109.
[0090] In this embodiment, when it is determined that the curved container has not rotated, it is determined whether the label has shifted.
[0091] ||CA′|-|CA|| / |CA| represents the difference between the second position data and the preset standard position data after normalization. The second position data refers to the distance |CA′| between reference points C and A' in the vertical direction in the image coordinate system of the first image. The standard position data refers to the distance |CA| between reference points C and A in the vertical direction in the image coordinate system of the standard image.
[0092] When ||CA′|-|CA|| / |CA| is greater than the third threshold, it indicates that there is a difference in the distance between the reference point on the central axis of the label in the first image and the reference point on one side edge of the curved container in the width direction. At this time, it can be determined that the label has been offset.
[0093] When ||CA′|-|CA|| / |CA| is less than or equal to the third threshold, it indicates that the distance between the reference point on the central axis of the label in the first image and the reference point on one side edge of the curved container in the width direction is similar. At this time, it can be determined that the label has not been offset.
[0094] S111, confirm that the label has been offset.
[0095] In this embodiment, since ||A′B′|-|AB|| / |AB| is less than or equal to the first threshold, it is determined that the curved container has not rotated. Furthermore, ||CA′|-|CA|| / |CA| is greater than the third threshold, indicating a difference in distance between the reference point on the label's central axis in the first image and the reference point on one edge of the curved container's width direction. At this point, it can be determined that the difference between the two distances (i.e., ||CA′|-|CA||) is caused by the label's offset. Therefore, it can be determined that the label has been offset, and the offset amount is ||CA′|-|CA||.
[0096] The following is a brief description of the methods for obtaining regression equations.
[0097] See also Figure 9 , Figure 9 yes Figure 8 The flowchart for obtaining the regression equation before step S106.
[0098] like Figure 9 As shown, obtaining the regression equation may include the following steps:
[0099] S201, acquire multiple images of the curved container, both those that have not rotated and those that have rotated.
[0100] In this embodiment, the camera is first aimed at the central axis of the unrotated curved container, and an image of the unrotated container is captured using the camera. Then, the curved container is rotated multiple times, and an image of the rotated container is captured using the camera after each rotation, to simulate the image that might be captured when the curved container rotates in a real detection environment.
[0101] S202, Obtain reference points C, L, R, A”, B” from each image”.
[0102] S203, obtain from each image the distance |CL| between reference points C and L in the vertical direction, the distance |CR| between reference points C and R, and the distance |A″B″| between reference points A” and B” in the vertical direction.
[0103] It is understood that the specific implementation methods of steps S202 to S203 can be found in the following references. Figure 8 Steps S102 to S103 will not be described in detail here.
[0104] S204. Plot a scatter plot with |CL| / |CR| as the x-axis and |A″B″| as the y-axis for each image.
[0105] In this embodiment, each image has corresponding |CL| / |CR| and |A″B″|. Points are plotted with |CL| / |CR| as the horizontal axis and |A″B″| as the vertical axis to obtain a scatter plot.
[0106] It is understandable that the ratio of |CL| / |CR| changes when the curved container rotates, and |CL| / |CR| can be used to represent the degree of rotation of the curved container. In some embodiments, the closer the ratio of |CL| / |CR| is to 1, the smaller the degree of rotation of the curved container.
[0107] S205, perform linear fitting based on the scatter plot to obtain the regression equation.
[0108] For example, see [link to relevant documentation] Figure 10 , Figure 10 This is a schematic diagram of linear fitting in one example. For example... Figure 10 As shown, the vertical axis is in pixels, and the fitted curve is a polynomial equation, which is the regression equation for the fitted curve. The closer |CL| / |CR| is to 1, the larger |A″B″| becomes. The number of pixels can be converted into length units.
[0109] Please refer to them together. Figures 11 to 13 , Figure 11 and Figure 12 This is the top view of the curved container without rotation. Figure 13 It is a top view of a curved container that has been rotated. Figures 11 to 13 Reference points are not shown. The label detection method of this application is used for... Figures 11 to 13 Labels on curved containers are detected in these three scenarios.
[0110] like Figure 11 As shown, since ||A′B′|-|AB|| / |AB| is less than or equal to the first threshold, it is determined that the curved container has not rotated. Furthermore, since ||CA′|-|CA|| / |CA| is less than or equal to the third threshold, it is determined that the label has not shifted.
[0111] like Figure 12 As shown, since ||A′B′|-|AB|| / |AB| is less than or equal to the first threshold, it is determined that the curved container has not rotated. Furthermore, since ||CA′|-|CA|| / |CA| is greater than the third threshold, it is determined that the label has shifted.
[0112] like Figure 13 As shown, since ||A′B′|-|AB|| / |AB| is greater than the first threshold, it is determined that the curved container has rotated. Furthermore, since ||A″B″|-|A′B′|| / |A′B′| is less than or equal to the second threshold, it is determined that the label has not shifted.
[0113] It is understood that the label detection method adopted in this application embodiment can detect both whether the curved container has rotated and whether the label on the curved container has shifted. Moreover, it can avoid the influence of the rotation of the curved container on the label detection results, thereby improving the accuracy of the label detection results.
[0114] The label detection device provided in this application is briefly described below.
[0115] See also Figure 14 , Figure 14 This is a schematic diagram of the label detection device provided in this application.
[0116] The label detection device 100 includes a processor 102 and a memory 103. The processor 102 can run computer programs or code stored in the memory 103 to implement the label detection method of the embodiments of this application.
[0117] Processor 102 may include one or more processing units. For example, processor 102 may include, but is not limited to, an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, a neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0118] The memory 103 may include an external memory interface and internal memory. The external memory interface can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the tag detection device 100. The external memory card communicates with the processor 102 through the external memory interface to implement data storage functionality. The internal memory can be used to store computer-executable program code, including instructions. The internal memory may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (e.g., tag detection function), etc. The data storage area may store data created during the use of the tag detection device 100 (e.g., detection data), etc. Furthermore, the internal memory may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or Universal Flash Storage (UFS), etc. The processor 102 executes various functional applications and data processing of the tag detection device 100 by running instructions stored in the internal memory and / or instructions stored in memory disposed in the processor 102, such as implementing the tag detection method of the embodiments of this application.
[0119] In some embodiments, the tag detection device 100 may further include a camera device.
[0120] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the label detection device 100. In other embodiments of this application, the label detection device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements.
[0121] This application also provides a storage medium for storing computer programs or code, which, when executed by a processor, implement the label detection method of the embodiments of this application.
[0122] Storage media include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer.
[0123] The embodiments of this application have been described in detail above with reference to the accompanying drawings. However, this application is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of this application.
Claims
1. A label detection method for curved surface containers, characterized in that, The method includes: Obtain a first image, which contains the label of the surface container; Obtain multiple reference points from the first image; The first width of the curved container and the first position data of the label are obtained based on the plurality of reference points; the first width is the distance |A'B'| between reference points A' and B' in the vertical direction in the image coordinate system on the first image, wherein reference points A' and B' are located on the two sides of the width direction of the curved container; the first position data is the ratio |CL| / |CR| of the distance |CL| between reference points C and L and the distance |CR| between reference points C and R in the vertical direction in the image coordinate system on the first image, wherein reference point C is located on the central axis of the label, and reference points L and R are on the label and located on both sides of reference point C; Whether the curved container rotates is determined based on the first width and the preset standard width; the standard width is the distance |AB| between reference points A and B in the vertical direction in the image coordinate system on the standard image, and the reference points A and B are respectively located on the two sides of the curved container in the width direction on the standard image; When it is determined that the curved container has rotated, the second width of the curved container is predicted based on the first position data and the preset regression equation; the second width is the distance |A''B''| between reference points A'' and B'' in the vertical direction in the image coordinate system on the reference image, and the reference points A'' and B'' are respectively located on the two sides of the curved container in the width direction on the reference image; Determine whether the label has been offset based on the first width and the second width; The standard image is an image in which the curved container has not rotated and the label has not shifted, and the reference image is an image in which the curved container has rotated at the same angle as the first image and the label has not shifted.
2. The label detection method as described in claim 1, characterized in that, The step of determining whether the curved container rotates based on the first width and the preset standard width includes: When the difference between the first width and the preset standard width after normalization is greater than the preset first threshold, it is determined that the curved container has rotated. When the difference between the first width and the standard width after normalization is less than or equal to the first threshold, it is determined that the curved container has not rotated.
3. The label detection method as described in claim 1, characterized in that, The step of determining whether the label has shifted based on the first width and the second width includes: When the difference between the first width and the second width after normalization is greater than a preset second threshold, the detection is determined to be invalid. When the difference between the first width and the second width after normalization is less than or equal to the second threshold, it is determined that the label has not shifted.
4. The label detection method as described in claim 1, characterized in that, When it is determined that the curved container has not rotated, the method further includes: The second position data of the label is obtained based on the plurality of reference points; the second position data is the distance |CA'| between the reference points C and A' in the vertical direction in the image coordinate system on the first image; The label is determined to be offset based on the second position data and the preset standard position data; the standard position data is the distance |CA| between the reference points C and A in the vertical direction in the image coordinate system on the standard image.
5. The label detection method as described in claim 4, characterized in that, The step of determining whether the label has shifted based on the second location data and preset standard location data includes: When the difference between the second location data and the preset standard location data after normalization is greater than the preset third threshold, it is determined that the label has shifted. When the difference between the second location data and the standard location data after normalization is less than or equal to the third threshold, it is determined that the label has not shifted.
6. The label detection method as described in claim 1, characterized in that, The step of determining whether the curved container rotates based on the first width and the preset standard width includes: When |(|A'B'|-|AB|)| / |AB| is greater than a preset first threshold, it is determined that the curved container has rotated; When |(|A'B'|-|AB|)| / |AB| is less than or equal to the first threshold, it is determined that the curved container has not rotated.
7. The label detection method as described in claim 1, characterized in that, The step of determining whether the label has shifted based on the first width and the second width includes: When |(|A''B''|-|A'B'|)| / |A'B'| is greater than the preset second threshold, the detection is determined to be invalid; When |(|A''B''|-|A'B'|)| / |A'B'| is less than or equal to the second threshold, it is determined that the label has not shifted.
8. A label detection device, characterized in that, The label detection device includes a processor and a memory. The processor can run computer programs or code stored in the memory to implement the label detection method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and apparatus for printing on an object having a curved surface
CN107107623A
Target detection method and device, equipment and storage medium
CN111931877A