CN116167394A - Bar code recognition method and system - Google Patents

Bar code recognition method and system Download PDF

Info

Publication number
CN116167394A
CN116167394A CN202310184947.1A CN202310184947A CN116167394A CN 116167394 A CN116167394 A CN 116167394A CN 202310184947 A CN202310184947 A CN 202310184947A CN 116167394 A CN116167394 A CN 116167394A
Authority
CN
China
Prior art keywords
image
bar code
unit
value
sends
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.)
Pending
Application number
CN202310184947.1A
Other languages
Chinese (zh)
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.)
Niu Niu Tu Technology Co ltd
Original Assignee
Niu Niu Tu 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 Niu Niu Tu Technology Co ltd filed Critical Niu Niu Tu Technology Co ltd
Priority to CN202310184947.1A priority Critical patent/CN116167394A/en
Publication of CN116167394A publication Critical patent/CN116167394A/en
Pending legal-status Critical Current

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
    • Y02BCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
    • Y02B20/00Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
    • Y02B20/40Control techniques providing energy savings, e.g. smart controller or presence detection

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to the technical field of image recognition and discloses a bar code recognition method and a bar code recognition system, wherein the bar code recognition method comprises a positioning unit, a control unit, a collecting unit, an analyzing unit, a decoding unit and an auxiliary unit, wherein the positioning unit is used for confirming the position of a bar code, the control unit sends an instruction to the control unit after determining the position of the bar code, the control unit receives the instruction of the positioning unit and then controls the collecting unit to collect the image of the bar code, and the collecting unit collects the image information of the bar code and sends the image information to the analyzing unit; when the bar code is positioned, binarization processing is carried out, the bar code image is changed into blank spots with full pixels and zero pixels, at the moment, the bar code image is abstracted into a simple graph with only blank spots and position spots, and when the reserved position spot image is identified, which one of QR-code, maxicode and Datamatrix belongs to is judged according to the image, so that the positioning is finished, the calculated amount is small, and the positioning speed is high.

Description

Bar code recognition method and system
Technical Field
The invention relates to the technical field of image recognition, in particular to a bar code recognition method and a bar code recognition system.
Background
Bar code identification refers to a technology for identifying bar codes by using photoelectric conversion equipment, wherein the bar codes are a group of sequences formed by arranging wide bars, narrow bars and blanks, the sequences can represent certain numbers and letter codes, and the bar codes can be printed on paper surfaces and other articles, so that the photoelectric conversion equipment can conveniently reproduce the numbers and letter information, and the bar codes can be read by a computer.
The bar code is usually collected by the cooperation of a lens and an image sensor, the image preprocessing is usually performed by adopting a digital image processing technology to perform optimization processing such as denoising and deblurring, namely the bar code is extracted from an image by utilizing the unique structural characteristics of the bar code, and the bar code identification is performed by interpreting digital information carried by the bar code according to coding rules of different code systems, but the following problems exist in the traditional bar code identification:
when the bar code is identified, the bar code on the article is generally identified by a handheld terminal or an article, and the positions of the bar codes are different in each handheld process, so that the position of the bar code cannot be found at the first time when the bar code is identified, the identification is failed at the moment, or the time is wasted in the process of finding the bar code, and the overall working efficiency in the bar code identification operation is affected;
the existing bar code mainly comprises a one-dimensional bar code and a two-dimensional bar code, and the recognition modes of the one-dimensional bar code and the two-dimensional bar code are different, so that when the one-dimensional bar code and the two-dimensional bar code are recognized by the same device, recognition information errors can be caused, in the process of recognizing the bar code, the position of the bar code is not in a horizontal or vertical state, a certain angle can be generated between the bar code and a recognition terminal, when the angle exists, the error of the recognition information in the bar code can be caused by the bar code recognition, the bar code cannot be used in a dark environment, and when the light is insufficient, the bar code cannot be normally recognized.
Disclosure of Invention
In order to overcome the above-mentioned drawbacks of the prior art, embodiments of the present invention provide a barcode recognition method and system, so as to solve the technical problems set forth in the background art.
In order to achieve the above purpose, the present invention provides the following technical solutions: a bar code identification method comprising the steps of:
s1, during bar code identification, a positioning unit collects image information of a bar code and carries out binarization processing and expansion operation on the image, so that the type and the position of the bar code are determined;
step S2, after the positioning unit determines the bar code position, the acquisition unit acquires the image data of the bar code and sends the image data of the bar code to the analysis unit, the analysis unit carries out noise filtering in a median filtering mode after carrying out gray value processing on the image data, the median filtering is divided into one-dimensional filtering and two-dimensional filtering, and the calculation formula of the three-dimensional filtering is Y=Med { f i-v ∧f i ∧f i+v The two-dimensional filtering is calculated as the formula
Figure BDA0004103527690000021
S3, after the filtered image is subjected to edge detection, correcting the image edge inclination angle, and after the image edge inclination angle is corrected, performing image segmentation, sending the segmented image to a decoding unit by the analysis module, and identifying information in a bar code by the decoding unit;
and S4, the acquisition module in the acquisition unit sends the gray value of the bar code image to the comparison module, the comparison module calculates and compares the gray value of the bar code image with the threshold value in the bar code image, and when the gray value is smaller than or equal to the threshold value, the light supplementing lamp in the auxiliary unit performs light supplementing work.
The bar code identification system comprises a positioning unit, a control unit, an acquisition unit, an analysis unit, a decoding unit and an auxiliary unit, wherein the positioning unit is used for confirming the position of a bar code, the control unit sends an instruction to the control unit after determining the position of the bar code, the control unit receives the instruction of the positioning unit and then controls the acquisition unit to acquire a bar code image, the acquisition unit acquires the image information of the bar code and sends the image information to the analysis unit, the analysis unit processes the image information of the bar code and then sends the processed image information to the decoding unit, the decoding unit decodes the analyzed bar code information and identifies the internal information of the bar code, and when the illumination of the bar code image acquired by the acquisition unit is insufficient, the auxiliary unit supplements light required by image acquisition at the moment, and the control unit controls the positioning unit, the acquisition unit, the decoding unit and the auxiliary unit to work.
In a preferred embodiment, the positioning unit collects the image information of the bar code and performs binarization processing on the image, wherein the processing formula of image binarization is as follows
Figure BDA0004103527690000031
Wherein g (x, y) is a binary image, f (x, y) is a pixel value of the acquired bar code image, T is a gray value threshold of the pixel value, the binary image is subjected to expansion operation, and the expansion operation formula is->
Figure BDA0004103527690000032
A is a bar code image, B is a structural element, and the bar code image is inflated by the structural element.
In a preferred embodiment, the image after the dilation operation is QR-code when the pixel image is in the upper left, lower left and upper right corners, maxicode when the pixel image is in the central three equally spaced concentric rings, and Datamatrix when the pixel image is in the two implementation segments of the main and lower edges.
In a preferred embodiment, the collecting unit includes a collecting module, a preprocessing module and a comparing module, the collecting module collects the image information of the bar code and sends the image information to the preprocessing module, the preprocessing module carries out grayscale processing on the image of the bar code and sends the grayscale processing to the analyzing unit, a calculation formula of the grayscale processing is w=0.3 r+0.58g+0.12b, wherein R is red, G is green, B is blue, and R, G, B is in a grayscale value range of 0-255, and the preprocessing module sends the preprocessed image data to the analyzing module.
In a preferred embodiment, the analysis unit processes the graying image by using a median filtering method, wherein a processing formula of the median filtering is divided into one-dimensional filtering and two-dimensional filtering, and a calculation formula of the one-dimensional filtering is y=med { f i-v ∧f i ∧f i+v In the formula, med is a medfilt2 function, f i-v ∧f i ∧f i+v Is a one-dimensional sequence group, f i Is the center value of the image window, v isThe central value of the window length, the calculation formula of the two-dimensional filtering is that
Figure BDA0004103527690000033
Wherein X is ij Is a two-dimensional sequence, A is a window, and the noise variance of median filtering output is +.>
Figure BDA0004103527690000034
Where σ is the input noise variance, m is the median filter window length, < >>
Figure BDA0004103527690000035
For inputting noise mean value>
Figure BDA0004103527690000036
As a function of input noise density.
In a preferred embodiment, the analysis module performs the correction of the image edge inclination angle after performing the edge detection on the filtered image, and the correction process of the image edge inclination angle is as follows:
step A1, establishing a discrete parameter space between the maximum value and the minimum value of rho and theta, and establishing an accumulator A (rho, theta), wherein each element in the accumulator is 0;
a2, performing Hough transformation on pixel points of the image, and calculating a curve of the pixel points on a parameter space, wherein an accumulator is added with 1, a Hough transformation formula is rho=xcos theta+ysin theta, rho is an intercept, theta is a slope angle, and x and y are gray values of the image;
a3, analyzing a local maximum value on an image plane collinear point accumulator, and if the local maximum value is a single result, detecting the intercept and the slope of a straight line by coordinates (rho, theta), and correcting the image inclination angle;
a4, analyzing local maximum values on the image plane colinear point accumulator to obtain a plurality of results, at the moment, carrying out Radon transformation on the image to obtain R, wherein the maximum angle of R is the image inclination angle, at the moment, correction can be carried out, and the Radon transformation formula is as follows
Figure BDA0004103527690000041
Where f (x, y) is the pixel point of the image, δ is the distance from the origin of coordinates to the straight line, and D is the rectangular coordinate plane of the image.
In a preferred embodiment, the barcode image is subjected to image segmentation after being subjected to image edge tilt angle correction, and during image segmentation, firstly, the projection of the image after being subjected to image edge tilt angle correction in the horizontal direction is performed, and secondly, the projected image P is subjected to convolution smoothing to complete image segmentation, wherein a convolution smoothing formula is as follows
Figure BDA0004103527690000042
Wherein P is the projected pixel value, eta is the variance value of the pixel after the pixel is projected, and the analysis module sends the segmented image into a decoding unit for decoding to identify bar code information.
In a preferred embodiment, the auxiliary unit includes a light supplementing lamp, the collecting module sends the gray value of the barcode image to the comparing module, the comparing module calculates the gray value of the barcode image to be compared with the threshold value inside the barcode image, when the gray value is greater than the threshold value, the comparing module does not send an instruction, when the gray value is less than or equal to the threshold value, the comparing module sends an instruction to the control unit, the control unit sends an instruction to the auxiliary unit, the light supplementing lamp in the auxiliary unit works at the moment, and after the image is collected, the light supplementing lamp is automatically turned off.
The invention has the technical effects and advantages that:
1. according to the invention, a positioning unit is arranged for performing binarization processing when a bar code is positioned, points representing information are changed into blank points with full pixel points and zero pixels, at the moment, a bar code image is abstracted into a simple graph with only blank points and position points, and at the moment, the reserved position point image is identified, and when the bar code image is identified, which of QR-code, maxicode and Datamatrix belongs to the image is judged, so that the positioning is completed, the calculated amount is small, and the positioning speed is high;
2. according to the invention, the analysis unit is arranged, the one-dimensional bar code and the two-dimensional bar code are subjected to filtering treatment in different modes, the one-dimensional bar code and the two-dimensional bar code after being subjected to filtering can be subjected to excellent filtering treatment, the output of planting filtering is related to input noise, and the source of the bar code noise is mainly an optical acquisition system, so that the median filtering is suitable for bar code images, and the calculation speed is high;
3. according to the invention, the Hough transformation is combined with the Radon transformation, so that the problems that the Hough transformation is huge in calculated amount and cannot be rapidly identified, and the Radon transformation result is inaccurate are solved, and the inclination angle of a bar code image can be rapidly and accurately found when the application is used for correcting the image inclination angle, so that the image inclination angle is rapidly corrected;
4. the invention compares the gray value with the threshold value by the aid of the auxiliary unit, and the gray value can directly reflect the light condition when the bar code is collected, so that when the gray value is lower, the light is weaker at the moment, and when the gray value is lower than the threshold value, normal bar code identification work cannot be performed, and thus light supplementing operation is required, and smooth bar code identification is ensured.
Drawings
Fig. 1 is a schematic diagram of a bar code identification process according to the present invention.
FIG. 2 is a schematic diagram of the bar code identification system of the present invention.
Detailed Description
The embodiments of the present invention will be described more fully hereinafter with reference to the accompanying drawings, in which the configurations of the embodiments described below are merely illustrative, and a bar code recognition method and system according to the present invention are not limited to the configurations described below, but all other embodiments obtained by one skilled in the art without making any inventive effort are within the scope of the present invention.
Referring to fig. 1, the present invention provides a bar code recognition method, comprising the steps of:
s1, during bar code identification, a positioning unit collects image information of a bar code and carries out binarization processing and expansion operation on the image, so that the type and the position of the bar code are determined;
step S2, positioning unitAfter the bar code position is determined, the acquisition unit acquires image data of the bar code and sends the image data of the bar code to the analysis unit, the analysis unit carries out noise filtering in a median filtering mode after carrying out gray value processing on the image data, the median filtering is divided into one-dimensional filtering and two-dimensional filtering, and the calculation formula of the three-dimensional filtering is Y=Med { f i-v ∧f i ∧f i+v The two-dimensional filtering is calculated as the formula
Figure BDA0004103527690000061
S3, after the filtered image is subjected to edge detection, correcting the image edge inclination angle, and after the image edge inclination angle is corrected, performing image segmentation, sending the segmented image to a decoding unit by the analysis module, and identifying information in a bar code by the decoding unit;
and S4, the acquisition module in the acquisition unit sends the gray value of the bar code image to the comparison module, the comparison module calculates and compares the gray value of the bar code image with the threshold value in the bar code image, and when the gray value is smaller than or equal to the threshold value, the light supplementing lamp in the auxiliary unit performs light supplementing work.
Referring to fig. 2, a bar code recognition system includes a positioning unit, a control unit, an acquisition unit, an analysis unit, a decoding unit and an auxiliary unit, wherein the positioning unit is used for confirming the position of a bar code, the control unit sends an instruction to the control unit after determining the position of the bar code, the control unit receives the instruction of the positioning unit and then controls the acquisition unit to acquire the image information of the bar code and sends the image information of the bar code to the analysis unit, the analysis unit processes the image information of the bar code and then sends the processed image information to the decoding unit, the decoding unit decodes the analyzed bar code information and recognizes the internal information of the bar code, and when the illumination of the bar code image acquired by the acquisition unit is insufficient, the auxiliary unit supplements light required by image acquisition at the moment, and the control unit controls the positioning unit, the acquisition unit, the decoding unit and the auxiliary unit to work.
Further, the positioning unit collects the image information of the bar codeAnd carrying out binarization processing on the image, wherein the processing formula of the binarization of the image is as follows
Figure BDA0004103527690000062
Wherein g (x, y) is a binary image, f (x, y) is a pixel value of the acquired bar code image, T is a gray value threshold of the pixel value, the binary image is subjected to expansion operation, and the expansion operation formula is that
Figure BDA0004103527690000071
A is a bar code image, B is a structural element, the bar code image is inflated by the structural element, the image after inflation operation is QR-code when the pixel dot image is positioned at the upper left corner, the lower left corner and the upper right corner, the pixel dot image is Maxicode when the pixel dot image is positioned in three equidistant concentric rings in the center, and the pixel dot image is Datamatrix when the pixel dot image is positioned in two implementation sections of the main side and the lower side.
In the embodiment of the application, when the bar code is positioned, the information represented by the bar code is not required to be acquired, the position of the bar code is only required to be determined, the binarization processing is performed at the moment, the points representing the information are changed into blank points with full pixels and zero pixels, at the moment, the bar code image is abstracted into a simple graph with only blank surfaces and position points, and the reserved position point image at the moment is judged according to the image when the bar code image is identified, so that the positioning is completed, the calculated amount is small, and the positioning speed is high.
Further, the collection unit includes collection module, preprocessing module and comparison module, collection module gathers the image information of barcode and sends the preprocessing module, preprocessing module carries out the graying with the image of barcode and handles and send to the analysis unit, the calculation formula of graying is W=0.3 R+0.58G+0.12B, wherein R is red, G is green, B is blue, and R, G, B all is located 0-255 gray value range, preprocessing module sends the image data after the preprocessing to the analysis module, when collection module carries out the collection of barcode, carry out the graying processing of barcode at first, the data of transmission is the image information after the graying this moment, can avoid carrying out the whole transmission with the image, then influence the problem of final decoding effect, the calculation formula of graying is W=0.3 R+0.58G+0.12B, can reflect the gray information of image, the image after handling can more accurately reflect the information.
Further, the analysis unit processes the image after graying by adopting a median filtering mode, a processing formula of the median filtering is divided into one-dimensional filtering and two-dimensional filtering, and a calculation formula of the one-dimensional filtering is y=med { f i-v ∧f i ∧f i+v In the formula, med is a medfilt2 function, f i-v ∧f i ∧f i+v Is a one-dimensional sequence group, f i The calculation formula of the two-dimensional filtering is that the central value of the image window is that v is the central value of the window length
Figure BDA0004103527690000081
Wherein X is ij Is a two-dimensional sequence, A is a window, and the noise variance of median filtering output is +.>
Figure BDA0004103527690000082
Where σ is the input noise variance, m is the median filter window length, < >>
Figure BDA0004103527690000083
For inputting noise mean value>
Figure BDA0004103527690000084
For inputting a noise density function, the conventional bar codes comprise a one-dimensional bar code and a two-dimensional bar code, and the images of the one-dimensional bar code and the two-dimensional bar code are different, so that the one-dimensional bar code and the two-dimensional bar code are filtered in different modes, the one-dimensional bar code and the two-dimensional bar code after being filtered can be subjected to excellent filtering, the output of the planting filtering is related to the input noise, the source of the bar code noise is mainly an optical acquisition system, and the method is suitable for the bar code images by using median filtering and has high calculation speed.
Further, after the analysis module detects the edges of the filtered image, the correction of the image edge inclination angle is performed, and the correction process of the image edge inclination angle is as follows:
step A1, establishing a discrete parameter space between the maximum value and the minimum value of rho and theta, and establishing an accumulator A (rho, theta), wherein each element in the accumulator is 0;
a2, performing Hough transformation on pixel points of the image, and calculating a curve of the pixel points on a parameter space, wherein an accumulator is added with 1, a Hough transformation formula is rho=xcos theta+ysin theta, rho is an intercept, theta is a slope angle, and x and y are gray values of the image;
a3, analyzing a local maximum value on an image plane collinear point accumulator, and if the local maximum value is a single result, detecting the intercept and the slope of a straight line by coordinates (rho, theta), and correcting the image inclination angle;
a4, analyzing local maximum values on the image plane colinear point accumulator to obtain a plurality of results, at the moment, carrying out Radon transformation on the image to obtain R, wherein the maximum angle of R is the image inclination angle, at the moment, correction can be carried out, and the Radon transformation formula is as follows
Figure BDA0004103527690000085
Where f (x, y) is the pixel point of the image, δ is the distance from the origin of coordinates to the straight line, and D is the rectangular coordinate plane of the image.
In this embodiment of the present application, when Hough transformation is adopted, when each pixel point is transformed, the calculation amount at this time is huge, so the recognition speed is affected, and when the Hough transformation is used, the points on the nonlinear line may be connected by mistake, so a plurality of results are obtained, while Radon transformation is simple in algorithm, but the finally calculated result is relatively gentle, the peak value cannot be found, namely, the inclination angle, so recognition failure is caused, and therefore the present application combines the advantages of the two, so that the inclination angle of the barcode image can be found quickly and accurately when the present application performs image inclination angle correction, and thus the image inclination angle correction is performed quickly.
Further, the bar code image is subjected to image segmentation after the correction of the image edge inclination angle, and the image edge inclination angle is corrected at first during the image segmentationProjecting the projected image P in the horizontal direction, and performing convolution smoothing on the projected image P to complete image segmentation, wherein a convolution smoothing formula is as follows
Figure BDA0004103527690000091
Wherein P is the pixel value after projection, eta is the variance value of the pixel after projection, the analysis module sends the segmented image into the decoding unit for decoding, bar code information is identified, when the bar code image is subjected to edge inclination angle correction, the bar code image is slightly distorted and is distorted, the reading of the information in the bar code is affected, therefore, each part of the image is smoothly segmented after projection, each part of the image is segmented, and the basic shape of the image is unchanged after edge inclination angle correction, so that the processed image is not changed from the initial image, and the information in the bar code can be accurately identified completely.
Further, the auxiliary unit comprises a light supplementing lamp, the acquisition module sends the gray value of the bar code image to the comparison module, the comparison module calculates the gray value of the bar code image to be compared with the threshold value in the bar code image, when the gray value is larger than the threshold value, the comparison module does not send an instruction, when the gray value is smaller than or equal to the threshold value, the comparison module sends an instruction to the control unit, the control unit sends the instruction to the auxiliary unit, the light supplementing lamp in the auxiliary unit works, after the image is acquired, the light supplementing lamp is automatically closed, the gray value is compared with the threshold value, the gray value can directly reflect the light condition when the bar code is acquired, therefore, when the gray value is lower, the light at the moment is weaker, and when the gray value is lower than the threshold value, normal bar code identification work cannot be performed, and therefore the light supplementing operation is needed, and the smooth proceeding of bar code identification is ensured.
Example two
The filtering can also be carried out by adopting an adaptive smoothing filtering method, wherein the filtering formula of the adaptive smoothing filtering method is h (x, y) =f (x, y) +k (x, y) { f (x, y) -h (x, y) }, h (x, y) is an image after the adaptive smoothing filtering, k (x, y) is a filtering constant, and f (x, y) is an originalThe calculation formula of k (x, y) of the noisy image is
Figure BDA0004103527690000101
Middle sigma 2 The variance of the interference noise, P (x, y), is the variance of statistics around the image day, and when the adaptive smoothing filtering method is adopted to carry out filtering processing, the variance can be changed according to the change of the interference frequency, so that the image recognition is more accurate, the error is small, but the calculated amount is large, the efficiency of the image recognition is low, and the method is suitable for being used in occasions with high accuracy requirements.
The above embodiments may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented in software, the above-described embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product comprises one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the processes or functions in accordance with the embodiments of the present application are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired means from one website site, computer, server, or data center. Computer readable storage media can be any available media that can be accessed by a computer or data storage devices, such as servers, data centers, etc. that contain one or more collections of available media. The usable medium may be a magnetic medium, an optical medium, or a semiconductor medium. The semiconductor medium may be a solid state disk.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided in the present application, it should be understood that the disclosed systems, apparatuses, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Finally: the foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (9)

1. A bar code identification method is characterized in that: the method comprises the following steps:
s1, during bar code identification, a positioning unit collects image information of a bar code and carries out binarization processing and expansion operation on the image, so that the type and the position of the bar code are determined;
step S2, after the positioning unit determines the bar code position, the acquisition unit acquires the image data of the bar code and sends the image data of the bar code to the analysis unit, the analysis unit carries out noise filtering in a median filtering mode after carrying out gray value processing on the image data, the median filtering is divided into one-dimensional filtering and two-dimensional filtering, and the calculation formula of the three-dimensional filtering is Y=Med { f i-v ∧f i ∧f i+v The two-dimensional filtering is calculated as the formula
Figure FDA0004103527670000011
S3, after the filtered image is subjected to edge detection, correcting the image edge inclination angle, and after the image edge inclination angle is corrected, performing image segmentation, sending the segmented image to a decoding unit by the analysis module, and identifying information in a bar code by the decoding unit;
and S4, the acquisition module in the acquisition unit sends the gray value of the bar code image to the comparison module, the comparison module calculates and compares the gray value of the bar code image with the threshold value in the bar code image, and when the gray value is smaller than or equal to the threshold value, the light supplementing lamp in the auxiliary unit performs light supplementing work.
2. A bar code identification system, characterized by: the system comprises a positioning unit, a control unit, a collecting unit, an analyzing unit, a decoding unit and an auxiliary unit, wherein the positioning unit is used for confirming the positions of bar codes, the control unit sends an instruction to the control unit after determining the positions of the bar codes, the control unit receives the instruction of the positioning unit and then controls the collecting unit to collect bar code images, the collecting unit collects image information of the bar codes and sends the image information to the analyzing unit, the analyzing unit processes the image information of the bar codes and then sends the processed image information to the decoding unit, the decoding unit decodes the analyzed bar code information and identifies internal information of the bar codes, and when the illumination of the bar code images collected by the collecting unit is insufficient, the auxiliary unit supplements light required by image collection, and the control unit controls the positioning unit, the collecting unit, the decoding unit and the auxiliary unit to work.
3. A bar code identification system according to claim 2, wherein: the positioning unit collects the image information of the bar code and carries out binarization processing on the image, and the processing formula of image binarization is as follows
Figure FDA0004103527670000021
Wherein g (x, y) is a binary image, f (x, y) is a pixel value of the acquired bar code image, T is a gray value threshold of the pixel value, the binary image is subjected to expansion operation, and the expansion operation formula is->
Figure FDA0004103527670000022
A is a bar code image, B is a structural element, and the bar code image is inflated by the structural element.
4. A bar code identification system according to claim 3, wherein: the image after the expansion operation is QR-code when the pixel image is positioned at the upper left corner, the lower left corner and the upper right corner, maxicode when the pixel image is positioned at the central three equally spaced concentric rings, and Datamatrix when the pixel image is positioned at the two implementation segments of the main side and the lower side.
5. A bar code identification system according to claim 2, wherein: the acquisition unit comprises an acquisition module, a preprocessing module and a comparison module, wherein the acquisition module acquires image information of a bar code and sends the image information to the preprocessing module, the preprocessing module carries out graying processing on an image of the bar code and sends the image information to the analysis unit, a calculation formula of the graying processing is W=0.3 R+0.58G+0.12B, R is red, G is green, B is blue, and R, G, B is in a gray value range of 0-255, and the preprocessing module sends preprocessed image data to the analysis module.
6. A bar code identification system according to claim 5, wherein: the analysis unit processes the graying image in a median filtering mode, wherein the processing formula of the median filtering is divided into one-dimensional filtering and two-dimensional filtering, and the calculation formula of the one-dimensional filtering is Y=Med { f i-v ∧f i ∧f i+v In the formula, med is a medfilt2 function, f i-v ∧f i ∧f i+v Is a one-dimensional sequence group, f i The calculation formula of the two-dimensional filtering is that the central value of the image window is that v is the central value of the window length
Figure FDA0004103527670000023
Wherein X is ij Is a two-dimensional sequence, A is a window, and the noise variance of median filtering output is +.>
Figure FDA0004103527670000024
Where σ is the input noise variance, m is the median filter window length, < >>
Figure FDA0004103527670000025
For inputting noise mean value>
Figure FDA0004103527670000026
As a function of input noise density.
7. A bar code identification system according to claim 6, wherein: after the analysis module detects the edges of the filtered images, correcting the inclination angles of the edges of the images, wherein the correction process of the inclination angles of the edges of the images is as follows:
step A1, establishing a discrete parameter space between the maximum value and the minimum value of rho and theta, and establishing an accumulator A (rho, theta), wherein each element in the accumulator is 0;
a2, performing Hough transformation on pixel points of the image, and calculating a curve of the pixel points on a parameter space, wherein an accumulator is added with 1, a Hough transformation formula is rho=xcos theta+ysin theta, rho is an intercept, theta is a slope angle, and x and y are gray values of the image;
a3, analyzing a local maximum value on an image plane collinear point accumulator, and if the local maximum value is a single result, detecting the intercept and the slope of a straight line by coordinates (rho, theta), and correcting the image inclination angle;
a4, analyzing local maximum values on the image plane colinear point accumulator to obtain a plurality of results, at the moment, carrying out Radon transformation on the image to obtain R, wherein the maximum angle of R is the image inclination angle, at the moment, correction can be carried out, and the Radon transformation formula is as follows
Figure FDA0004103527670000031
Where f (x, y) is the pixel point of the image, δ is the distance from the origin of coordinates to the straight line, and D is the rectangular coordinate plane of the image.
8. The bar code identification system of claim 7, wherein: the bar code image is subjected to image segmentation after the correction of the image edge inclination angle, during the image segmentation, firstly, the projection of the image after the correction of the image edge inclination angle in the horizontal direction is carried out, secondly, the image P after the projection is subjected to convolution smoothing to complete the image segmentation, and a convolution smoothing formula is as follows
Figure FDA0004103527670000032
Wherein P is the pixel value after projection, eta is the variance value of the pixel after projection, and the analysis module dividesAnd sending the cut image to a decoding unit for decoding, and identifying bar code information.
9. A bar code identification system according to claim 5, wherein: the auxiliary unit comprises a light supplementing lamp, the acquisition module sends the gray value of the bar code image to the comparison module, the comparison module calculates the gray value of the bar code image to be compared with the threshold value inside the bar code image, when the gray value is larger than the threshold value, the comparison module does not send an instruction, and when the gray value is smaller than or equal to the threshold value, the comparison module sends an instruction to the control unit, the control unit sends the instruction to the auxiliary unit, the light supplementing lamp in the auxiliary unit works at the moment, and after the image is acquired, the light supplementing lamp is automatically turned off.
CN202310184947.1A 2023-02-21 2023-02-21 Bar code recognition method and system Pending CN116167394A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310184947.1A CN116167394A (en) 2023-02-21 2023-02-21 Bar code recognition method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310184947.1A CN116167394A (en) 2023-02-21 2023-02-21 Bar code recognition method and system

Publications (1)

Publication Number Publication Date
CN116167394A true CN116167394A (en) 2023-05-26

Family

ID=86419855

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310184947.1A Pending CN116167394A (en) 2023-02-21 2023-02-21 Bar code recognition method and system

Country Status (1)

Country Link
CN (1) CN116167394A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116415610A (en) * 2023-06-12 2023-07-11 恒银金融科技股份有限公司 Bank passbook bar code processing method and device and electronic equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101154267A (en) * 2006-09-28 2008-04-02 李振宇 Method for zone location and type judgment of two-dimensional bar code
CN102136058A (en) * 2011-04-26 2011-07-27 中国农业大学 Bar code image identification method
CN102830573A (en) * 2012-09-10 2012-12-19 华为终端有限公司 Method and device for controlling flash
CN107451505A (en) * 2017-07-18 2017-12-08 王栋 The angle correction method of express delivery single bar code
CN108959998A (en) * 2018-06-25 2018-12-07 天津英创汇智汽车技术有限公司 Two-dimensional code identification method, apparatus and system
CN109886896A (en) * 2019-02-28 2019-06-14 闽江学院 A kind of blue License Plate Segmentation and antidote
CN110532826A (en) * 2019-08-21 2019-12-03 厦门壹普智慧科技有限公司 A kind of bar code identifying device and method based on artificial intelligence semantic segmentation
CN111604909A (en) * 2020-06-24 2020-09-01 辽宁工业大学 Visual system of four-axis industrial stacking robot
CN114004799A (en) * 2021-10-28 2022-02-01 浙江隼视智能科技有限公司 Tire bar code identification method, system and equipment based on machine vision
CN115270839A (en) * 2022-07-21 2022-11-01 河南埃尔森智能科技有限公司 Industrial scene QR Code detection and identification method based on PPYOLOv2 model

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101154267A (en) * 2006-09-28 2008-04-02 李振宇 Method for zone location and type judgment of two-dimensional bar code
CN102136058A (en) * 2011-04-26 2011-07-27 中国农业大学 Bar code image identification method
CN102830573A (en) * 2012-09-10 2012-12-19 华为终端有限公司 Method and device for controlling flash
CN107451505A (en) * 2017-07-18 2017-12-08 王栋 The angle correction method of express delivery single bar code
CN108959998A (en) * 2018-06-25 2018-12-07 天津英创汇智汽车技术有限公司 Two-dimensional code identification method, apparatus and system
CN109886896A (en) * 2019-02-28 2019-06-14 闽江学院 A kind of blue License Plate Segmentation and antidote
CN110532826A (en) * 2019-08-21 2019-12-03 厦门壹普智慧科技有限公司 A kind of bar code identifying device and method based on artificial intelligence semantic segmentation
CN111604909A (en) * 2020-06-24 2020-09-01 辽宁工业大学 Visual system of four-axis industrial stacking robot
CN114004799A (en) * 2021-10-28 2022-02-01 浙江隼视智能科技有限公司 Tire bar code identification method, system and equipment based on machine vision
CN115270839A (en) * 2022-07-21 2022-11-01 河南埃尔森智能科技有限公司 Industrial scene QR Code detection and identification method based on PPYOLOv2 model

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"基于图像处理的二维QR Code条码译码系统研究", 万方, 25 February 2014 (2014-02-25), pages 35 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116415610A (en) * 2023-06-12 2023-07-11 恒银金融科技股份有限公司 Bank passbook bar code processing method and device and electronic equipment
CN116415610B (en) * 2023-06-12 2023-10-03 恒银金融科技股份有限公司 Bank passbook bar code processing method and device and electronic equipment

Similar Documents

Publication Publication Date Title
EP3309704B1 (en) Two-dimensional code partitioning and decoding method and system
EP1456811B1 (en) Reconstruction of virtual raster
EP2393037B1 (en) Data matrix decoding chip and decoding method thereof
EP1678659B1 (en) Method and image processing device for analyzing an object contour image, method and image processing device for detecting an object, industrial vision apparatus, smart camera, image display, security system, and computer program product
EP2393035B1 (en) QR barcode decoding chip and decoding method thereof
US7380718B2 (en) Method for reading out symbol information and device for reading out symbol information
EP2393038A1 (en) Matrix-type two-dimensional barcode decoding chip and decoding method thereof
EP3462372B1 (en) System and method for detecting optical codes with damaged or incomplete finder patterns
EP2220586B1 (en) Enhanced virtual scan line processing
CN113591967A (en) Image processing method, device and equipment and computer storage medium
US20230351130A1 (en) Method for detecting and reading a matrix code marked on a glass substrate
CN103870790A (en) Recognition method and device of two-dimensional bar code
CN103530590A (en) DPM (direct part mark) two-dimensional code recognition system
CN105335744B (en) A kind of one-dimension code zone location extracting band distribution characteristics based on image backbone
US9070033B2 (en) Stack barcode reader and stack barcode reading method
CN110009615B (en) Image corner detection method and detection device
CN104298947A (en) Method and device for accurately positioning two-dimensional bar code
CN116167394A (en) Bar code recognition method and system
CN115238723A (en) Local vertex detection method and device
TWI438699B (en) Processing method of barcode and related apparatus thereof
CN115169375B (en) AR and gun ball linkage-based high-level material visualization method
CN111178111A (en) Two-dimensional code detection method, electronic device, storage medium and system
CN112800798B (en) Aztec code positioning method
CN114004799A (en) Tire bar code identification method, system and equipment based on machine vision
CN113516103A (en) Table image inclination angle determining method based on support vector machine

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