CN111639508A - Bar code positioning frame correction method, device, equipment and storage medium - Google Patents

Bar code positioning frame correction method, device, equipment and storage medium Download PDF

Info

Publication number
CN111639508A
CN111639508A CN202010474202.5A CN202010474202A CN111639508A CN 111639508 A CN111639508 A CN 111639508A CN 202010474202 A CN202010474202 A CN 202010474202A CN 111639508 A CN111639508 A CN 111639508A
Authority
CN
China
Prior art keywords
positioning frame
corrected
boundary
bar code
barcode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010474202.5A
Other languages
Chinese (zh)
Other versions
CN111639508B (en
Inventor
张沐然
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Weichuang Micro Intelligent Technology Co ltd
Original Assignee
Tianjin Weichuang Micro Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Weichuang Micro Intelligent Technology Co ltd filed Critical Tianjin Weichuang Micro Intelligent Technology Co ltd
Priority to CN202010474202.5A priority Critical patent/CN111639508B/en
Publication of CN111639508A publication Critical patent/CN111639508A/en
Application granted granted Critical
Publication of CN111639508B publication Critical patent/CN111639508B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1443Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Abstract

The invention discloses a method, a device, equipment and a storage medium for correcting a bar code positioning frame, wherein the method comprises the following steps: determining transverse correction parameters according to the projection length of the reference information bar of the bar code on the boundary of the bar code image; adjusting the position of the wide side of the positioning frame to be corrected based on the transverse correction parameter; and adjusting the position of the long edge of the positioning frame to be corrected according to the increasing and decreasing boundary threshold. The embodiment of the invention adjusts the positioning frame through the reference information bar and the increasing and decreasing boundary threshold value, realizes the correction of the position of the positioning frame, improves the identification rate of the bar code, and can improve the decoding rate of the bar code.

Description

Bar code positioning frame correction method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of automatic control, in particular to a method, a device, equipment and a storage medium for correcting a bar code positioning frame.
Background
With the development of the internet of things technology, bar codes are widely applied, when the bar codes are decoded, a positioning frame of the bar codes needs to be determined, and data are obtained by transversely marking the positioning frame for decoding. At present, the positioning frame of the bar code is determined by a gray boundary searching or binary image searching mode.
Because the determination of the barcode positioning frame depends on the gray boundary or the searched line segment of the binary image, when the parameter setting is inaccurate or the noise point of the barcode image is large, the determined positioning frame often cannot accurately position the barcode, so that the length of the line segment of the barcode is deviated from the actual length. For bar code images in non-ideal states of bar code wrinkles or bar code distortion, due to the fact that errors exist in the length of the line segment and the length of time of the bar code, and most information in the positioning frame cannot be read normally, the missing line segment of the bar code is included in the positioning frame, so that the bar code positioning frame has an important effect, and correction of the bar code positioning frame has a significant influence on the decoding rate.
Disclosure of Invention
The invention provides a method, a device, equipment and a storage medium for correcting a bar code positioning frame, which are used for accurately correcting the positioning frame, increasing the readable information quantity of a bar code and improving the accuracy rate of decoding the bar code.
In a first aspect, an embodiment of the present invention provides a method for correcting a barcode positioning frame, where the method includes:
determining transverse correction parameters according to the projection length of the reference information bar of the bar code on the boundary of the bar code image;
adjusting the position of the long edge of the positioning frame to be corrected based on the transverse correction parameter;
and adjusting the position of the wide edge of the positioning frame to be corrected according to the increasing and decreasing boundary threshold.
In a second aspect, an embodiment of the present invention provides a barcode positioning frame correction apparatus, including:
the parameter determining module is used for determining transverse correction parameters according to the projection length of the reference information bar of the bar code on the bar code image boundary;
the wide edge adjusting module is used for adjusting the position of the long edge of the positioning frame to be corrected based on the transverse correction parameter;
and the long edge adjusting module is used for adjusting the position of the wide edge of the positioning frame to be corrected according to the increasing and decreasing boundary threshold.
In a third aspect, an embodiment of the present invention provides an apparatus, where the apparatus includes:
one or more processors;
a memory for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the barcode locator box correction method according to any of the embodiments of the present invention.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the barcode positioning frame correction method according to any one of the embodiments of the present invention. According to the embodiment of the invention, the transverse correction parameter is determined according to the projection length of the bar code reference information bar on the bar code image boundary, the long edge position of the positioning frame to be corrected is adjusted according to the transverse correction parameter, and the wide edge position of the positioning frame to be corrected is adjusted through the increasing and decreasing boundary, so that the position correction of the positioning frame is realized, the accuracy of bar code identification is improved, and the decoding rate of the bar code is improved.
Drawings
Fig. 1 is a flowchart illustrating steps of a method for correcting a barcode positioning frame according to an embodiment of the present invention;
FIG. 2 is an exemplary diagram of a barcode image according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating steps of a method for correcting a barcode positioning frame according to a second embodiment of the present invention;
fig. 4 is an exemplary diagram of a positioning frame to be corrected according to a second embodiment of the present invention;
fig. 5 is an exemplary diagram of a barcode positioning frame correction method according to a second embodiment of the present invention;
fig. 6 is a schematic structural diagram of a barcode positioning frame correction apparatus according to a third embodiment of the present invention;
fig. 7 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only a part of the structures related to the present invention, not all of the structures, are shown in the drawings, and furthermore, embodiments of the present invention and features of the embodiments may be combined with each other without conflict.
Example one
Fig. 1 is a flowchart of steps of a method for correcting a barcode positioning frame according to an embodiment of the present invention, where the embodiment is applicable to a situation of correcting a barcode positioning frame, and the method may be executed by a barcode positioning frame correcting apparatus, and the apparatus may be implemented by using hardware and/or software, and referring to fig. 1, the method may generally include the following steps:
step 101, determining a transverse correction parameter according to the projection length of a reference information bar of the bar code on the bar code image boundary.
The bar code is a graphic identifier for expressing information, wherein the graphic identifier is formed by arranging a plurality of black bars and white bars with different widths according to a preset coding rule, the reference information bar is a black bar or a white bar in the bar code, and the number of the reference information bars can be one or more. The barcode image is image information bearing a barcode, and can be generated by shooting the barcode through a decoder or a camera and other devices, and the boundaries of the barcode image can include an upper boundary, a lower boundary, a left boundary, a right boundary and the like of the barcode image. Fig. 2 is an exemplary diagram of a barcode image according to an embodiment of the present invention, and referring to fig. 2, the barcode image includes a barcode 10, and a black bar or a white bar in the barcode 10 may be a reference information bar. The barcode image boundaries include an upper boundary 111, a right boundary 112, a lower boundary 113, and a left boundary 114. The projection length is a length of the reference information bar projected on each boundary of the barcode image, and may include a projection length of the boundary on the barcode image, a projection length of the right boundary of the barcode image, a projection length of the lower boundary of the barcode image, a projection length of the left boundary of the barcode image, and the like.
In the embodiment of the present invention, the transverse correction parameter is a parameter for correcting the barcode positioning frame, and the parameter is used for correcting the positioning frame in the transverse direction of the barcode, that is, correcting the length and/or position of the long edge of the positioning frame.
Specifically, length information of a reference information bar of the barcode and included angle information between the reference information bar and a barcode image boundary are obtained, and a projection length of the reference information bar on the barcode image boundary is determined according to the length information and the included angle information, where the projection length may be one or more of a projection length of the reference information bar on the left boundary of the barcode image, a projection length of the reference information bar on the upper boundary of the barcode image, a projection length of the reference information bar on the right boundary of the barcode image, and a projection length of the reference information bar on the lower boundary of the barcode image. After the projection length is obtained, the projection length may be used as a lateral correction parameter.
And 102, adjusting the position of the wide edge of the positioning frame to be corrected based on the transverse correction parameter.
The positioning frame to be corrected is a rectangular frame created for positioning the bar code in the bar code image, and is realized by searching gray scale transformation boundary line segments between black bars and white bars of the bar code in the bar code image or acquiring black and white line segments from a binary bar code image and combining the acquired line segments into a rectangle. Due to the influence of the state of the barcode when generating the image, when the barcode is folded or distorted, the position of the positioning frame to be corrected determined by the method is inaccurate, and some barcode information can be missed. The position of the wide side may be a position where the wide side of the positioning frame to be corrected is located.
In the embodiment of the invention, the broadside of the positioning frame to be corrected is adjusted based on the acquired transverse correction parameter, and the position of the broadside to be corrected is changed based on the length of the transverse correction parameter, for example, numerical values corresponding to the transverse correction parameter are respectively added to the broadside endpoint coordinates of the positioning frame to be corrected, and a line segment formed by connecting new endpoints is used as the position of the broadside of the positioning frame to be corrected after adjustment.
And 103, adjusting the position of the long edge of the positioning frame to be corrected according to the increasing and decreasing boundary threshold.
The incremental and decremental boundary threshold is a quantity value determined according to the black and white bar information of the barcode, the quantity value is the minimum quantity of information bars capable of being decoded by judging, the incremental and decremental boundary is a pixel value conversion boundary generated by arrangement of the black and white bars in the barcode, the incremental and decremental boundary can reflect the quantity information of the black and white bars in the barcode, and when the quantity of the incremental and decremental boundary of the image data of the barcode image is less than the incremental and decremental boundary threshold, the barcode black and white bar does not exist at the position corresponding to the image data and exceeds the barcode range.
Specifically, the position of the long edge is the position of the long edge of the positioning frame to be corrected, after the position of the wide edge of the positioning frame to be corrected is corrected, the position of the long edge is corrected based on an increasing and decreasing boundary threshold value, the long edge of the positioning frame to be corrected can be moved outwards, image data of a barcode image collected along the direction parallel to the long edge of the positioning frame to be corrected is obtained at the moved position, an increasing and decreasing boundary is determined according to the image data, if the number of the increasing and decreasing boundaries is greater than or equal to the increasing and decreasing boundary threshold value, the long edge is continuously moved outwards until the number of the increasing and decreasing boundaries determined according to the moved position of the long edge is smaller than the increasing and decreasing boundary, and the position is used as the position of the long edge of the positioning frame to be corrected. And the long edge position can also be directly moved outwards by a preset distance, and if the number of the increasing and decreasing boundaries obtained based on the position is greater than or equal to the increasing and decreasing boundary threshold value, the position is directly used as the long edge position of the corrected positioning frame to be corrected.
According to the embodiment of the invention, the transverse correction parameter is determined according to the projection length of the reference information bar of the bar code on the boundary of the bar code image, the position of the wide side of the positioning frame to be corrected is adjusted according to the transverse correction parameter, and the position of the long side of the positioning frame to be corrected is adjusted by increasing and decreasing the boundary threshold value, so that the correction of the bar code positioning frame is realized, the data quantity of bar code information in the positioning frame is improved, the accuracy of bar code identification is improved, and the bar code decoding efficiency can be enhanced.
Example two
Fig. 3 is a flowchart of a step of a barcode positioning frame correction method according to a second embodiment of the present invention, and referring to fig. 3, the embodiment of the present invention is embodied based on the above-described embodiment, further improves accuracy of a transverse correction parameter by an angle of a black information bar, and adjusts a position of a wide side of a positioning frame to be corrected by using a preset distance, and referring to fig. 3, the barcode positioning frame correction method according to the second embodiment of the present invention includes:
step 201, selecting the longest black information bar in the bar codes as a reference information bar.
In the embodiment of the invention, the bar code comprises a black information bar and a white information bar, the length of the black information bar in the bar code image can be different due to the influence of bar code states such as distortion or wrinkle, the smaller the length of the black information bar is, the smaller the influence of the bar code state is, and the longest black information bar in the bar code image is selected as the reference information bar.
And step 202, respectively determining the projection length and the projection width of the reference information bar on the long side and the wide side of the bar code image.
In the embodiment of the present invention, the angle between the reference information bar and the long side of the barcode image and the wide side of the barcode image is obtained, the projection length on the long side is determined by the angle between the long side of the barcode image and the reference information bar and the length of the reference information bar, and if the angle between the long side of the barcode image and the reference information bar is a and the length of the reference information bar is l, the projection length dx of the reference information bar on the long side of the barcode image is cos (a × PI/180) |, and correspondingly, the projection width of the reference information bar on the wide side of the barcode image can also be determined by the above method, further, when the long side of the barcode image is perpendicular to the wide side of the barcode image, the projection width dy of the reference information bar on the wide side of the barcode image is sin (a × PI/180) |.
And step 203, adjusting the coordinates of the long side endpoint on the positioning frame to be corrected according to the projection length and the projection width.
Referring to fig. 4, the positioning frame 20 to be corrected includes four end points R1, R2, R3 and R4, where R1 and R2 may be end points of the long side of the positioning frame to be corrected.
In an exemplary embodiment, coordinates (x1, y1) and (x2, y2) of an R1 and a R2 of a left end point on the upper side of the frame to be positioned are respectively obtained, and the coordinates of R1 and R2 are adjusted by a projection length dy and a projection width dx, so that the distance between R1 and R2 is increased or decreased, for example, the adjusted coordinate of R1 may be (x1-dx, y1-dy), and the adjusted coordinate of R2 may be (x2+ dx, y 2-dy). Further, in another exemplary embodiment, the coordinates of the end point of the lower long side of the positioning frame to be corrected may be adjusted according to the projection length and the projection width, that is, the coordinates of R3 and R4 may be adjusted according to the projection length and the projection width, so as to increase the distance between R3 and R4.
And 204, respectively determining a first distance between the upper long edge end points before adjustment and a second distance between the upper long edge end points after adjustment, and taking the difference between the second distance and the first distance as a transverse correction parameter.
The first distance is the distance between the upper long sides before adjustment, that is, the side length M1 of the long side of the positioning frame to be corrected before adjustment, and the second distance is the distance after the coordinates of the upper long side end points are adjusted, and can be determined by the coordinates of the two end points after modification, for example, the coordinates of the end point of R1 after modification are (x1-dx, y1-dy), the coordinates of the end point of R2 after modification are (x2+ dx, y2-dy), and correspondingly, the second distance between the upper long sides after adjustment
Figure BDA0002515299090000071
Specifically, the side length M1 of the long side of the positioning frame to be corrected before adjustment is obtained as a first distance, the second distance M2 is determined according to the coordinates of the end point of the upper long side after adjustment, the length of the long side of the positioning frame to be corrected, which needs to be increased transversely, can be determined by the second distance M2 and the first distance M1, the difference between the first distance M1 and the second distance M2 is calculated, and the difference is used as a transverse correction parameter.
And step 205, respectively displacing the left wide-side end point and the right wide-side end point of the positioning frame to be corrected leftwards and rightwards according to the transverse correction parameters.
In the embodiment of the present invention, the end points of the left wide side are the end points at the two ends of the left wide side in the positioning frame to be corrected, and the end points of the right wide side are the end points at the two ends of the right wide side in the positioning frame to be corrected, referring to fig. 4, the end points of the left wide side are R1 and R3, and the end points of the right wide side are R2 and R4. Specifically, the long side of the positioning frame to be corrected is adjusted according to the lateral correction parameter, the length of the long side and the lateral correction parameter may be added to obtain the length, when the left-side end points R1 and R3 move leftward, half of the lateral correction parameter is subtracted from the corresponding abscissa, and when the right-side end points R2 and R4 move rightward, half of the lateral correction parameter is added to the corresponding abscissa. Further, the transverse correction parameter may be directly set to be half of the difference between the first distance and the second distance, and the coordinate of the end point of the positioning frame to be corrected is directly and correspondingly increased or decreased to realize the displacement of the end point.
And step 206, respectively determining the coordinates of the middle points of the left wide edge end point and the right wide edge end point of the positioning frame to be corrected after the positioning movement.
The middle point coordinates comprise position coordinates of middle points of two end points of the left broadside after displacement and position coordinates of center points of the two end points of the right broadside after displacement.
Specifically, the position of the long edge of the positioning frame to be corrected is adjusted by means of the reference information strip, and because the reference information strip still has the influence of factors such as bar code wrinkles and distortion, in order to improve the accuracy of the adjustment of the position of the long edge, the coordinates of the end points of the four end points of the positioning frame to be corrected after displacement are obtained, the coordinates of the two end points corresponding to the left broadside are taken to determine the coordinate of the middle point of the central point, and the coordinates of the two end points corresponding to the right broadside are taken to determine the coordinate of the middle point.
And step 207, averaging angles between the black information bars in the bar code image and the edges of the bar code image.
In an exemplary embodiment, each black information bar in the barcode image is fitted, a straight line corresponding to the fitted black information bar is intersected with a straight line where a barcode image edge is located, an included angle between each black information bar and the barcode image edge is obtained, the included angle may include an included angle between the black information bar and a barcode image long edge and an included angle between the black information bar and a barcode image wide edge, when the barcode image long edge and the barcode image wide edge are perpendicular, only the included angle between the black information bar and the barcode image wide edge is obtained, and after the included angle between each black information bar and the barcode image long edge is obtained, an average angle of the included angles of each black information bar is counted.
And 208, determining the position of the wide edge of the positioning frame to be corrected after adjustment according to the coordinate of the middle point and the average angle of the included angle.
In the embodiment of the present invention, the middle point coordinate and the average angle are substituted into a straight-line formula y ═ k × x + b, where k may be a slope determined by the average angle, intercept b may be obtained by substituting the middle point coordinate into the straight-line formula, the middle point coordinate corresponding to the left broadside may obtain an intercept corresponding to the left broadside, the middle point coordinate corresponding to the right broadside may obtain an intercept corresponding to the right broadside, and the slope k and intercept b corresponding to the broadside may be substituted into the straight-line formula to obtain the straight-line formula corresponding to the broadside, and a position corresponding to the straight-line formula in the barcode image may be used as a broadside position of the to-be-corrected positioning frame.
And 209, determining an increasing and decreasing boundary according to the acquisition position at a preset distance from the long edge of the positioning frame to be corrected.
The preset distance is a distance value for expanding the position of the long edge, the acquisition position is a position for acquiring image data in the barcode image, and the acquisition position can be parallel to the long edge of the positioning frame to be corrected. The ascending and descending boundary is a pixel value jumping boundary formed by alternately sequencing black information bars and white information bars in the bar code, and the quantity of the black information bars and the white information bars can be reflected by the ascending and descending boundary.
Specifically, the collection position is determined at a preset distance outside the long edge of the positioning frame to be corrected, the shortest distance from the pixel point at the collection position to the long edge of the positioning frame to be corrected can be the preset distance, image data at the collection position in the barcode image is obtained, and the image data is analyzed to obtain the increasing and decreasing boundary.
And step 210, if the number of the ascending and descending boundaries is greater than the ascending and descending boundary threshold, determining the acquisition position as the long edge position of the positioning frame to be corrected after adjustment.
The incremental and decremental boundary threshold is a quantity value determined according to the black bar and white bar information of the barcode, the quantity value is the minimum quantity of information bars capable of being decoded by judging, the incremental and decremental boundary is a pixel value conversion boundary generated by arrangement of the black bars and the white bars in the barcode, the incremental and decremental boundary can reflect the quantity information of the black bars and the white bars in the barcode, and when the quantity of the incremental and decremental boundary of the image data of the barcode image is smaller than the incremental and decremental boundary threshold, the information bars at the position corresponding to the image data can be considered to be insufficient to support the barcode to be decoded.
Specifically, if the number of the ascending and descending boundaries at the acquisition position is greater than the ascending and descending boundary threshold, it is indicated that the number of the black information bars and the white information bars at the acquisition position meets the barcode decoding requirement, the acquisition position can be used as the position of the long edge of the positioning frame to be corrected after adjustment, and the long edge of the positioning frame can be translated to the acquisition position.
In step 211, if the number of the ascending and descending boundaries is less than or equal to the ascending and descending boundary threshold, the position of the long edge of the positioning frame to be corrected is not adjusted.
Specifically, if the number of the ascending and descending boundaries at the acquisition position is greater than the ascending and descending boundary threshold, it is indicated that the number of the black information bars and the white information bars at the acquisition position does not meet the barcode decoding requirement, the acquisition position cannot be used as the long edge position of the positioning frame to be corrected after adjustment, and the long edge position of the positioning frame to be corrected is not adjusted.
In the embodiment of the invention, the longest black information strip is selected as a reference information strip, the projection length and the projection width of the reference information strip on the long side and the wide side of a bar code image are respectively determined, the end point of a to-be-corrected positioning frame is adjusted based on the projection length and the projection width, the first distance of the long side before adjustment and the second distance of the long side after adjustment are obtained, the difference value between the second distance and the first distance is used as a transverse correction parameter, the end point of the to-be-corrected fixed bit width is adjusted based on the transverse correction parameter, the middle point coordinate of the wide side after adjustment is obtained, the included angle average angle between the black information strip and the reference information strip is obtained, the position of the wide side is determined according to the middle point coordinate and the included angle average angle, when the number of increasing and decreasing boundaries at the acquisition position with the preset distance from the long side exceeds the increasing and decreasing boundary threshold value, the acquisition position is used as, the quick correction of the bar code positioning frame is realized, the data volume of bar code information in the positioning frame is improved, the accuracy of bar code identification is improved, and the bar code decoding efficiency can be enhanced.
Further, on the basis of the above embodiment of the present invention, determining an increasing and decreasing boundary according to the acquisition position at a preset distance from the long edge of the to-be-corrected positioning frame includes:
taking the position of the preset distance outside the long edge of the positioning frame to be corrected as an acquisition position; collecting the image information of the barcode image from the collection position along the direction parallel to the long edge of the positioning frame to be corrected; and respectively searching an increasing boundary and a decreasing boundary in the image information according to the gray boundary and/or the binary image to be used as the increasing and decreasing boundaries.
In the embodiment of the invention, an acquisition position is selected outside the long edge of the positioning frame to be corrected, the distance between a pixel point at the acquisition position and the long edge of the positioning frame to be corrected is a preset distance, the acquisition position is parallel to the long edge, image information in a barcode image is acquired at the acquisition position according to the sequence from one side to the other side, wherein the image information can correspond to the pixel value of a pixel point, after the image information is acquired, the number of ascending boundaries and the number of descending boundaries in the image information can be extracted, and the ascending boundaries or the descending boundaries can be extracted in a gray boundary and/or binary image searching mode. It will be appreciated that incrementing and decrementing the boundary threshold may include incrementing the boundary threshold and decrementing the boundary threshold, the incrementing boundary and the decrementing boundary being extracted from the image information, respectively.
For example, fig. 5 is an exemplary diagram of a barcode positioning frame correction method provided in the second embodiment of the present invention, and referring to fig. 5, after a positioning frame is obtained by a barcode positioning method in the existing method, verification and reliability determination are performed on the obtained positioning frame, so as to determine whether the number of information bars in the frame meets the barcode requirement. And after the requirement of the bar code is met, correcting the positioning frame. Obtaining coordinates of four end points of R1, R2, R3 and R4 of the positioning frame 20, respectively obtaining the side lengths of the R1R2 side and the R3R4 side of the positioning frame 20, and then obtaining the side lengths of the R1R3 side and the R2R4 side of the positioning frame 20. Firstly, the positioning frame 20 is transversely expanded, the longest black information bar found in the positioning frame 20 is searched, and projection is determined as a transverse correction parameter according to the angle between the black information bar and the boundary 21 and the length of the black information bar and a sine formula and a cosine formula. The length of the side where the corrected positioning frame 200 is long can be obtained by adding the length of the side of the positioning frame 20 and the transverse correction parameters, the center points of the sides of R1R3 and R2R4 of the expanded positioning frame 200 are calculated, the calculation formula y of the straight line is substituted into k x + b according to the average angle between the black information bar and the boundary 21 in the positioning frame 20 and the coordinates of the two center points, the fitted straight line R1R3 and the fitted straight line R2R4 of the short side of the positioning frame 200 are corrected on the basis of the long side of the positioning frame 20, and new four end point coordinate positions are obtained according to the intersection points of the new straight lines R1R3 and R2R4 of the positioning frame 200 and the straight lines R1R2 and R2R4 of the previous positioning frame 20. The positioning frame 20 is further expanded in the vertical direction, and the lengths of R1R3 and R2R4 of the positioning frame 200 are expanded based on the positioning frame 20 after the horizontal expansion. The distance dis1 from R1 to R3 and the distance dis2 from R2 to R4 are found, and then the step size N is set. Accurately calculating a point T1 with the length dis1+ N from R1 to the R3 direction and a point T2 with the length dis2+ N from R2 to the R4 direction, extracting image data on a T1T2 line segment, searching the number of increasing boundaries and decreasing boundaries of the partial image data, wherein the number of the found points is N1 and N2, and when the number of N1 and N2 is larger than a boundary threshold value at the same time, expanding the positioning frame 20 by taking 0.3 times of the length of the short edge to the R1R3 and R2R4 directions to obtain a new rectangular edge position; accurately calculating a point T3 with the length dis1+ N from R3 to the R1 direction, accurately calculating a point T4 with the length dis2+ N from R4 to the R2 direction, extracting image data on a T3T4 line segment, searching the number of increasing boundaries and decreasing boundaries of the partial image data, wherein the number of the found points is N3 and N4, and when the number of N3 and N4 is larger than the threshold value of the boundaries at the same time, expanding the points from the R3R1 and R4R2 to 0.3 time of the length of the short side of the rectangle, and acquiring the end point position of a new positioning frame 200.
EXAMPLE III
Fig. 6 is a schematic structural diagram of a barcode positioning frame correction apparatus provided in the third embodiment of the present invention, which is capable of executing a barcode positioning frame correction method provided in any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method. The device can be implemented by software and/or hardware, and specifically comprises: a parameter determination module 301, a broadside adjustment module 302, and a long-side adjustment module 303.
The parameter determining module 301 is configured to determine a transverse correction parameter according to a projection length of a reference information bar of the barcode on a barcode image boundary.
And a broadside adjusting module 302, configured to adjust a broadside position of the positioning frame to be corrected based on the lateral correction parameter.
And a long edge adjusting module 303, configured to adjust a long edge position of the positioning frame to be corrected according to the increasing and decreasing boundary threshold.
According to the embodiment of the invention, the parameter determination module determines the transverse correction parameter according to the projection length of the reference information bar of the bar code on the boundary of the bar code image, the broadside adjustment module adjusts the broadside position of the positioning frame to be corrected according to the transverse correction parameter, and the long side adjustment module adjusts the long side position of the positioning frame to be corrected through increasing and decreasing the boundary threshold value, so that the correction of the bar code positioning frame is realized, the data quantity of bar code information in the positioning frame is improved, the accuracy of bar code identification is improved, and the bar code decoding efficiency can be enhanced.
Further, on the basis of the above embodiment of the invention, the method further includes:
and the reference determining module is used for selecting the longest black information bar in the bar codes as the reference information bar.
Further, on the basis of the above embodiment of the present invention, the parameter determining module 301 includes:
and the projection determining unit is used for respectively determining the projection length and the projection width of the reference information bar on the long side and the wide side of the bar code image.
And the coordinate adjusting unit is used for adjusting the coordinates of the long side endpoint on the positioning frame to be corrected according to the projection length and the projection width.
And the parameter determining unit is used for respectively determining a first distance between the end points of the upper long edge before adjustment and a second distance between the end points of the upper long edge after adjustment, and taking the difference between the second distance and the first distance as a transverse correction parameter.
Further, on the basis of the above embodiment of the present invention, the broadside adjusting module 302 includes:
and the length adjusting unit is used for respectively displacing the left wide-side end point and the right wide-side end point of the positioning frame to be corrected to the left and the right according to the transverse correction parameters.
And the center determining unit is used for respectively determining the middle point coordinates of the left wide edge end point and the right wide edge end point of the positioning frame to be corrected after displacement.
And the angle determining unit is used for averaging angles between the black information bars in the bar code image and the edges of the bar code image.
And the broadside position unit is used for determining the position of the broadside after the adjustment of the positioning frame to be corrected according to the middle point coordinate and the average included angle.
Further, on the basis of the above embodiment of the present invention, the long-side adjusting module 303 includes:
and the boundary determining unit is used for determining an increasing and decreasing boundary according to the acquisition position which is a preset distance away from the long edge of the positioning frame to be corrected.
And the long edge position unit is used for determining the acquisition position as the long edge position of the positioning frame to be corrected after adjustment if the number of the ascending and descending boundaries is greater than the ascending and descending boundary threshold value.
Further, on the basis of the above-described embodiment of the present invention, the boundary determining unit includes:
and the position subunit is used for taking the position of the preset distance outside the long edge of the positioning frame to be corrected as an acquisition position.
And the information acquisition subunit is used for acquiring the image information of the barcode image from the acquisition position along a direction parallel to the long edge of the positioning frame to be corrected.
And the boundary determining subunit is used for respectively searching the increasing boundary and the decreasing boundary in the image information according to the gray boundary and/or the binary image as the increasing and decreasing boundaries.
Further, on the basis of the above embodiment of the invention, the method further includes:
and the second broadside module is used for not adjusting the position of the broadside of the positioning frame to be corrected if the number of the ascending and descending boundaries is less than or equal to the ascending and descending boundary threshold.
Example four
Fig. 7 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention, as shown in fig. 7, the apparatus includes a processor 70, a memory 71, an input device 72, and an output device 73; the number of processors 70 in the device may be one or more, and one processor 70 is taken as an example in fig. 7; the processor 70, the memory 71, the input device 72 and the output device 73 of the apparatus may be connected by a bus or other means, as exemplified by the bus connection in fig. 7.
The memory 71 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the barcode positioning frame correction method in the embodiment of the present invention (for example, the parameter determination module 301, the wide-side adjustment module 302, and the long-side adjustment module 303 in the barcode positioning frame correction apparatus). The processor 70 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 71, so as to implement the barcode positioning frame correction method.
The memory 71 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 71 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 71 may further include memory located remotely from the processor 70, which may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 72 may be used to receive entered numeric or character information and to generate key signal inputs relating to user settings and function controls of the apparatus. The output device 73 may include a display device such as a display screen.
EXAMPLE five
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, where the computer-executable instructions are executed by a computer processor to perform a barcode positioning box correction method, and the method includes:
determining transverse correction parameters according to the projection length of the reference information bar of the bar code on the boundary of the bar code image;
adjusting the position of the wide side of the positioning frame to be corrected based on the transverse correction parameter;
and adjusting the position of the long edge of the positioning frame to be corrected according to the increasing and decreasing boundary threshold.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the operations of the method described above, and may also perform related operations in the barcode positioning box correction method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the barcode positioning frame correction device, each included unit and module are only divided according to functional logic, but are not limited to the above division, as long as the corresponding function can be realized; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method for correcting a bar code positioning frame is characterized by comprising the following steps:
determining transverse correction parameters according to the projection length of the reference information bar of the bar code on the boundary of the bar code image;
adjusting the position of the wide side of the positioning frame to be corrected based on the transverse correction parameter;
and adjusting the position of the long edge of the positioning frame to be corrected according to the increasing and decreasing boundary threshold.
2. The method of claim 1, further comprising:
and selecting the longest black information bar in the bar codes as a reference information bar.
3. The method of claim 2, wherein determining the transverse correction parameter according to the projection length of the barcode reference information bar at the barcode image boundary comprises:
respectively determining the projection length and the projection width of the reference information bar on the long side and the wide side of the bar code image;
adjusting the coordinates of the long side end points on the positioning frame to be corrected according to the projection length and the projection width;
and respectively determining a first distance between the end points of the upper long edge before adjustment and a second distance between the end points of the upper long edge after adjustment, and taking the difference between the second distance and the first distance as a transverse correction parameter.
4. The method according to claim 3, wherein the adjusting the position of the broadside of the positioning frame to be corrected based on the lateral correction parameter comprises:
respectively displacing the left wide-edge end point and the right wide-edge end point of the positioning frame to be corrected leftwards and rightwards according to the transverse correction parameters;
respectively determining the coordinates of the middle points of the left wide edge end point and the right wide edge end point of the positioning frame to be corrected after displacement;
averaging angles between the black information bars in the bar code image and the edges of the bar code image;
and determining the position of the adjusted wide edge of the positioning frame to be corrected according to the coordinate of the middle point and the average angle of the included angle.
5. The method according to claim 2, wherein the adjusting the long edge position of the positioning frame to be corrected according to the increasing and decreasing boundary threshold comprises:
determining an increasing and decreasing boundary according to the acquisition position which is a preset distance away from the long edge of the positioning frame to be corrected;
and if the number of the ascending and descending boundaries is greater than the ascending and descending boundary threshold value, determining the acquisition position as the long edge position of the positioning frame to be corrected after adjustment.
6. The method according to claim 5, wherein the determining an increasing and decreasing boundary according to the collection position at a preset distance from the long side of the frame to be corrected comprises:
taking the position of the preset distance outside the long edge of the positioning frame to be corrected as an acquisition position;
collecting the image information of the barcode image from the collection position along the direction parallel to the long edge of the positioning frame to be corrected;
and respectively searching an increasing boundary and a decreasing boundary in the image information according to the gray boundary and/or the binary image to be used as the increasing and decreasing boundaries.
7. The method of claim 5, further comprising:
and if the number of the ascending and descending boundaries is less than or equal to the ascending and descending boundary threshold value, not adjusting the position of the wide edge of the positioning frame to be corrected.
8. A barcode positioning frame correction device, characterized in that the device comprises:
the parameter determining module is used for determining transverse correction parameters according to the projection length of the reference information bar of the bar code on the bar code image boundary;
the broadside adjusting module is used for adjusting the broadside position of the positioning frame to be corrected based on the transverse correction parameter;
and the long edge adjusting module is used for adjusting the long edge position of the positioning frame to be corrected according to the increasing and decreasing boundary threshold value.
9. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a memory for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the barcode locator box correction method of any of claims 1-7.
10. A computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing a barcode locator correction method according to any one of claims 1 to 7.
CN202010474202.5A 2020-05-29 2020-05-29 Bar code positioning frame correction method, device, equipment and storage medium Active CN111639508B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010474202.5A CN111639508B (en) 2020-05-29 2020-05-29 Bar code positioning frame correction method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010474202.5A CN111639508B (en) 2020-05-29 2020-05-29 Bar code positioning frame correction method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111639508A true CN111639508A (en) 2020-09-08
CN111639508B CN111639508B (en) 2023-04-25

Family

ID=72332272

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010474202.5A Active CN111639508B (en) 2020-05-29 2020-05-29 Bar code positioning frame correction method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111639508B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112444203A (en) * 2020-11-18 2021-03-05 上海原观科技有限公司 Vehicle position detection device and method based on barcode strip and vehicle positioning system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110290877A1 (en) * 2010-06-01 2011-12-01 Fujian Newland Computer Co., Ltd. Barcode decoding chip
CN106599758A (en) * 2016-11-29 2017-04-26 努比亚技术有限公司 Image quality processing method and terminal
CN107644183A (en) * 2017-09-01 2018-01-30 福建联迪商用设备有限公司 One-dimension code CMOS images the coding/decoding method and terminal of engine

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110290877A1 (en) * 2010-06-01 2011-12-01 Fujian Newland Computer Co., Ltd. Barcode decoding chip
CN106599758A (en) * 2016-11-29 2017-04-26 努比亚技术有限公司 Image quality processing method and terminal
CN107644183A (en) * 2017-09-01 2018-01-30 福建联迪商用设备有限公司 One-dimension code CMOS images the coding/decoding method and terminal of engine

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112444203A (en) * 2020-11-18 2021-03-05 上海原观科技有限公司 Vehicle position detection device and method based on barcode strip and vehicle positioning system

Also Published As

Publication number Publication date
CN111639508B (en) 2023-04-25

Similar Documents

Publication Publication Date Title
JP4738469B2 (en) Image processing apparatus, image processing program, and image processing method
US9070034B2 (en) Method and system for correcting QR code image
CN109598744B (en) Video tracking method, device, equipment and storage medium
WO2021143212A1 (en) Quick response code, quick response code encoding method and apparatus, quick response code decoding method and apparatus, and electronic system
CN112528776B (en) Text line correction method and device
CN110796201A (en) Method for correcting label frame, electronic equipment and storage medium
CN111639508A (en) Bar code positioning frame correction method, device, equipment and storage medium
JP2012067462A (en) Reinforcement photograph-taking tool and method of acquiring reinforcement arrangement information
CN111738917A (en) Picture scaling method, device, equipment and storage medium
US20190005347A1 (en) Information processing apparatus, program, and information processing method
CN112183250A (en) Character recognition method and device, storage medium and electronic equipment
CN111046693A (en) Two-dimensional code scanning method and device, terminal equipment and storage medium
CN112729166B (en) Structured light encoding method, encoding and decoding method, device, computer device and medium
CN111368496B (en) Method and device for changing straight line into broken line with any angle in PCB design
CN112507938A (en) Geometric feature calculation method, geometric feature recognition method and geometric feature recognition device for text primitives
CN111832558A (en) Character image correction method, device, storage medium and electronic equipment
JP4970385B2 (en) Two-dimensional code reader and program thereof
CN113505745B (en) Character recognition method and device, electronic equipment and storage medium
CN111143912A (en) Display labeling method and related product
CN112288759B (en) Boundary extraction method, device, equipment and storage medium
CN114332880A (en) Text detection method, device, equipment and storage medium
CN116095290B (en) Projection automatic framing method and device and electronic equipment
CN113628284A (en) Pose calibration data set generation method, device and system, electronic equipment and medium
CN111709419A (en) Method, system and equipment for positioning banknote serial number and readable storage medium
CN112911169A (en) Video image segmentation method and device and video image control method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant