CN109583535B - Vision-based logistics barcode detection method and readable storage medium - Google Patents

Vision-based logistics barcode detection method and readable storage medium Download PDF

Info

Publication number
CN109583535B
CN109583535B CN201811443403.8A CN201811443403A CN109583535B CN 109583535 B CN109583535 B CN 109583535B CN 201811443403 A CN201811443403 A CN 201811443403A CN 109583535 B CN109583535 B CN 109583535B
Authority
CN
China
Prior art keywords
goods
bar code
picture
label
dimensional
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.)
Active
Application number
CN201811443403.8A
Other languages
Chinese (zh)
Other versions
CN109583535A (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.)
National University of Defense Technology
Original Assignee
National University of Defense Technology
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 National University of Defense Technology filed Critical National University of Defense Technology
Priority to CN201811443403.8A priority Critical patent/CN109583535B/en
Publication of CN109583535A publication Critical patent/CN109583535A/en
Application granted granted Critical
Publication of CN109583535B publication Critical patent/CN109583535B/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
    • G06K17/00Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations
    • G06K17/0022Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations arrangements or provisious for transferring data to distant stations, e.g. from a sensing device
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Warehouses Or Storage Devices (AREA)
  • Image Processing (AREA)

Abstract

The invention belongs to the technical field of logistics detection and discloses a logistics bar code detection method and a computer program based on vision; including picture capture; identifying and locating the cargo location; identifying and locating barcode locations; reading the bar code; and (6) error correction and alarm. The invention uses a computer vision library, adds a noise removing means, positions a one-dimensional code position and a rotation angle thereof under a complex background, and intercepts a horizontal one-dimensional code picture; ensuring that each cargo only corresponds to one label, and adding an alarm mechanism when no label is found in the cargo; the operation of irrelevant pixel data in the picture is avoided, and the operation speed is improved. According to the invention, when the package is conveyed in the production line, the high-definition camera is arranged at a fixed position, the package position of the object package in the visual field range of the camera is identified, the one-dimensional code information pasted on the goods is obtained and decoded, and further the traditional manual scanning of the production line is completely replaced.

Description

