Method, device and storage medium for detecting barcode printing position on handbag

By using the analysis methods of base point A and base point B in barcode position detection, the detection failure problem caused by deformation of barcode attachments is solved, and accurate barcode position monitoring is achieved in the case of deformation, improving the reliability and accuracy of detection.

CN119378584BActive Publication Date: 2025-08-29CHUANGSAIJIE TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411381706.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-08-29
Estimated Expiration
2044-09-30

AI Technical Summary

Technical Problem

The existing barcode position detection technology causes barcode failure when the edges of barcode attachments appear slightly deformed, and the detection data is insufficient.

Method used

By obtaining the basis point A and basis point B in the position detection diagram, the image is analyzed by the handbag correction method, the barcode area is obtained, and whether the barcode area is offset based on the basis point A and basis point B is judged, and the standard feature value is obtained for verification based on the design data.

Benefits of technology

It improves the accuracy and rationality of barcode position detection, ensures that barcode position can still be accurately monitored when the barcode attachment is deformed, and enhances the reliability of detection data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119378584B_ABST
    Figure CN119378584B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device and storage medium for detecting the printing position of a barcode on a handbag, which relate to the technical field of printing position detection and include the following steps: obtaining a tiled image of a handbag; analyzing all tiled images using a handbag correction method, and obtaining base points A and B in a position detection diagram based on the design data of the handbag; obtaining barcode feature values ​​corresponding to a barcode area based on base points A and B, obtaining standard feature values ​​of the barcode area based on the design data, and determining whether the barcode area is offset based on the standard feature values ​​and the barcode feature values. The present invention is used to solve the problem that existing position detection technology cannot accurately monitor the barcode position when a barcode attachment is deformed, and the reliability of detection data is insufficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of printing position detection, in particular to a method, device and storage medium for detecting the printing position of a handbag barcode. Background Art

[0002] A barcode is a graphic identifier that represents a set of information by arranging multiple black bars and spaces of varying widths according to specific coding rules. A common barcode is a pattern of parallel lines of black and white bars with widely varying reflectivity. Barcodes can indicate a wide range of information, including an item's country of origin, manufacturer, product name, production date, book classification number, mail origin and destination, category, and date. Consequently, they are widely used in a wide range of fields, including commodity distribution, library management, postal administration, and banking systems.

[0003] Existing barcode position detection technology usually detects the position of the barcode relative to the object to which the barcode is attached. However, when the edge of the object to which the barcode is attached is slightly deformed, the barcode may also be deformed, resulting in the invalidation of the barcode. For example, the patent application with publication number CN104268499A discloses a barcode mark detection method for barcoded goods. The method comprises taking a photo of the barcoded goods to obtain an image of the barcoded goods; performing gradient transformation on the barcoded goods image to obtain a gradient image; locating the barcode position in the barcoded goods image; performing ostu dynamic threshold segmentation on the barcode area image to form a binary image; and performing corrosion operation on the obtained binary image to obtain the mark shape. When locating the barcode position in the barcode goods image, the method may cause the edge of the object to which the barcode is attached to be slightly deformed, resulting in the invalidation of the barcode. The existing position detection technology has the problem of insufficient data reliability for barcode position detection when the barcode attachment is deformed. Summary of the Invention

[0004] The present invention aims to solve, at least to a certain extent, one of the technical problems in the prior art. By obtaining base point A and base point B in a position detection map, using base point A and base point B to analyze the position detection map, and obtaining the barcode area in the position detection map based on the analysis results, the present invention is used to solve the problem that the existing position detection technology cannot accurately monitor the barcode position when the barcode attachment is deformed, and the reliability of the detection data is insufficient.

[0005] To achieve the above objectives, in a first aspect, the present application provides a method for detecting the printing position of a barcode on a handbag, comprising the following steps:

[0006] When performing barcode printing position detection, tile images of all handbags are obtained based on the detection data and recorded as tile image 1 to tile image p respectively;