Vision-based logistics barcode detection method and readable storage medium
Technical Field
The invention belongs to the technical field of logistics detection, and particularly relates to a logistics barcode detection method based on vision and a readable storage medium.
Background
Currently, the current state of the art commonly used in the industry is such that:
with the popularization of the internet, the logistics industry develops and rises rapidly, the improvement of the logistics speed is pursued, the information and intelligent proportion in the logistics is improved, and a part of manpower is replaced to become a certain development trend of the logistics industry. In the assembly line work of the logistics industry, the numbering and marking of logistics packages by using one-dimensional bar codes become a common practice of the industry, and most logistics companies still need to manually scan the package bar codes by holding a code scanning gun in a hand. This approach not only increases the labor cost, but also makes it difficult for the operator to find the position and angle of the bar code to be manually found and aligned due to the limited scanning distance and the horizontal alignment of the one-dimensional bar code in the scanning direction of the scanning gun, which makes it difficult to meet the speed requirement when the throughput increases.
At present, the widespread use of mobile photographic devices is making it increasingly easier to obtain digital pictures. Meanwhile, the artificial intelligence technology is rapidly developed in this year, the visual application technology is continuously researched and developed, and an industrialized one-dimensional bar code information reading algorithm based on the visual identification technology is developed under sufficient basic conditions.
In the prior art, a one-dimensional barcode recognition algorithm exists, and some mobile phone APP applications can also recognize a one-dimensional barcode on the premise of aligning to a horizontal one-dimensional barcode. However, the one-dimensional code pasting angle on the logistics goods is random and not horizontal, the condition that only a unique bar code is identified by a single goods needs to be met, and the bar code is not identified simply to play a corresponding role in inspection. At present, a method for judging the unique bar code number corresponding to a single cargo is still lacked, and the integrity and the practicability of the existing visual identification bar code function do not meet the requirements of the logistics industry.
In summary, the problems of the prior art are as follows:
(1) The existing logistics also needs to meet the condition that only a unique bar code is identified for a single cargo, if a bar code label is omitted for any cargo, the condition that the cargo cannot correspond to the unique bar code is found on the production line, and the system does not detect the condition and sends out a warning, so that a package without information finally enters the sorting production line. If can prejudge and report to the police, the condition of omitting to post the label can be reported to the police in time and operating personnel is reminded to handle.
(2) The sticking angle of the bar code on the existing logistics goods is random and not horizontal, but the current identification program such as ZBar needs the identified bar code to be in the horizontal position for correct identification. When the barcode has a large horizontal angular deviation in the image, it may result in failure to read the correct code of the barcode. Moreover, a plurality of barcodes appear in the visual field of the camera at the same time, and when a plurality of barcodes coexist, it is difficult to find a fixed rotation direction to return all the barcodes to a horizontal angle for reading. Therefore, in the present technology, it is necessary to rotate all the bar codes in the field of view to a readable angle and read them, so as to ensure that the bar code numbers can be correctly read and no omission occurs.
The difficulty and significance for solving the technical problems are as follows:
(1) How many goods and bar codes are in the camera view field and under which condition it can be judged that no bar code label is posted on the goods. Solving this problem can find the case where no bar code label is attached to the goods.
(2) How to decode the number represented by the bar code label attached on the goods, and the length of the number decoded by the bar code label must conform to the actual bar code number format. Solving this problem can prevent misreading of bar codes that do not conform to the correct encoding scheme.
(3) Certain fault-tolerant mechanisms need to be designed, for example, noise interference can cause identification boxes in one or more frames of images or quantity and precision errors of read labels in short time, but false alarm cannot be sent out. Due to the interference of image shooting noise and the like, the program cannot ensure that the accuracy and the resolution of an object in each frame of picture and the reading accuracy of a bar code reach 100 percent, and the problem can be solved to prevent the occurrence of sensitive error reporting.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a logistics barcode detection method based on vision and a readable storage medium.
The invention is realized in this way, a logistics barcode detection method based on vision, which specifically comprises the following steps:
the method comprises the following steps: picture capturing: the high-definition high-speed camera is fixed at a certain height position right above the conveyor belt, the conveyor belt with a certain length in the visual field is ensured, and clear goods outlines and label pictures can be shot on the premise of goods motion. After the photographing mode is set, the camera starts to photograph high-definition pictures, and simultaneously, the program converts the pictures into a cv (sum) format;
step two: identifying and locating the cargo position: pre-arranging a YOLO target detection model, and calculating the picture in the step one to obtain all object types (goods and labels) in the shot picture, coordinate positions (xy coordinate values of the objects in the picture) of the object types and the labels, and the size of a boundary frame (the length of the boundary frame occupying the picture pixels); in the step, various detected objects are stored into different data types, and the coordinate position and the size of a boundary frame of each object and a picture captured from an original image by the boundary frame are stored in the data types;
step three: identifying and locating barcode locations: after the various objects are identified and stored in the receiving step two, the program firstly processes the objects of the label type. The intercepted picture stored in the label-like object is subjected to region screening and aligning through a bar code processing program, and a bar code picture in the horizontal direction can be obtained.
Step four: reading a bar code: identifying the bar code by using a Zbar method, processing the steps to obtain a horizontal bar code area picture, and identifying the picture by using a Zbar program to obtain the number of the bar code;
step five: and (4) error correction and alarm: and corresponding the 'goods' object identified in the camera view field with the decoded number of the 'label' picture. If the goods are found to lack the corresponding label number in the continuous multi-frame pictures, an alarm is given and an operator is informed to process the goods.
Further, in the first step, setting a shooting mode of the high-definition high-speed camera, installing a grating in front of the visual field position of the camera, setting the shooting mode to be a trigger mode, triggering the grating when goods enter a shooting range, and commanding the camera to continuously shoot for a period of time; the shooting mode can also be set to be continuous shooting, and the shooting can be continuously carried out at certain time intervals no matter whether the conveyer belt is provided with goods or not.
Further, in the second step, the types of the objects to be detected and identified are classified into "goods type" (hexahedron-shaped box or bagged package) and "labels type" (bar code labels), and the center position (coordinates) of the object in the photo and the size (width and height under the picture coordinate system) of the bounding box are located; the adopted method is a YOLO target detection algorithm in deep learning, the operation speed can achieve the effect of real-time detection and meet the target requirement; the method comprises the following specific steps:
(1) The method comprises the steps of pre-training a reliable object detection model, deploying a model algorithm in a program, wherein the model is a mature model formed by acquiring a large amount of actual picture data and performing training operation; after the camera finishes shooting a picture, the model detects the target of the goods in the picture;
(2) The target detection model processes the shot pictures one by one to obtain the types and the number of the objects existing in the shot pictures and the information of the boundary frame of the objects; because a plurality of objects are expected to appear in the same visual field, the detection model needs to detect all objects such as 'goods' and 'labels', and designs a specific data format for the objects, information such as object types (boxes, bagged packages and labels), coordinate positions (xy coordinate values of the objects in a picture), the size of a boundary frame (the length of the image pixels occupied) and the like is stored in the specific data format, meanwhile, a rectangular frame occupied by the objects is cut into sub-images from an original image and stored in the data format, and the sub-images are sent to a next one-dimensional bar code detection program for calculation; if no goods appear in the visual field, image cutting is not carried out and the step is continuously carried out. The design data format is as follows.
Cargo class:
Figure GDA0003998399870000041
the name variable record is a box or a package, the center _ position variable record object coordinates, the bounding variable record rectangular frame range, the area matrix store rectangular frame sub-images intercepted from an original image, and the link _ code variable represents whether the small block corresponds to a bar code number.
The label class:
Figure GDA0003998399870000051
the center _ position variable records the tag coordinates, area stores a rectangular frame sprite cut from the original, num _ type represents the type of barcode it decodes, and num _ code represents the digital content. link _ packegebox _ num indicates the "goods" class object number to which the tag is attached.
Further, in the third step, because the one-dimensional code picture is in the horizontal direction and the pixels are clearer and the irrelevant pixels are less, the one-dimensional code picture is easy to be read by the code reading program, the bar code identification algorithm in the invention utilizes the characteristics of obvious profile and consistent image gradient of the one-dimensional bar code picture, and searches the area with consistent gradient change direction in the intercepted picture of the identified 'label' type object as the area where the one-dimensional code possibly exists, and the specific implementation process is as follows:
(1) Performing graying processing on the picture P0 (a sub-picture is intercepted from the original picture) of the 'label' -class object intercepted in the step two to convert the picture into a grayscale image, and removing noise in the image through Gaussian blur to obtain a grayscale image P1;
(2) Calculating gradient values of each pixel point in the image P1 in two directions by using a Cany operator, namely two image matrixes Gx and Gy; adding the image matrixes Gx and Gy to obtain an image matrix P2 with obvious visual outline characteristics; the contour of the bar code in P2 can be clearly identified, the main gradient value and the direction of each contour point can be calculated according to the gradient values in the XY two directions, and the calculation formula is as follows:
d=sqrt(x(I)^2+y(I)^2)
(3) The image P2 will be divided into M tiles with M × M sized rectangles, the data structure of each tile being:
Figure GDA0003998399870000061
the data structure class may hold the pixel range of the patch in the image, the number of points in all the contour images P2 that fall into the region of the patch, and the dominant gradient direction of the points.
(4) Screening, eliminating small image blocks which do not contain contour points and contain too few contour points, and only keeping small blocks (anchors _ blocks) with the number of contour points being more than m/2;
(5) The main gradient direction of the remaining image patches is calculated. Dividing into one class by every 20 degrees from 0 degree, wherein the range of 9 degrees is 1-9, and determining the number of the belonging number class according to the theta value of the gradient direction of each contour point, namely the locking _ angle value in the anchor _ block data structure class. When the number of contour points in a certain angle range accounts for more than 60% of the number of all contour points, the angle range is determined as the main angle direction of the small block. If not, the block is deleted, which indicates that the gradient in the block is more chaotic.
(6) And communicating the small blocks with the same gradient direction. Clustering and merging small blocks with the pixel distance within d and consistent main gradient directions into a region, and taking the gradient direction as the gradient direction of the 'region' after merging; in the step, small blocks which are far away and have rare number and can not be clustered are removed.
(7) Judging whether the areas of all the combined regions are above a threshold value S, if so, reserving the regions, and otherwise, rejecting the regions;
(8) The rest area is the position of the bar code, the gradient direction theta of the area in the step (6) is the horizontal angle deviation of the bar code, and the identifiable one-dimensional bar code picture can be obtained by clockwise rotating theta degrees.
Furthermore, in the fourth step, the identification method is an open source program, the information of the horizontal one-dimensional bar code is easy to read, and the output result is a number string with a certain length. The bar Code is one of UPCUPC Code, EANEAN Code, code39 Code and Code128 Code, and if the identification is successful, the type of the target bar Code is output together.
Further, in step five, the logic of this step is designed to: after the first step to the fourth step, if the position of each label-like object, which can be correctly read out the code, corresponding to the coordinate axis is located in the range of the rectangular frame of a cargo-like object, the cargo-like object is judged to be marked and coded. When the goods object is not marked, the detection model is indicated to not detect the corresponding tag object, and the program records the number of times of non-correspondence. If the not corresponding condition takes place for continuous multiframe picture, then not corresponding number of times can continuously increase, is higher than certain numerical value then can send out the warning, reminds operating personnel to have taken place the condition of not posting the bar code on the goods. If all detected goods objects in a certain frame of picture can correspond to one number in the period, the number of times of correspondence is not cleared. Meanwhile, when the situation that the goods are identified and the label cannot enter the visual field occurs when the object just enters the visual field is considered, and when the goods are located at the position of the visual field boundary and do not correspond to the codes, the number of times of non-correspondence is not increased. The process can avoid the occurrence of sensitive alarm condition caused by interference of individual uncertain factors, and alarm can be generated only under the condition that the object cannot read the label number in a plurality of frames of pictures.
The bar Code selected to be read by logistics is one of UPCUPC Code, EANEAN Code, code39 Code and Code128 Code, if it is detected in step four that the number type of the bar Code is not the selected type, the number can not be used to correspond to the goods object.
In summary, the advantages and positive effects of the invention are:
the invention has the advantages that the detection network structure source code for cargo detection is compiled by C/C + + language, the prototype is a YOLO target detection network structure, the input layer structure and the output layer structure of the detection network structure source code are changed, data are automatically collected to train a network model, and a stable algorithm structure is formed; the source code, network configuration and network parameters in the invention are protected. 853 goods and labels contained in 543 pictures are tested, 827 object types can be correctly identified, the classification identification accuracy reaches 96.96%, and the area measurement accuracy reaches 90.42%;
the invention utilizes a method for searching one-dimensional bar codes by gradient, source codes are independently compiled by using C + + language, and the principle is that contour points and the gradient direction of the contour points are detected, so that a region with the most consistent reverse gradient is screened out and is used as a region where one-dimensional codes are located; a computer vision library (OPENCV) is used, a noise removing means is added, the position and the rotation angle of a one-dimensional code under a complex background are positioned, and a horizontal one-dimensional code picture can be intercepted.
Figure GDA0003998399870000081
/>
The comparison inspection method and the source code of the goods and the labels can ensure that each goods only corresponds to one label, and an alarm mechanism is added when no label is found in the goods, and meanwhile, the condition that the bar code possibly does not enter the visual field and is read wrongly is considered when the goods do not completely enter the visual field, so that false alarm is avoided. Except that 38 cargos which are not pasted with labels are mixed in 319 cargos tested on the production line, the rest cargos can detect information of the non-pasted bar codes and give an alarm except 2 cargos which are not alarmed.
The method combining the deep learning and the geometric image processing extracts the segmentation image of each cargo by using the deep learning method, and then processes the segmentation image by using the geometric method, thereby avoiding the operation of irrelevant pixel data in the image, improving the operation speed and realizing the real-time detection. The average time consumed for target identification of a single picture is tested to be 0.04s, the average time consumed for bar code identification is 0.05, the average time consumed for each frame of picture is calculated to be 0.09s, and the FPS is 11.
The invention realizes that the high-definition camera is arranged at a fixed height above the production line while packages are conveyed in the production line, the package position of the object flow in the visual field range of the camera is identified, the one-dimensional code picture pasted on the goods is positioned and decoded and read, and the traditional manual scanning of the production line is completely replaced; has the following advantages:
(1) The identification speed precision can meet the requirements of the express industry, and detection bar codes are basically not omitted within the speed range of the conveyor belt;
(2) In the visual field range of a camera, one-dimensional bar code labels (usually positioned on the surfaces of express packaging bags and express boxes) adhered to logistics packages can be identified and only can be identified, and when the logistics packages are not adhered with bar codes, an alarm can be actively given;
(3) The position of the one-dimensional code label can be accurately positioned, if the one-dimensional code has a horizontal deviation angle, the size of the angle can be solved through an algorithm, and the one-dimensional code can be automatically rotated to be aligned;
(4) The one-dimensional code encoding information can be read and decoded and converted into a number, and whether the number format is correct or not can be checked, and the read invalid number can be discarded.
Drawings
Fig. 1 is a flowchart of a method for detecting logistics barcode based on vision according to an embodiment of the present invention.
Fig. 2 is a technical route diagram of a logistics barcode detection method based on vision according to an embodiment of the invention.
Fig. 3 is a flowchart of cargo detection according to an embodiment of the present invention.
Fig. 4 is a flowchart of barcode detection and reading according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail with reference to the following embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The application principle of the present invention is further explained in detail with reference to the accompanying drawings;
as shown in fig. 1, the logistics barcode detection method based on vision provided by the embodiment of the invention specifically includes the following steps:
s101: picture capturing: fixing a high-definition high-speed camera at a certain height position right above a conveyor belt, ensuring that the conveyor belt with a certain length is contained in a visual field, and shooting clear goods outlines and label pictures on the premise of goods motion;
s102: judging the types, label positions and the size of a boundary frame of all goods in the shot picture by adopting a YOLO target detection algorithm in deep learning; storing the data types of various goods and labels;
s103: processing the intercepted picture stored in the tag class data in the step S102, and obtaining a one-dimensional bar code picture which is easy to read through noise reduction and rotation to the horizontal, so that the goods class data can correspond to one tag class data in space;
s104: reading a bar code: identifying the bar code by using a Zbar method, obtaining a horizontal picture of the one-dimensional code picture by processing the steps, and identifying the horizontal picture by using a Zbar program to obtain data of the bar code;
s105: and (4) error correction and alarm: when an error occurs, the alarm can be reminded, and if necessary, the error can be corrected manually.
In step S101, the high-definition high-speed camera provided by the embodiment of the present invention may install a grating in front of a camera view position, set a shooting mode to a trigger mode, and trigger the grating to command the camera to continuously shoot a certain time when a cargo enters a shooting range; the shooting mode can also be set to be continuous shooting, and the shooting can be continuously carried out at certain time intervals no matter whether the conveyer belt is provided with goods or not.
In step S102, the types of the logistics goods provided by the embodiment of the present invention are divided into hexahedral boxes and bagged packages, and the center position (coordinates) of the goods in the photo and the size (width and height under the picture coordinate system) of the bounding box are located; meanwhile, the central position of the label and the size of the bounding box are also identified, and subimages of the label and the goods are intercepted for next analysis; the adopted method is a YOLO target detection algorithm in deep learning, the operation speed can achieve the effect of real-time detection and meet the target requirement; the method comprises the following specific steps:
(1) The method comprises the steps of pre-training a reliable object detection model, and deploying a model algorithm in a program; after the camera finishes shooting a picture, the program detects the objects and the labels in the picture;
(2) The target detection model processes the shot pictures one by one to obtain the central positions of the goods and the labels in the shot pictures and the information of the boundary frames of the goods and the labels; because a plurality of objects are expected to appear in the same visual field, the detection model needs to detect all the objects and sequentially cut the objects into sub-images, and the sub-images are sent to a next one-dimensional bar code detection program for calculation; if no label or goods appear in the visual field, the image cutting is not carried out and the step is continued.
In step S103, the one-dimensional code image provided in the embodiment of the present invention is easily read by the code reading program in the horizontal direction and when the pixels are relatively clear, the identification barcode algorithm utilizes the characteristics of obvious profile and consistent image gradient of the one-dimensional barcode image, and the pixel regions in the image that meet the characteristics and are concentrated are determined as one-dimensional codes, and the gradient directions of the regions are determined as the rotation angles of the one-dimensional codes; the specific implementation process is as follows:
(1) Graying each label subimage, and carrying out Gaussian blur and noise reduction treatment;
(2) Calculating contour points in the image and the gradient direction of the contour points by using a Cany operator;
(3) Dividing the goods subgraph into a plurality of small blocks by using a rectangle with the size of m × m (the numerical value of m is adjusted according to the actual effect and generally takes 5-10), and recording the gradient directions of contour points and contour points contained in each small block;
(4) Screening, and eliminating small image blocks which do not contain contour points and contain too few contour points;
(5) Calculating the main gradient direction of the rest image small blocks, namely taking the direction in which the gradient directions of the contour points in the small blocks are most concentrated as the main gradient direction; if the gradient directions in the small blocks are dispersed and disordered, rejecting the small blocks;
(6) Communicating all small blocks with the same gradient direction, clustering and combining the small blocks with similar distances and concentrated density into a region, and taking the gradient direction as the gradient direction of the combined region; small blocks which are far away, rare in number and incapable of being clustered are removed;
(7) Judging whether the area of the merged region is above a certain threshold value, if so, reserving, and otherwise, rejecting;
(8) The remaining area is the position of the one-dimensional code, the horizontal angle deviation of the one-dimensional bar code can be obtained according to the gradient direction, and the identifiable one-dimensional bar code can be obtained through rotation.
In step S104, the identification method provided by the embodiment of the present invention is an open source program, which is easy to read information of the horizontal one-dimensional barcode, and an output result thereof is a digital string of a certain length.
In step S105, the following error conditions provided in the embodiment of the present invention may be prompted to alarm, and if necessary, the error may be corrected manually:
(1) The condition that the bar code is not pasted or pasted in the dead angle range of the camera vision and cannot be read when the bar code is seriously damaged; when the goods are found to completely enter the visual field and no readable bar code is found through the processing of the first step to the fourth step, an alarm is given;
(2) More than two bar code regions may be detected in step four due to label printing problems; if the two bar codes read the inconsistent numbers or the read numbers have the problem of inconsistent length, an alarm is sent;
(3) Because the photographing time is short, the same goods can appear in a plurality of continuous photos, the invention estimates a time length which can allow the same serial number to repeatedly appear according to the speed of the conveyor belt, and after a new bar code is read, the bar code with the same serial number is allowed to be repeatedly read within a certain period of time; if the time is exceeded, the conveyor belt does not convey the goods and an alarm is given.
As shown in fig. 2, a technical route diagram of a logistics barcode detection method based on vision according to an embodiment of the present invention is provided.
As shown in fig. 3, a cargo detection flow chart according to an embodiment of the present invention is provided.
As shown in fig. 4, a flow chart of barcode detection and reading according to an embodiment of the present invention is provided.
The application principle of the present invention is further described in detail with reference to the specific embodiments below;
the invention firstly intercepts the bounding boxes belonging to the goods in the visual field range to form sub-images of each goods, then processes and merges the outline and the gradient direction in the sub-images, and finally extracts the pixel range belonging to the one-dimensional bar shape. And rotating the finally extracted one-dimensional code picture to be horizontal, and reading the one-dimensional code sequence by utilizing a decoding program.
The specific process of the invention is as follows:
(1) Starting a processing flow, setting a photographing mode, and ensuring that each cargo and a label image thereof can be clearly photographed;
(2) Identifying the positions and the rectangular sizes of all goods and labels, and intercepting all sub-images of the goods and the labels;
(3) Searching a one-dimensional code position in each label sub-image, and extracting a one-dimensional code picture;
(4) Reading a digital code identifying a one-dimensional code;
(5) If an error occurs, alarming; otherwise, the next picture is continuously processed from the step (2).
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware, or any combination thereof. When used in whole or in part, can be implemented in a computer program product that includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the procedures or functions according to the embodiments of the present invention are wholly or partially generated. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website site, computer, server, or data center to another website site, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL), or wireless (e.g., infrared, wireless, microwave, etc.)). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (5)