[0007] All tiled images are analyzed using the handbag correction method, and based on the analysis results, a position detection map and a position error image corresponding to each tiled image are obtained;

[0008] Obtaining base point A and base point B in a position detection diagram based on the design data of the handbag, analyzing the position detection diagram using base point A and base point B, and obtaining a barcode area in the position detection diagram based on the analysis result;

[0009] The barcode feature value corresponding to the barcode area is obtained based on base point A and base point B, the standard feature value of the barcode area is obtained based on the design data, and whether the barcode area is offset is determined based on the standard feature value and the barcode feature value.

[0010] Furthermore, all tiled images are analyzed using the handbag correction method, and based on the analysis results, a position detection map and a position error image corresponding to each tiled image are obtained, which includes the following sub-steps:

[0011] Perform grayscale processing on any tiled image and convert the tiled image into a grayscale image;

[0012] Binarize the grayscale image to obtain a binary image;

[0013] Get the image with pixel value 0 from the binary image and set it as the outline of the handbag;

[0014] Establish a plane rectangular coordinate system and make the lower left corner of the handbag outline coincide with the origin of the plane rectangular coordinate system;

[0015] When the outline of the handbag coincides with both the horizontal and vertical axes of the plane rectangular coordinate system, the tiled image corresponding to the outline of the handbag is marked as a position detection image;

[0016] When the handbag outline does not coincide with the horizontal or vertical axis of the plane rectangular coordinate system, the handbag outline is rotated with the coordinate origin as the center until the handbag outline coincides with both the horizontal and vertical axes of the plane rectangular coordinate system, and the tiled image corresponding to the rotated handbag outline is marked as a position detection map;

[0017] If the handbag outline cannot be rotated so that the handbag outline coincides with both the horizontal and vertical axes of the plane rectangular coordinate system, the tiled image corresponding to the handbag outline is marked as a position error image.

[0018] Furthermore, the binarization process includes: setting a binarization threshold, obtaining pixel values ​​of all pixels in the grayscale image, and taking the average value of all pixel values ​​as the binarization threshold;

[0019] The pixels in the grayscale image whose grayscale values ​​are higher than or equal to the binarization threshold are assigned a value of 255, and the pixels in the grayscale image whose grayscale values ​​are lower than the binarization threshold are assigned a value of 0.

[0020] Furthermore, obtaining base point A and base point B in the position detection map based on the design data of the handbag, analyzing the position detection map using base point A and base point B, and obtaining the barcode area in the position detection map based on the analysis result includes the following sub-steps:

[0021] Acquire design data of the handbag, the design data including the position of design point A, the position of design point B, the printed barcode, and the barcode printing position in the handbag;

[0022] Establish a detection plane rectangular coordinate system with the lower left corner of the position detection diagram as the center;

[0023] Obtain the positions of design point A and design point B from the design data, mark the positions of design point A and design point B as base point A and base point B on the position detection diagram, and obtain the coordinates of base point A (xA, yA) and base point B (xB, yB);

[0024] Obtain the plane distance between design point A and design point B from the design data and set it as the standard distance;

[0025] Obtain the plane distance between base point A and base point B, set it as the base point distance, and when the base point distance is not equal to the standard distance, set the position detection image as the position error image;

[0026] When the base point distance is equal to the standard distance, the barcode pixels are acquired from the position detection image to obtain the barcode area.

[0027] Furthermore, the barcode pixel acquisition includes: performing grayscale processing and binarization on the position detection image;

[0028] For any pixel m with a pixel value of 0 in the binary image, the pixels in the eight neighborhoods of pixel m are recorded as neighboring pixel points 1 to 8, and the grayscale values ​​of neighboring pixel points 1 to 8 are obtained respectively. When the grayscale value of any neighboring pixel point is the same as the grayscale value of pixel point m, the neighboring pixel point and pixel point m are recorded as the undetermined barcode pixel points;

[0029] Perform grayscale processing and binarization on the barcode pattern in the design data, extract all pixels with a value of 0, and set them as the barcode template;

[0030] Use SSDA method to perform template matching on the barcode template among all the pixels of the pending barcode;

[0031] Set the successfully matched pending barcode pixel point as the barcode pixel point.

[0032] Furthermore, obtaining a barcode feature value corresponding to the barcode area based on base point A and base point B, obtaining a standard feature value of the barcode area based on the design data, and determining whether the barcode area is offset based on the standard feature value and the barcode feature value include the following sub-steps:

[0033] Mark the coordinates of the barcode area to obtain the coordinates of the four corner points of the barcode area, which are set as corner point 1 (x1, y1), corner point 2 (x2, y2), corner point 3 (x3, y3), and corner point 4 (x4, y4). Corner point 1 and corner point 2 are the upper left corner and upper right corner of the barcode area, respectively, and corner point 3 and corner point 4 are the lower left corner and lower right corner of the barcode area, respectively.

[0034] Connect base point A with corner points 1 and 2, obtain the angle between the lines, and set it as the angle value of base point A.

[0035] Connect base point B with corner points 3 and 4, obtain the angle between the lines, and set it as the angle value of base point B;

[0036] Substitute the corner point coordinates, base point coordinates, base point A angle value and base point B angle value into the barcode characteristic value formula The barcode feature value is calculated in , where K is the barcode feature value, RA is the angle value of base point A, and RB is the angle value of base point B;

[0037] Get the standard characteristic value. When the barcode characteristic value is equal to the standard characteristic value, it is determined that the barcode area has no offset.

[0038] When the barcode feature value is not equal to the standard feature value, the barcode area offset is determined.

[0039] Furthermore, obtaining the standard characteristic value includes the following sub-steps:

[0040] Establish a coordinate system for the handbag in the design data, obtain the coordinates of design point A and design point B, and obtain design point A (aA, bA) and design point B (aB, bB);

[0041] Mark the coordinates of the printed barcode to obtain the coordinates of the four corner points of the printed barcode, and set them as design point 1 (a1, b1), design point 2 (a2, b2), design point 3 (a3, b3) and design point 4 (a4, b4);

[0042] Connect design point A with design point 1 and design point 2, obtain the angle between the connecting lines, and set it as the angle value of design point A;

[0043] Connect design point B with design point 3 and design point 4, obtain the angle between the connecting lines, and set it as the angle value of design point B;

[0044] Substitute the design point coordinates, the angle value of design point A and the angle value of design point B into the standard eigenvalue formula The standard eigenvalue is calculated in , where K0 is the standard eigenvalue, RA' is the angle value of design point A, and RB' is the angle value of design point B.

[0045] In a second aspect, an electronic device includes a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method as described in any one of the above claims are executed.

[0046] In a third aspect, a storage medium stores a computer program thereon, wherein when the computer program is executed by a processor, the steps of the method according to any one of the above claims are executed.

[0047] Beneficial effects of the present invention: The present invention first collects handbag tiled images, uses the handbag correction method to analyze all the tiled images, and obtains a position detection map and a position error image corresponding to each tiled image based on the analysis results. The advantage is that using the handbag correction method to analyze the collected handbag tiled images can not only correct the normal tiled images, ensuring the correct direction of the position detection map and providing accurate processing data for subsequent processing; it can also eliminate damaged or folded handbag tiled images, thereby improving the acquisition speed of the position detection map.

[0048] The present invention also obtains base points A and B in the position detection map based on the design data of the handbag, uses base points A and B to analyze the position detection map, and obtains the barcode area in the position detection map based on the analysis results. The advantage is that the positions of base points A and B on the position detection map are relative. By determining the distance between base points A and B, it is possible to quickly determine whether the position detection map has been deformed, thereby improving the accuracy of subsequent acquisition of the barcode area.