1. The logistics barcode detection method based on the vision is characterized by comprising the following steps of:
the method comprises the following steps: fixing a high-definition high-speed camera at a certain height position right above a conveyor belt, ensuring that the conveyor belt with a certain length is contained in a visual field, and shooting clear goods outlines and label pictures on the premise of goods motion;
step two: judging the types, label positions and the size of a bounding box of all goods in the shot picture by adopting a YOLO target detection algorithm in deep learning; storing the data types of various goods and labels;
step three: processing the intercepted picture stored in the tag class data in the second step, and obtaining a one-dimensional bar code picture which is easy to read through noise reduction and rotation to the horizontal, so that the goods class data can correspond to one tag class data in space;
step four: identifying the bar code by using a Zbar method, obtaining a horizontal picture of the one-dimensional code picture by processing the steps, and identifying the horizontal picture by using a Zbar program to obtain data of the bar code;
step five: when an error occurs, the alarm is reminded, and if necessary, the error is corrected manually;
in the first step, the high-definition high-speed camera can be provided with a grating in front of the visual field position of the camera, the shooting mode can be set to be a trigger mode, when goods enter the shooting range, the grating is triggered, and the camera is instructed to shoot for a period of time continuously; the shooting mode can also be set to be continuous shooting, and continuous shooting is carried out at certain time intervals no matter whether goods exist on the conveyer belt or not;
in the second step, the logistics goods are classified into hexahedral boxes and bagged packages, and the central position and the size of the boundary frame of the goods in the photo, and the central position and the size of the boundary frame of the label in the photo are positioned; the label only exists on the surface of the goods, so that the subimage of the label can be intercepted, and the label data is stored for the next analysis; a YOLO target detection algorithm in deep learning;
the method comprises the following specific steps:
(1) Pre-training a reliable object detection model, and deploying a model algorithm in a program; after the camera finishes shooting a picture, the program detects the target of the goods in the picture;
(2) The target detection model processes the shot pictures one by one to obtain the number, the positions and the boundary frame information of the goods and the labels in the shot pictures; because a plurality of objects are expected to appear in the same visual field, the detection model needs to detect all the objects, sequentially cuts the objects into sub-images, stores the sub-images into corresponding class data and sends the corresponding class data into a next one-dimensional bar code detection program for calculation; if no goods or labels appear in the visual field, the image is not cut and the step is continuously executed;
in the third step, the one-dimensional code picture is easily read by a code reading program in the horizontal direction and when the pixels are clear, the identification bar code algorithm utilizes the characteristics of obvious outline and consistent image gradient of the one-dimensional bar code image, the pixel area which accords with the characteristics and is concentrated in the area in the image is judged to be the one-dimensional code, and the gradient direction of the area is taken as the rotation angle of the one-dimensional code; the specific implementation process is as follows:
(1) Graying the sub-image of the label data, and carrying out Gaussian blur and noise reduction treatment;
(2) Calculating contour points in the image and the gradient direction of the contour points by using a Cany operator;
(3) Dividing the cargo subgraph into a plurality of small blocks by using m-by-m rectangles, and recording the gradient directions of contour points and contour points contained in each small block;
(4) Screening, and eliminating small image blocks which do not contain contour points and contain too few contour points;
(5) Calculating the main gradient direction of the rest image small blocks, namely taking the direction in which the gradient directions of the contour points in the small blocks are most concentrated as the main gradient direction; if the gradient directions in the small blocks are dispersed and disordered, rejecting the small blocks;
(6) Carrying out communication treatment on small blocks with the same gradient direction, clustering and combining the small blocks with similar distances and concentrated density into a region, and taking the gradient direction as the gradient direction of the combined region; small blocks which are far away and have rare number and can not be clustered are removed;
(7) Judging whether the area of the combined region is above a certain threshold value, if so, retaining, and otherwise, rejecting;
(8) The remaining area is the position of the one-dimensional code, the horizontal angle deviation of the one-dimensional bar code can be obtained according to the gradient direction, and the recognizable one-dimensional bar code can be obtained through rotation.
2. The visual logistics barcode detection method of claim 1, wherein in the fourth step, the identification method is an open source program, information of the horizontal one-dimensional barcode is easily read, and the output result is a numeric string with a certain length.
3. The visual logistics barcode detection method of claim 1, wherein in the fifth step, an alarm is prompted when the following error conditions occur, and if necessary, a manual error correction is performed:
(1) The condition that the bar code is not pasted and pasted in the dead angle range of the camera vision and cannot be read when the bar code is seriously damaged;
when the goods are found to completely enter the visual field and no readable bar code is found through the processing of the first step to the fourth step, an alarm is given;
(2) More than two bar code regions may be detected in step four due to label printing problems; if the two bar codes read the inconsistent numbers or the read numbers have the problem of inconsistent length, an alarm is sent;
(3) Because the photographing time is short, the same goods can appear in a plurality of continuous pictures, the invention estimates a time length which can allow the same serial number to appear repeatedly according to the speed of the conveyor belt, and after a new bar code is read, the bar code with the same serial number is allowed to be read repeatedly in a certain period of time; if the time is exceeded, the conveyor belt does not convey the goods and an alarm is given.
4. An information data processing terminal for implementing the method for detecting logistics barcode based on vision as claimed in any one of claims 1 to 3.
5. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the vision-based logistics barcode detection method of any one of claims 1-3.
CN201811443403.8A 2018-11-29 2018-11-29 Vision-based logistics barcode detection method and readable storage medium Active CN109583535B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811443403.8A CN109583535B (en) 2018-11-29 2018-11-29 Vision-based logistics barcode detection method and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811443403.8A CN109583535B (en) 2018-11-29 2018-11-29 Vision-based logistics barcode detection method and readable storage medium