[0049] The present invention obtains the barcode feature value corresponding to the barcode area based on base point A and base point B, obtains the standard feature value of the barcode area based on design data, and judges whether the barcode area is offset based on the standard feature value and the barcode feature value. The advantage is that the barcode feature value of a normal barcode based on base point A and base point B is fixed, and the standard barcode feature value and the barcode feature value are used to judge whether the barcode area is offset, thereby improving the rationality and accuracy of barcode position detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 is a flow chart of the steps of the present invention;

[0051] Figure 2 It is a schematic diagram of the design data of the present invention;

[0052] Figure 3 Schematic diagram of base points and corner points of the present invention;

[0053] Figure 4 Schematic diagram of design points and corner points of the present invention;

[0054] Figure 5 A schematic diagram of the structure of an electronic device. DETAILED DESCRIPTION

[0055] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0056] Example 1

[0057] See also Figure 1 As shown, the present application provides a method for detecting the barcode printing position of a handbag, comprising the following steps:

[0058] Step S1, when performing barcode printing position detection, obtain tile images of all handbags based on detection data and record them as tile image 1 to tile image p respectively;

[0059] Step S2: Analyze all tiled images using the handbag correction method, and obtain a position detection map and a position error image corresponding to each tiled image based on the analysis results;

[0060] Step S2 includes the following sub-steps:

[0061] Step S201, performing grayscale processing on any tiled image to convert the tiled image into a grayscale image;

[0062] Step S202, binarizing the grayscale image to obtain a binarized image;

[0063] Step S202 includes: Step S2021, setting a binarization threshold, obtaining pixel values ​​of all pixels in the grayscale image, and taking the average of all pixel values ​​as the binarization threshold; in a specific implementation, when acquiring the tiled image, there is a large color difference between the placement plane of the handbag and the handbag, so taking the average of the pixel values ​​as the binarization threshold can directly distinguish the handbag from the placement plane, facilitating subsequent contour extraction;

[0064] In step S2022, the pixel points in the grayscale image whose grayscale values ​​are higher than or equal to the binarization threshold are assigned a value of 255, and the pixel points in the grayscale image whose grayscale values ​​are lower than the binarization threshold are assigned a value of 0. In the specific implementation process, after the image is binarized, the entire image presents an obvious black and white effect, making the image very simple and easy to analyze and process.

[0065] Step S203, obtaining an image with a pixel value of 0 from the binary image and setting it as the outline of the handbag;

[0066] Step S204: Establish a plane rectangular coordinate system, and make the lower left corner of the handbag outline coincide with the origin of the plane rectangular coordinate system;

[0067] Step S205: When the handbag outline coincides with both the horizontal and vertical axes of the plane rectangular coordinate system, the tiled image corresponding to the handbag outline is marked as a position detection image. In the specific implementation, the handbag is a quadrilateral with two handles. Only the bottom edge and side edges of the handbag can simultaneously meet the condition of coinciding with both the horizontal and vertical axes of the plane rectangular coordinate system. Therefore, by establishing a plane rectangular coordinate system and rotating the handbag outline, the handbag outline can be adjusted to the desired angle.

[0068] Step S206: When the handbag outline does not coincide with the horizontal axis or the vertical axis of the plane rectangular coordinate system, the handbag outline is rotated with the coordinate origin as the center until the handbag outline coincides with both the horizontal axis and the vertical axis of the plane rectangular coordinate system, and the tiled image corresponding to the rotated handbag outline is marked as a position detection image;

[0069] In step S207, if the handbag outline cannot be rotated so that the handbag outline coincides with both the horizontal and vertical axes of the plane rectangular coordinate system, the tiled image corresponding to the handbag outline is marked as a position error image; in the specific implementation process, when the acquired tiled image is folded or missing, it will cause edge deformation, so the handbag outline cannot be rotated so that the handbag outline coincides with both the horizontal and vertical axes of the plane rectangular coordinate system.

[0070] Step S3, obtaining base point A and base point B in the position detection map based on the design data of the handbag, analyzing the position detection map using base point A and base point B, and obtaining a barcode area in the position detection map based on the analysis result;

[0071] Step S3 includes the following sub-steps:

[0072] Step S301, please refer to Figure 2As shown, the design data of the handbag is obtained, and the design data includes the position of the design point A, the position of the design point B, the printed barcode, and the barcode printing position in the handbag. In a specific implementation, the design point A is set at the midpoint of the line connecting the two handles of the handbag, and the design point B is set at the midpoint of the bottom of the handbag. The barcode printing position can be adjusted according to actual conditions. For example, in this embodiment, the barcode printing position is set at the lower right corner of the handbag.

[0073] Step S302, please refer to Figure 4 As shown, a detection plane rectangular coordinate system is established with the lower left corner of the position detection diagram as the center;

[0074] Step S303: Obtain the positions of design point A and design point B from the design data, mark the positions of design point A and design point B as base point A and base point B on the position detection diagram, and obtain the coordinates of base point A (xA, yA) and base point B (xB, yB). In a specific implementation, for example, the coordinates of base point A obtained in a plane rectangular coordinate system are (15, 20) and the coordinates of base point B are (15, 0).

[0075] Step S304: Obtain the plane distance between design point A and design point B from the design data and set it as the standard distance. In a specific implementation, for example, in a design data, the plane distance between design point A and design point B is 20, and the obtained standard distance is 20.

[0076] Step S305: obtaining the plane distance between base point A and base point B, setting it as the base point distance; when the base point distance is not equal to the standard distance, setting the position detection image as a position error image;

[0077] Step S306: When the base point distance is equal to the standard distance, the barcode pixels are acquired from the position detection image to obtain the barcode area;

[0078] Step S306 includes: step S3061, performing grayscale processing and binarization on the position detection image;

[0079] Step S3062: For any pixel point m in the binary image whose pixel value is 0, the pixels in the eight neighborhoods of pixel point m are recorded as neighboring pixel points 1 to 8, and the grayscale values ​​of neighboring pixel points 1 to 8 are obtained respectively. When the grayscale value of any neighboring pixel point is the same as the grayscale value of pixel point m, the neighboring pixel point and pixel point m are recorded as pending barcode pixel points. In a specific implementation, for example, the pixel value of pixel point m is obtained to be 23, and the pixel values ​​of neighboring pixel points 1 to 8 of the pixel point are 10, 12, 30, 23, 33, 13, 24 and 22 respectively, among which the grayscale value of neighboring pixel point 4 is the same as the grayscale value of pixel point m, and the neighboring pixel point 4 and pixel point m are recorded as pending barcode pixel points.

[0080] Step S3063: grayscale processing and binarization processing are performed on the barcode pattern in the design data, and all pixel points with a pixel value of 0 are extracted and set as the barcode template;

[0081] Step S3064, using the SSDA method to perform template matching on the barcode template among all the undetermined barcode pixels;

[0082] Step S3065: Set the successfully matched pending barcode pixel point as the barcode pixel point.

[0083] Step S4, obtaining a barcode feature value corresponding to the barcode area based on base point A and base point B, obtaining a standard feature value of the barcode area based on the design data, and determining whether the barcode area is offset based on the standard feature value and the barcode feature value;

[0084] Step S4 includes the following sub-steps:

[0085] Step S401, please refer to Figure 3 As shown, the coordinates of the barcode area are marked to obtain the coordinates of the four corner points of the barcode area, which are set as corner point 1 (x1, y1), corner point 2 (x2, y2), corner point 3 (x3, y3) and corner point 4 (x4, y4). Corner point 1 and corner point 2 are the upper left corner and upper right corner of the barcode area respectively, and corner point 3 and corner point 4 are the lower left corner and lower right corner of the barcode area respectively;

[0086] Step S402: connect base point A with corner point 1 and corner point 2, obtain the angle between the lines, and set it as the angle value of base point A;

[0087] Step S403: Connect base point B with corner point 3 and corner point 4, obtain the angle between the connecting lines, and set it as the angle value of base point B. In a specific implementation, for example, in a plane rectangular coordinate system, the coordinates of the four corner points of the barcode area are corner point 1 (22, 5), corner point 2 (27, 5), corner point 3 (22, 2), and corner point 4 (27, 2). The angle value of base point A is 14°, and the angle value of base point B is 6°.

[0088] Step S404: Substitute the corner point coordinates, base point coordinates, base point A angle value, and base point B angle value into the barcode characteristic value formula. The barcode feature value is calculated in, where K is the barcode feature value, RA is the angle value of base point A, and RB is the angle value of base point B. In a specific implementation, for example, in a plane rectangular coordinate system of a position detection diagram, the coordinates of the four corner points of the barcode area are corner point 1 (22, 6), corner point 2 (27, 6), corner point 3 (22, 3), and corner point 4 (27, 3). The angle value of base point A is 14°, and the angle value of base point B is 9°. Then, the barcode feature value K is 2.16.

[0089] Step S405: Obtaining standard feature values. Step S405 includes the following sub-steps:

[0090] Step S4051: Establish a coordinate system for the handbag in the design data, obtain the coordinates of design point A and design point B, and obtain design point A (aA, bA) and design point B (aB, bB);

[0091] Step S4052: Mark the coordinates of the printed barcode to obtain the coordinates of the four corner points of the printed barcode, and set them as design point 1 (a1, b1), design point 2 (a2, b2), design point 3 (a3, b3), and design point 4 (a4, b4);

[0092] Step S4053: connect design point A with design point 1 and design point 2, obtain the angle between the connecting lines, and set it as the angle value of design point A;

[0093] Step S4054: connect design point B with design point 3 and design point 4, obtain the angle between the connecting lines, and set it as the angle value of design point B;

[0094] Step S4055: Substitute the design point coordinates, the angle value of design point A, and the angle value of design point B into the standard eigenvalue formula The standard eigenvalue is calculated in , where K0 is the standard eigenvalue, RA' is the angle value of design point A, and RB' is the angle value of design point B. In the specific implementation process, for example, in a plane rectangular coordinate system of design point data, the coordinates of the four design points in the barcode area are design point 1 (22, 5), design point 2 (27, 5), design point 3 (22, 2) and design point 4 (27, 2), and the angle value of design point A is 14°, and the angle value of design point B is 6°; then the standard eigenvalue K0 is 3.33.

[0095] Step S406: When the barcode characteristic value is equal to the standard characteristic value, it is determined that the barcode area has not shifted. In a specific implementation, for example, during a barcode printing position detection, if the barcode characteristic value K is detected to be 3.33 and the standard characteristic value K0 is 3.33, it is determined that the barcode area of ​​the handbag has not shifted.

[0096] Step S407, when the barcode characteristic value is not equal to the standard characteristic value, the barcode area offset is determined; in the specific implementation process, for example, during a barcode printing position detection, when the barcode characteristic value K is detected to be 2.16 and the standard characteristic value K0 is 3.33, the barcode area offset of the handbag is determined.

[0097] Example 2

[0098] See also Figure 5 As shown, Figure 5A schematic diagram of the structure of an electronic device is provided, which may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, the steps of a method for detecting the barcode printing position on a handbag are executed to implement the following functions: when performing barcode printing position detection, tile images of all handbags are obtained based on detection data and recorded as tile images 1 to p, respectively; all tile images are analyzed using a handbag correction method, and a position detection map and a position error image corresponding to each tile image are obtained based on the analysis results; base points A and B in the position detection map are obtained based on the design data of the handbag, the position detection map is analyzed using base points A and B, and a barcode area in the position detection map is obtained based on the analysis results; barcode feature values ​​corresponding to the barcode area are obtained based on base points A and B, standard feature values ​​of the barcode area are obtained based on the design data, and whether the barcode area is offset is determined based on the standard feature values ​​and the barcode feature values.

[0099] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0100] Example 3

[0101] The present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method for detecting the barcode printing position of a handbag are executed. Through the above-mentioned technical solution, when the computer program is executed by the processor, the method in any optional implementation of the above-mentioned embodiment is executed to achieve the following functions: when performing barcode printing position detection, tile images of all handbags are obtained based on the detection data, and are recorded as tile images 1 to tile images p respectively; all tile images are analyzed using a handbag correction method, and a position detection map and a position error image corresponding to each tile image are obtained based on the analysis results; base points A and B in the position detection map are obtained based on the design data of the handbag, the position detection map is analyzed using base points A and B, and a barcode area in the position detection map is obtained based on the analysis results; the barcode feature value corresponding to the barcode area is obtained based on base points A and B, the standard feature value of the barcode area is obtained based on the design data, and whether the barcode area is offset is determined based on the standard feature value and the barcode feature value.

[0102] Through the description of the above embodiments, the embodiments of the present invention can be provided as methods, systems or computer program products. Based on this understanding, the above technical solutions, in essence or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiment.

[0103] In the embodiments provided in this application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.

[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for detecting the barcode printing position on a handbag, characterized in that: The steps include: When performing barcode printing position detection, tile images of all handbags are obtained based on the detection data and recorded as tile image 1 to tile image p respectively; All tiled images are analyzed using the handbag correction method, and based on the analysis results, a position detection map and a position error image corresponding to each tiled image are obtained, wherein the position detection map is a map with the correct direction, and the position error image is eliminated; Obtaining base points A and B in a position detection diagram based on the design data of the handbag, analyzing the position detection diagram using base points A and B, and determining whether the position detection diagram has been deformed by judging whether the distance between base points A and B is equal to a standard distance. If so, further determining a barcode area from the position detection diagram; Otherwise, set it to the position error image; Obtaining a barcode feature value corresponding to the barcode area based on base point A and base point B, obtaining a standard feature value of the barcode area based on the design data, and determining whether the barcode area is offset based on the standard feature value and the barcode feature value; specifically comprising the following sub-steps: Mark the coordinates of the barcode area to obtain the coordinates of the four corner points of the barcode area, which are set as corner point 1 (x1, y1), corner point 2 (x2, y2), corner point 3 (x3, y3), and corner point 4 (x4, y4). Corner point 1 and corner point 2 are the upper left corner and upper right corner of the barcode area, respectively, and corner point 3 and corner point 4 are the lower left corner and lower right corner of the barcode area, respectively. Connect base point A with corner points 1 and 2, obtain the angle between the lines, and set it as the angle value of base point A. Connect base point B with corner points 3 and 4, obtain the angle between the lines, and set it as the angle value of base point B; Substitute the corner point coordinates, base point coordinates, base point A angle value and base point B angle value into the barcode characteristic value formula The barcode feature value is calculated in , where K is the barcode feature value, RA is the angle value of base point A, and RB is the angle value of base point B; Get the standard characteristic value. When the barcode characteristic value is equal to the standard characteristic value, it is determined that the barcode area has no offset. When the barcode feature value is not equal to the standard feature value, the barcode area offset is determined.

2. A method for detecting the barcode printing position of a handbag according to claim 1, characterized in that: Analyzing all tiled images using the handbag correction method and obtaining the position detection map and position error image corresponding to each tiled image based on the analysis results includes the following sub-steps: Perform grayscale processing on any tiled image and convert the tiled image into a grayscale image; Binarize the grayscale image to obtain a binary image; Get the image with pixel value 0 from the binary image and set it as the outline of the handbag; Establish a plane rectangular coordinate system and make the lower left corner of the handbag outline coincide with the origin of the plane rectangular coordinate system; When the outline of the handbag coincides with both the horizontal and vertical axes of the plane rectangular coordinate system, the tiled image corresponding to the outline of the handbag is marked as a position detection image; When the handbag outline does not coincide with the horizontal or vertical axis of the plane rectangular coordinate system, the handbag outline is rotated with the coordinate origin as the center until the handbag outline coincides with both the horizontal and vertical axes of the plane rectangular coordinate system, and the tiled image corresponding to the rotated handbag outline is marked as a position detection map; If the handbag outline cannot be rotated so that the handbag outline coincides with both the horizontal and vertical axes of the plane rectangular coordinate system, the tiled image corresponding to the handbag outline is marked as a position error image.

3. A method for detecting the barcode printing position of a handbag according to claim 2, characterized in that: The binarization process includes: setting a binarization threshold, obtaining pixel values ​​of all pixels in the grayscale image, and taking the average value of all pixel values ​​as the binarization threshold; The pixels in the grayscale image whose grayscale values ​​are higher than or equal to the binarization threshold are assigned a value of 255, and the pixels in the grayscale image whose grayscale values ​​are lower than the binarization threshold are assigned a value of 0.

4. A method for detecting the barcode printing position of a handbag according to claim 3, characterized in that: Obtaining base point A and base point B in a position detection diagram based on the design data of the handbag, analyzing the position detection diagram using base point A and base point B, and obtaining a barcode area in the position detection diagram based on the analysis result includes the following sub-steps: Acquire design data of the handbag, the design data including the position of design point A, the position of design point B, the printed barcode, and the barcode printing position in the handbag; Establish a detection plane rectangular coordinate system with the lower left corner of the position detection diagram as the center; Obtain the positions of design point A and design point B from the design data, mark the positions of design point A and design point B as base point A and base point B on the position detection diagram, and obtain the coordinates of base point A (xA, yA) and base point B (xB, yB); Obtain the plane distance between design point A and design point B from the design data and set it as the standard distance; Obtain the plane distance between base point A and base point B, set it as the base point distance, and when the base point distance is not equal to the standard distance, set the position detection image as the position error image; When the base point distance is equal to the standard distance, the barcode pixels are acquired from the position detection image to obtain the barcode area.

5. A method for detecting the barcode printing position of a handbag according to claim 4, characterized in that: The barcode pixel acquisition includes: performing grayscale processing and binarization on the position detection image; For any pixel m with a pixel value of 0 in the binary image, the pixels in the eight neighborhoods of pixel m are recorded as neighboring pixel points 1 to 8, and the grayscale values ​​of neighboring pixel points 1 to 8 are obtained respectively. When the grayscale value of any neighboring pixel point is the same as the grayscale value of pixel point m, the neighboring pixel point and pixel point m are recorded as the undetermined barcode pixel points; Perform grayscale processing and binarization on the barcode pattern in the design data, extract all pixels with a value of 0, and set them as the barcode template; Use SSDA method to perform template matching on the barcode template among all the pixels of the pending barcode; Set the successfully matched pending barcode pixel point as the barcode pixel point.

6. A method for detecting the barcode printing position of a handbag according to claim 5, characterized in that: Obtaining standard eigenvalues ​​includes the following sub-steps: Establish a coordinate system for the handbag in the design data, obtain the coordinates of design point A and design point B, and obtain design point A (aA, bA) and design point B (aB, bB); Mark the coordinates of the printed barcode to obtain the coordinates of the four corner points of the printed barcode, and set them as design point 1 (a1, b1), design point 2 (a2, b2), design point 3 (a3, b3) and design point 4 (a4, b4); Connect design point A with design point 1 and design point 2, obtain the angle between the connecting lines, and set it as the angle value of design point A; Connect design point B with design point 3 and design point 4, obtain the angle between the connecting lines, and set it as the angle value of design point B; Substitute the design point coordinates, the angle value of design point A and the angle value of design point B into the standard eigenvalue formula The standard eigenvalue is calculated in , where K0 is the standard eigenvalue, Design point A angle value, is the angle value of design point B.

7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 6 are executed.

8. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are executed.

Citation Information

Patent Citations

  • Method for detecting barcode tags of commodities with barcodes

    CN104268499A

  • Trademark label detection method, trademark label detection model, trademark label detection device, equipment and storage medium

    CN111783653A

  • Automatic acquisition and identification method and device for cigarette 32-bit bar code

    CN112836541A

  • Paper bag flaw detection method and system based on machine vision

    CN118671072A