Publications (2)

Publication Number Publication Date
CN109583535A CN109583535A (en) 2019-04-05
CN109583535B true CN109583535B (en) 2023-04-18

Family

ID=65925299

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811443403.8A Active CN109583535B (en) 2018-11-29 2018-11-29 Vision-based logistics barcode detection method and readable storage medium

Country Status (1)

Country Link
CN (1) CN109583535B (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110322199B (en) * 2019-06-28 2024-05-14 四川省烟草公司成都市公司 Safe ex-warehouse equipment system and method for image recognition
CN110659706A (en) * 2019-10-15 2020-01-07 广东燕塘乳业股份有限公司 Two-dimensional code identification method based on stacking
CN112800796B (en) * 2019-11-14 2023-05-26 杭州海康机器人股份有限公司 Code reading method, code reading device and logistics system
CN113449532B (en) * 2020-03-25 2022-04-19 杭州海康机器人技术有限公司 Method, device, computing equipment, logistics system and storage medium for detecting packages
CN111553914B (en) * 2020-05-08 2021-11-12 深圳前海微众银行股份有限公司 Vision-based goods detection method and device, terminal and readable storage medium
CN111770263A (en) * 2020-05-22 2020-10-13 盟立自动化(昆山)有限公司 Visual method for accurately capturing image of flowing product at specific visual angle
CN111914579B (en) * 2020-07-01 2021-03-12 上海视界纵横智能科技有限公司 Industrial scanning device and method for self-learning beat recognition
CN112507747B (en) * 2020-12-10 2024-04-19 北京爱创科技股份有限公司 Device and method for scanning traceability codes
CN112818720A (en) * 2021-01-26 2021-05-18 深圳市微目腾科技术有限公司 Two-dimensional code detection method, detection device and storage medium
CN113114877B (en) * 2021-02-23 2023-06-06 广州弥特智能科技有限公司 Multi-bottle rotation acquisition and recognition method and equipment
CN113191469A (en) 2021-04-30 2021-07-30 南方科技大学 Logistics management method, system, server and storage medium based on two-dimension code
CN114330407A (en) * 2021-12-30 2022-04-12 深圳创维-Rgb电子有限公司 Method, device, equipment and storage medium for detecting and identifying bar code
CN115081467B (en) * 2022-07-22 2023-02-03 深圳市成为信息股份有限公司 Method for collecting original image by handset, handset and storage medium
CN116882432B (en) * 2023-07-11 2024-03-22 深圳市裕源欣电子科技有限公司 Method and system for scanning multiple materials, readable storage medium and computer equipment
CN117764094B (en) * 2024-02-21 2024-05-10 博诚经纬软件科技有限公司 Intelligent warehouse management system and method for customs

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103810454A (en) * 2012-11-14 2014-05-21 苏州工业园区高泰电子有限公司 Automatic scanner
CN104281931A (en) * 2014-10-22 2015-01-14 天津慧博科技发展有限公司 Goods checking and classifying system
CN204399926U (en) * 2015-01-01 2015-06-17 广州市嘉诚国际物流股份有限公司 Intelligent cargo cabinet enters goods system
CN107633192A (en) * 2017-08-22 2018-01-26 电子科技大学 Bar code segmentation and reading method under a kind of complex background based on machine vision
CN108647553A (en) * 2018-05-10 2018-10-12 上海扩博智能技术有限公司 Rapid expansion method, system, equipment and the storage medium of model training image

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103810454A (en) * 2012-11-14 2014-05-21 苏州工业园区高泰电子有限公司 Automatic scanner
CN104281931A (en) * 2014-10-22 2015-01-14 天津慧博科技发展有限公司 Goods checking and classifying system
CN204399926U (en) * 2015-01-01 2015-06-17 广州市嘉诚国际物流股份有限公司 Intelligent cargo cabinet enters goods system
CN107633192A (en) * 2017-08-22 2018-01-26 电子科技大学 Bar code segmentation and reading method under a kind of complex background based on machine vision
CN108647553A (en) * 2018-05-10 2018-10-12 上海扩博智能技术有限公司 Rapid expansion method, system, equipment and the storage medium of model training image

Also Published As

Publication number Publication date
CN109583535A (en) 2019-04-05

Similar Documents

Publication Publication Date Title
CN109583535B (en) Vision-based logistics barcode detection method and readable storage medium
US10628648B2 (en) Systems and methods for tracking optical codes
EP2462559B1 (en) System and method for three-dimensional parcel monitoring and analysis
JP3495739B2 (en) Parcel information reading system and method
JP3124296B2 (en) How to detect the position and direction of the fiducial mark
CN110276295B (en) Vehicle identification number detection and identification method and device
CN111597857B (en) Logistics package detection method, device, equipment and readable storage medium
CN111461133B (en) Express delivery surface single item name identification method, device, equipment and storage medium
CN111553355B (en) Monitoring video-based method for detecting and notifying store outgoing business and managing store owner
US20070069028A1 (en) System to improve reading performance and accuracy of single or two dimensional data codes in a large field of view
CN110659704A (en) Logistics express mail information identification system and method
CN113688965B (en) Automatic storage code scanning detection method and cargo management system
US11810064B2 (en) Method(s) and system(s) for vehicular cargo management
CN115880260A (en) Method, device and equipment for detecting base station construction and computer readable storage medium
CN114049575A (en) Intelligent detection method and system for contraband of security check machine and electronic equipment
CN115810132B (en) Crack orientation identification method, device, equipment and storage medium
CN111680680A (en) Object code positioning method and device, electronic equipment and storage medium
CN117237835A (en) Automatic shelf safety detection method and device based on yolov7
CN115240132A (en) Method and device for monitoring running state of conveyor belt and storage medium
CN112800798A (en) Positioning method of Aztec code
CN111401104B (en) Classification model training method, classification method, device, equipment and storage medium
CN112733730B (en) Oil extraction operation field smoke suction personnel identification processing method and system
US20170200383A1 (en) Automated review of forms through augmented reality
CN116109247A (en) Packing box checking method and system
CN117147564A (en) Product detection method and device and electronic equipment

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
TA01 Transfer of patent application right

Effective date of registration: 20220704

Address after: 410073 Hunan province Changsha Kaifu District, Deya Road No. 109

Applicant after: National University of Defense Technology

Address before: Room 1505, building 2, Xincheng Science Park, 588 Yuelu West Avenue, Changsha hi tech Development Zone, Hunan 410000

Applicant before: HUNAN SPEEDBOT ROBOT Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant