Truncated barcode recognition method, device and electronic equipment

By detecting the start character and terminator of the barcode on the rotating test tube, identifying and filtering the cut-off barcode, the incomplete information and error recognition problems caused by barcode truncation during rotation are solved, and the accuracy and efficiency of recognition are improved.

CN118917337BActive Publication Date: 2025-04-04HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411404145.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-04-04
Estimated Expiration
2044-10-08

AI Technical Summary

Technical Problem

During the rotation process, the barcode on the test tube may be cut off, resulting in incomplete barcode information, increasing the time-consuming decoding and may lead to incorrect recognition.

Method used

By preprocessing the reference barcode of the barcode identification area in the coded image, the corresponding start character area and terminator area are determined, and the start character and terminator detection are performed. If the reference barcode meets the truncated code determination condition, it is prohibited from decoding.

Benefits of technology

It effectively reduces the probability of truncated barcodes being sent to decode, reduces the situation of error recognition, and improves the accuracy and efficiency of barcode recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118917337B_ABST
    Figure CN118917337B_ABST
Patent Text Reader

Abstract

The present application provides a truncated barcode recognition method, device and electronic device. The present application determines the start character area and the end character area corresponding to the reference barcode based on the reference barcode included in the barcode recognition area in the coded image and the preset area length, and performs start character detection on the start character area and end character detection on the end character area. Further, when it is determined that the reference barcode meets the truncated code determination condition according to the detection result, the reference barcode is determined to be a truncated barcode, and decoding of the reference barcode is prohibited. Before the reference barcode is sent to decoding, the present application pre-identifies the reference barcode, filters out the reference barcode identified as a truncated barcode, reduces the probability of the truncated barcode being sent to decoding, and reduces the situation of incorrect recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition technology, and in particular to a method, device and electronic device for recognizing truncated barcodes. Background Art

[0002] In many application scenarios, one-dimensional barcodes are often used to store relevant information in the scenario. For example, in medical testing scenarios, barcodes pasted on test tubes are often used to record relevant information of the test tubes, such as the type, volume, concentration, etc. of the test substance. In this scenario, the test tube will rotate, and the barcode pasted on the test tube needs to be identified during the rotation. When the barcode is pasted at an angle, a truncated barcode will appear during the rotation of the test tube, that is, the barcode information is incomplete. In this case, directly decoding the truncated barcode will increase the time consumption of the decoding process and may cause incorrect recognition. Summary of the invention

[0003] In view of this, the present application provides a truncated barcode recognition method, device and electronic device to identify truncated barcodes and reduce the probability of truncated barcodes being sent for decoding.

[0004] The technical solutions provided by this application are as follows:

[0005] According to an embodiment of the first aspect of the present application, a truncated barcode recognition method is proposed, the method comprising:

[0006] For the obtained coded image, based on the reference barcode included in the barcode recognition area in the coded image and the preset area length, determine the start character area and the end character area corresponding to the reference barcode; the barcode recognition area refers to a preset designated area in the reference image for barcode recognition, and the coded image refers to a reference image in which the reference barcode is detected in the barcode recognition area;

[0007] Performing start character detection on the start character area, and performing end character detection on the end character area;

[0008] If it is determined according to the detection result that the reference barcode meets the truncated code determination condition, the reference barcode is determined to be a truncated barcode, and decoding of the reference barcode is prohibited;

[0009] Among them, the truncated code determination condition includes one or more of the following conditions: there is no start character in the start character area; there is no terminator in the terminator area; the start character in the start character area does not match the terminator in the terminator area; the start character in the start character area matches the terminator in the terminator area, but the number of bars and spaces in the reference barcode does not meet the encoding rules corresponding to the start character and the terminator, and the number of bars and spaces refers to the number of black bars and white spaces in the reference barcode.

[0010] Optionally, the determining, based on the reference barcode included in the barcode recognition area in the coded image and a preset area length, a start character area and an end character area corresponding to the reference barcode includes:

[0011] A barcode area corresponding to the area length is intercepted from the starting position of the reference barcode as a start character area, and a barcode area corresponding to the area length is intercepted in reverse from the ending position of the reference barcode as a terminator area.

[0012] Optionally, performing start character detection on the start character area includes:

[0013] Determine whether the barcode included from the starting position of the start character area to any position in the start character area is the same as the barcode corresponding to any reference start character in the obtained start character set;

[0014] If yes, it is determined that there is a start character in the start character area, and the start character included in the start character area is the reference start character;

[0015] Performing terminator detection on the terminator area includes:

[0016] Determine whether the barcode included from the end position of the terminator area to any position in the terminator area is the same as the barcode corresponding to any reference terminator in the obtained terminator set;

[0017] If so, it is determined that a terminator exists in the terminator area, and the terminator included in the terminator area is the reference terminator.

[0018] Optionally, the number of bar spaces of the reference barcode is determined by the following method:

[0019] Based on the obtained regression model, a regression estimation is performed on the number of black and white bars and spaces in the area to which the reference barcode belongs to obtain the number of bars and spaces of the reference barcode.

[0020] Optionally, before determining the start character area and the end character area corresponding to the reference barcode based on the preset area length and the reference barcode included in the barcode recognition area for the obtained coded image, the method further includes:

[0021] For the current frame image obtained, if it is found that the barcode recognition areas corresponding to the consecutive N frames of images including the current frame image all have reference barcodes, then the N frames of images are all regarded as coded images;

[0022] For each coded image, the step of determining the start character area and the end character area corresponding to the reference barcode based on the reference barcode included in the barcode recognition area in the coded image and a preset area length is performed for the obtained coded image.

[0023] Optionally, the method further comprises:

[0024] Screening out candidate images corresponding to reference barcodes that are not determined to be truncated barcodes from the N frames of images;

[0025] In the case where there are multiple candidate images, determining a target image corresponding to the reference barcode having the largest number of bars and spaces from the candidate images;

[0026] The reference barcode included in the target image is decoded to obtain a recognition result of the reference barcode.

[0027] Optionally, the method further includes:

[0028] If the candidate image does not exist in the N frames of images, decoding of the reference barcode included in the N frames of images is prohibited;

[0029] When the next image of the N frames is received, the next image is taken as the first image, and the current frame image obtained is returned. If it is found that reference barcodes exist in the barcode recognition areas corresponding to the consecutive N frames of images including the current frame image, the N frames of images are all taken as coded images.

[0030] According to an embodiment of the second aspect of the present application, a truncated barcode recognition device is provided, the device comprising:

[0031] a determination unit, for determining, for an acquired coded image, a start character region and a stop character region corresponding to the reference barcode based on a reference barcode included in a barcode recognition region in the coded image and a preset region length; the barcode recognition region refers to a preset designated region in the reference image for barcode recognition, and the coded image refers to a reference image in which a reference barcode is detected in the barcode recognition region;

[0032] A detection unit, configured to perform start character detection on the start character area and perform end character detection on the end character area;

[0033] an identification unit, configured to determine that the reference barcode is a truncated barcode and prohibit decoding of the reference barcode when it is determined according to the detection result that the reference barcode meets the truncated code determination condition;

[0034] Among them, the truncated code determination condition includes one or more of the following conditions: there is no start character in the start character area; there is no terminator in the terminator area; the start character in the start character area does not match the terminator in the terminator area; the start character in the start character area matches the terminator in the terminator area, but the number of bars and spaces in the reference barcode does not meet the encoding rules corresponding to the start character and the terminator, and the number of bars and spaces refers to the number of black bars and white spaces in the reference barcode.

[0035] Optionally, the determining unit is specifically configured to:

[0036] Starting from the starting position of the reference barcode, a barcode area corresponding to the area length is intercepted as a start character area, and starting from the ending position of the reference barcode, a barcode area corresponding to the area length is intercepted in reverse direction as a terminator area;

[0037] And / or, the detection unit is specifically used for:

[0038] Determine whether the barcode included from the starting position of the start character area to any position in the start character area is the same as the barcode corresponding to any reference start character in the obtained start character set;

[0039] If yes, it is determined that there is a start character in the start character area, and the start character included in the start character area is the reference start character;

[0040] The detection unit is specifically used for:

[0041] Determine whether the barcode included from the end position of the terminator area to any position in the terminator area is the same as the barcode corresponding to any reference terminator in the obtained terminator set;

[0042] If yes, it is determined that there is a terminator in the terminator area, and the terminator included in the terminator area is the reference terminator;

[0043] And / or, the number of bars and spaces of the reference barcode is determined by the following method:

[0044] Based on the obtained regression model, a regression estimation is performed on the number of black and white bars and spaces in the area to which the reference barcode belongs, so as to obtain the number of bars and spaces of the reference barcode;

[0045] And / or, before determining the start character area and the end character area corresponding to the reference barcode based on the preset area length and the reference barcode included in the barcode recognition area for the obtained coded image, the determining unit is further used to:

[0046] For the current frame image obtained, if it is found that the barcode recognition areas corresponding to the consecutive N frames of images including the current frame image all have reference barcodes, then the N frames of images are all regarded as coded images;

[0047] For each coded image, performing the step of determining the start character area and the end character area corresponding to the reference barcode based on the reference barcode included in the barcode recognition area in the coded image and the preset area length for the obtained coded image;

[0048] And / or, the identification unit is further used for:

[0049] Screening out candidate images corresponding to reference barcodes that are not determined to be truncated barcodes from the N frames of images;

[0050] In the case where there are multiple candidate images, determining a target image corresponding to the reference barcode having the largest number of bars and spaces from the candidate images;

[0051] Decoding the reference barcode included in the target image to obtain a recognition result of the reference barcode;

[0052] And / or, the identification unit is further used for:

[0053] If the candidate image does not exist in the N frames of images, decoding of the reference barcode included in the N frames of images is prohibited;

[0054] When the next image of the N frames is received, the next image is taken as the first image, and the current frame image obtained is returned. If it is found that reference barcodes exist in the barcode recognition areas corresponding to the consecutive N frames of images including the current frame image, the N frames of images are all taken as coded images.

[0055] According to an embodiment of the third aspect of the present application, an electronic device is proposed, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.

[0056] It can be seen from the above technical scheme that the present application determines the start character area and the end character area corresponding to the reference barcode based on the reference barcode included in the barcode recognition area in the coded image and the preset area length, and performs start character detection on the start character area and terminator detection on the terminator area. Further, when it is determined based on the detection result that the reference barcode meets the truncated code determination condition, the reference barcode is determined to be a truncated barcode, and decoding of the reference barcode is prohibited. Before sending the reference barcode to decoding, the present application pre-identifies the reference barcode and filters out the reference barcode identified as a truncated barcode, thereby reducing the probability of the truncated barcode being sent to decoding and reducing the possibility of erroneous identification. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0058] Figure 1 A schematic diagram of a truncated barcode scenario provided in an embodiment of the present application;

[0059] Figure 2 A flowchart of a truncated barcode recognition method provided in an embodiment of the present application;

[0060] Figure 3 A flowchart of determining a truncated barcode through the start and end character areas provided in an embodiment of the present application;

[0061] Figure 4 A flow chart of determining a truncated barcode by the number of spaces provided in an embodiment of the present application;

[0062] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0063] Figure 6 A structural diagram of a truncated barcode recognition device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0064] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.

[0065] One-dimensional barcodes are widely used in product identification and various information systems because of their ability to represent large amounts of information reliably and at low cost.

[0066] For example, a barcode attached to a test tube may be used to record relevant information of the test tube, such as the type, volume, concentration, and other information of the test substance.

[0067] Please refer to Figure 1 , Figure 1 A schematic diagram of a truncated barcode scenario provided in an embodiment of the present application.

[0068] like Figure 1 As shown in the figure, in the actual scenario, the test tube will rotate. At this time, the barcode pasted on the test tube needs to be identified during the rotation process. When the barcode is pasted at an angle, a truncated barcode will appear during the rotation of the test tube, such as Figure 1 The partial barcode shown in FIG. 1 indicates that the barcode information is incomplete. In this case, decoding the truncated barcode will increase the time consumption of the decoding process and may cause erroneous recognition.

[0069] Based on this, the present application proposes a truncated barcode recognition method to identify truncated barcodes and reduce the probability of truncated barcodes being sent for decoding.

[0070] Please refer to Figure 2 , Figure 2 A flowchart of a truncated barcode recognition method provided in an embodiment of the present application.

[0071] In an embodiment of the present application, the method can be applied to a processor of an electronic device.

[0072] like Figure 2 As shown, the method may include the following steps:

[0073] Step 201 : for the obtained coded image, based on the reference barcode included in the barcode recognition area in the coded image and a preset area length, determine the start character area and the end character area corresponding to the reference barcode.

[0074] In the embodiment of the present application, the barcode recognition area refers to a designated area preset in the reference image for barcode recognition, and the coded image refers to a reference image in which a reference barcode is detected in the barcode recognition area.

[0075] Exemplarily, a stored code-presence classification model can be used to identify whether there is a reference barcode in the barcode recognition area of ​​the captured reference image to determine whether the reference image is a coded image, which is not limited in the present application.

[0076] In the embodiment of the present application, the region length is a pre-configured length, which can ensure that the length of the intercepted start character region and the end character region is not less than the maximum length of the start character and the end character.

[0077] In the embodiment of the present application, normal untruncated barcodes include a start character, a terminator, and a data area, wherein the start character is located at the starting position of the barcode, used to indicate the starting position of the data recorded by the barcode; the terminator is located at the ending position of the barcode, used to indicate the ending position of the data recorded by the barcode; the data area, i.e., the area between the start character and the terminator, is used to record the data to be stored.

[0078] In the embodiment of the present application, for each reference barcode included in the coded image, the start character area and the end character area corresponding to the reference barcode can be determined according to the preset area length. If the reference barcode has a start character, the start character area is an area that can include the start character of the reference barcode; if the reference barcode includes a end character, the end character area is an area that can include the end character of the reference barcode.

[0079] Exemplarily, before determining the start character area and the terminator area corresponding to the reference barcode, the reference barcode included in the acquired coded image can be normalized, and the reference barcodes of various code systems included in each coded image can be uniformly scaled to the same ratio. Further, based on the length of the start character and the terminator corresponding to each coding rule, the longest length of the corresponding start character and terminator in all coding rules is selected as the area length to ensure that the start character area and the terminator area extracted according to the area length can include all types of start characters and terminators, and all start characters and terminators can be recognized normally.

[0080] Exemplarily, based on the reference barcode included in the barcode recognition area in the coded image and the preset area length, the method for determining the start character area and the end character area corresponding to the reference barcode may include:

[0081] A barcode area corresponding to the area length is cut from the starting position of the reference barcode as the start character area, and a barcode area corresponding to the area length is cut in reverse from the ending position of the reference barcode as the end character area.

[0082] After the start character region and the end character region are determined, the description of step 201 ends and step 202 is executed next.

[0083] Step 202: Perform start character detection on the start character area, and perform end character detection on the end character area.

[0084] In the embodiment of the present application, for each reference barcode included in the coded image, the start character area and the end character area corresponding to the reference barcode may be detected.

[0085] Exemplarily, a specific method for performing start character detection on a start character area may include:

[0086] Determine whether the barcode included from the starting position of the start character area to any position in the start character area is the same as the barcode corresponding to any reference start character in the obtained start character set;

[0087] If yes, it is determined that there is a start character in the start character area, and the start character included in the start character area is the reference start character;

[0088] The specific method for performing terminator detection on the terminator area may include:

[0089] Determine whether the barcode included from the end position of the terminator area to any position in the terminator area is the same as the barcode corresponding to any reference terminator in the obtained terminator set;

[0090] If so, it is determined that a terminator exists in the terminator area, and the terminator included in the terminator area is the reference terminator.

[0091] In the embodiment of the present application, since the lengths of the start character and the terminator corresponding to different encoding rules are different, and the lengths of the start character area and the terminator area are set according to the preset area length, that is, the longest length of the start character and the terminator in each encoding rule, the start character included in the start character area can actually start from the starting position of the start character area and end at any position in the start character area; the terminator included in the terminator area can actually start from the ending position of the terminator area and end at any position in the terminator area.

[0092] It can be seen that the start symbol included in the obtained start symbol set can be compared with the start position of the start symbol area corresponding to the reference barcode to determine whether the start symbol is included in the start symbol area corresponding to the reference barcode.

[0093] It should be noted that for the terminator region, the terminators included in the obtained terminator set need to be compared from the end position of the terminator region to the front, that is, the end position of the terminator included in the terminator set is compared with the end position of the terminator region.

[0094] After performing start character detection on the start character area and performing end character detection on the end character area, a final detection result can be obtained.

[0095] At this point, the description of step 202 ends, and step 203 is executed next.

[0096] Step 203: When it is determined according to the detection result that the reference barcode meets the truncated code determination condition, the reference barcode is determined to be a truncated barcode, and decoding of the reference barcode is prohibited.

[0097] In the embodiment of the present application, it is possible to determine whether the reference barcode satisfies the truncated code determination condition based on the detection result obtained in step 202. When it is determined that the reference barcode satisfies the truncated code determination condition, the reference barcode is considered to be an incomplete barcode, i.e., a truncated barcode, and the reference barcode is prohibited from being sent to decoding, and the reference barcode can be directly discarded.

[0098] Illustratively, there are multiple conditions that can determine that a reference barcode is a truncated barcode, which are described below respectively.

[0099] First, there is no start character in the start character area and / or there is no end character in the end character area.

[0100] In the embodiment of the present application, a normal barcode that has not been truncated includes a start character, an end character, and a data area. If it is detected that the reference barcode does not have a start character or an end character at all, it indicates that the reference barcode must be an incomplete barcode, that is, a truncated barcode.

[0101] In an embodiment of the present application, if the starting position is determined to be the starting position of the start character area, and the barcode at the end position in the start character area is the same as the barcode corresponding to any reference start character, it indicates that there is a start character in the start character area, and the start character is the above-mentioned reference start character.

[0102] If the end position is determined to be the end position of the terminator area, and the barcode at the start position in the terminator area is the same as the barcode corresponding to any reference terminator, it indicates that there is a terminator in the terminator area, and the terminator is the reference terminator.

[0103] Second, the start character in the start character area does not match the end character in the end character area.

[0104] In the embodiment of the present application, if it is determined that the reference barcode has a start character and a terminator, it is further necessary to determine whether the start character matches the terminator, that is, whether the terminator is the terminator corresponding to the start character. If it is determined that the start character does not match the terminator, it indicates that the reference barcode is not a normal barcode either, and the reference barcode can be determined as a truncated barcode.

[0105] Please refer to Figure 3 , Figure 3 A flowchart of a truncated barcode recognition method provided in an embodiment of the present application.

[0106] like Figure 3 As shown, the start character area and the end character area are intercepted in the area corresponding to the reference bar code, and it is determined whether there is a start character in the start character area and whether there is a end character in the end character area.

[0107] If there is no start character in the start character area and / or no terminator in the terminator area, the reference barcode is directly determined to be a truncated barcode; if there is a start character in the start character area and there is a terminator in the terminator area, it is determined whether the start character and the terminator match, if not, the reference barcode is determined to be a truncated barcode.

[0108] Exemplarily, a method for determining whether the start character matches the end character may include:

[0109] Determine the encoding rule corresponding to the start character based on the obtained start character, and further search for the end character corresponding to the start character under the encoding rule. If the end character corresponding to the start character under the encoding rule is different from the end character obtained in the end character area corresponding to the reference barcode, it is determined that the start character and the end character do not match.

[0110] Similarly, the encoding rule corresponding to the terminator may be determined according to the obtained terminator, and whether the start character matches the terminator may be further determined, which will not be described in detail here.

[0111] Third, the start character in the start character area matches the terminator in the terminator area, but the number of bar spaces in the reference barcode does not satisfy the encoding rule corresponding to the start character and the terminator.

[0112] In the embodiment of the present application, after determining that the start character matches the end character, it is also possible to further determine whether the number of bars and spaces of the reference barcode meets the encoding rules corresponding to the start character and the end character. The number of black bars and white spaces of a normal barcode must meet the barcode encoding rules corresponding to the start character and the end character, that is, the encoding rules of the entire barcode are unified.

[0113] In the embodiment of the present application, the number of bars and spaces of the reference barcode may be detected. If the number of spaces corresponding to the start character and the end character is not satisfied, the reference barcode is considered to be a truncated barcode.

[0114] Exemplarily, the number of black and white bars and spaces in the area to which the reference barcode belongs can be regressed and estimated based on the obtained regression model to obtain the number of bars and spaces of the reference barcode, and the encoding rule corresponding to the start character and the end character can be determined according to the obtained start character and the end character; further determine whether the number of bars and spaces of the reference barcode is the same as the corresponding number of bars and spaces under the encoding rule; if not, it is determined that the number of bars and spaces of the reference barcode does not satisfy the encoding rule corresponding to the start character and the end character.

[0115] Please refer to Figure 4 , Figure 4 A flow chart of determining a truncated barcode by the number of spaces provided in an embodiment of the present application.

[0116] like Figure 4 As shown, after the number of black and white bars and spaces in the area to which the reference barcode belongs is regressed and estimated by the regression model to obtain the number of bars and spaces of the reference barcode, the number of bars and spaces can be compared with the number specified by the encoding rules. If the encoding rules are not met, the reference barcode is determined to be a truncated barcode.

[0117] In the embodiment of the present application, after determining that the reference barcode is a truncated barcode, decoding of the reference barcode may be prohibited to reduce decoding time and improve efficiency.

[0118] In the embodiment of the present application, the above method detects truncated barcodes of the reference barcode in the image through a single-frame image. Although this method can detect truncated barcodes that are incomplete or do not conform to the barcode encoding rules, it cannot remove truncated barcodes that have been formed complete and conform to the barcode rules (for example, the reference barcode is a truncated barcode, but the truncated barcode happens to include matching start and end characters, and the number of spaces also conforms to the encoding rules corresponding to the start and end characters). In this case, it is necessary to combine the barcode conditions corresponding to multiple frames of images for screening and judgment.

[0119] The idea of ​​multi-frame judgment is that although the truncated code forms a complete barcode, the number of bars and spaces will change during the rotation process. Only in the case of a truly complete barcode will the number of bars and spaces remain unchanged and be the largest. Continuous multi-frame coded images can be detected to determine whether there are truncated barcodes in the continuous multi-frame coded images.

[0120] In the embodiment of the present application, before determining the start character area and the end character area corresponding to the reference barcode based on the preset area length and the reference barcode included in the barcode recognition area for the obtained coded image, the method may further include:

[0121] For the current frame image obtained, if it is found that the barcode recognition areas corresponding to the consecutive N frames of images including the current frame image all have reference barcodes, then the N frames of images are all regarded as coded images;

[0122] For each coded image, a step of determining a start character area and a stop character area corresponding to a reference barcode based on a reference barcode included in a barcode recognition area in the coded image and a preset area length is performed for the obtained coded image.

[0123] Exemplarily, the method proposed in the embodiment of the present application may further include:

[0124] Select candidate images corresponding to reference barcodes that are not determined to be truncated barcodes from N frames of images;

[0125] In the case of multiple candidate images, a target image corresponding to the reference barcode with the largest number of bars and spaces is determined from the candidate images;

[0126] The reference barcode included in the target image is decoded to obtain a recognition result of the reference barcode.

[0127] In an embodiment of the present application, the above-mentioned detection process for coded images can be performed on N consecutive frames of coded images to screen out images that pass single-frame judgment in the N frames (i.e., candidate images corresponding to reference barcodes that have not been determined as truncated barcodes in the N frames), and based on the number of bar spaces in the reference barcode in each candidate image, the candidate barcode with the largest number of bar spaces is screened out as the target barcode; if the number of bar spaces in the reference barcodes in M ​​frames is the same and the largest number, then all the reference barcodes in the M frames are used as target barcodes, and all of these target barcodes are sent to decoding.

[0128] Exemplarily, candidate images corresponding to reference barcodes that are not determined to be truncated barcodes may also be screened out from the N frames of images;

[0129] All candidate images are sent to decoding, and the candidate image with the longest decoding result is used as the target image, and the decoding result of the target image is used as the recognition result of the reference barcode.

[0130] In the embodiment of the present application, since the reference barcode in the coded image that has not been determined as a truncated barcode is usually a barcode that can be decoded, the candidate image corresponding to the reference barcode in the coded image that has not been determined as a truncated barcode can also be decoded first. Since the more bars and spaces there are, the longer the decoding result is, the candidate image with the longest decoding result can be directly determined as the target image, and the decoding result of the target image can be used as the recognition result of the reference barcode.

[0131] In the embodiment of the present application, the method may further include:

[0132] If there is no candidate image in the N frames of images, decoding of the reference barcodes included in the N frames of images is prohibited;

[0133] When the next image of N frames is received, the next image is taken as the first image, and the current frame image is returned. If it is found that reference barcodes exist in the barcode recognition areas corresponding to the consecutive N frames including the current frame image, the N frames are taken as coded images.

[0134] In the embodiment of the present application, if the N frames of images obtained do not contain a complete information barcode, that is, the reference barcodes included in the N frames of images are all determined to be truncated barcodes, it indicates that there is no normal barcode in the N frames of images. In this case, it is prohibited to decode the reference barcode included in any image in the N frames of images, and the N frames of images are discarded, and the next image obtained is used as the first image, and the current frame image is obtained again. If it is found that the barcode recognition area corresponding to the continuous N frames of images including the current frame image contains reference barcodes, then the N frames of images are all taken as coded images, and the next N continuous frames of coded images are obtained for judgment.

[0135] This concludes Figure 2 Description of the process of truncated barcode recognition method.

[0136] The present application determines the start character area and the end character area corresponding to the reference barcode based on the reference barcode included in the barcode recognition area in the coded image and the preset area length, and performs start character detection on the start character area and end character detection on the end character area. Further, when it is determined based on the detection result that the reference barcode meets the truncated code determination condition, the reference barcode is determined to be a truncated barcode, and decoding of the reference barcode is prohibited. Before sending the reference barcode to decoding, the present application pre-identifies the reference barcode and filters out the reference barcode identified as a truncated barcode, thereby reducing the probability of the truncated barcode being sent to decoding and reducing the possibility of erroneous identification.

[0137] Furthermore, the present application also proposes a truncated code screening scheme that uses a multi-frame judgment method to form a complete barcode after truncation. The reference barcode with the largest number of bar spaces is determined by the number of bar spaces in the reference barcode included in multiple consecutive frames of coded images, and is sent to decoding as the target barcode. This can further improve the reading and recognition rate of rotated and beveled barcodes, reduce the misrecognition rate, and exit the decoding process early for truncated barcodes, thereby improving processing efficiency.

[0138] Please refer to Figure 5 , Figure 5 It is a schematic structural diagram of an electronic device proposed in an embodiment of the present application. At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and of course may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a terminal interaction device at the logical level. Of course, in addition to the software implementation method, this application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0139] Please refer to Figure 6 , Figure 6 1 is a structural diagram of a truncated barcode recognition device proposed in an embodiment of the present application. Figure 6 As shown, the truncated barcode recognition device may include a determination unit 601, a detection unit 602, and a recognition unit 603. Specifically, the device includes:

[0140] The determining unit 601 is used to determine the start character area and the end character area corresponding to the reference barcode based on the reference barcode included in the barcode recognition area in the coded image and the preset area length for the obtained coded image; the barcode recognition area refers to a preset designated area in the reference image for barcode recognition, and the coded image refers to a reference image in which the reference barcode is detected in the barcode recognition area;

[0141] A detection unit 602, configured to perform start character detection on the start character region and perform end character detection on the end character region;

[0142] The identification unit 603 is used to determine that the reference barcode is a truncated barcode and prohibit decoding of the reference barcode when it is determined according to the detection result that the reference barcode meets the truncated code determination condition;

[0143] Among them, the truncated code determination conditions include one or more of the following conditions: there is no start character in the start character area; there is no terminator in the terminator area; the start character in the start character area does not match the terminator in the terminator area; the start character in the start character area matches the terminator in the terminator area, but the number of bars and spaces in the reference barcode does not meet the encoding rules corresponding to the start character and the terminator, and the number of bars and spaces refers to the number of black bars and white spaces in the reference barcode.

[0144] Optionally, the determining unit 601 is specifically configured to:

[0145] A barcode area corresponding to the area length is cut from the starting position of the reference barcode as the start character area, and a barcode area corresponding to the area length is cut in the reverse direction from the ending position of the reference barcode as the end character area;

[0146] And / or, the detection unit 602 is specifically used for:

[0147] Determine whether the barcode included from the starting position of the start character area to any position in the start character area is the same as the barcode corresponding to any reference start character in the obtained start character set;

[0148] If yes, it is determined that there is a start character in the start character area, and the start character included in the start character area is the reference start character;

[0149] The detection unit 602 is specifically used for:

[0150] Determine whether the barcode included from the end position of the terminator area to any position in the terminator area is the same as the barcode corresponding to any reference terminator in the obtained terminator set;

[0151] If yes, it is determined that there is a terminator in the terminator area, and the terminator included in the terminator area is the reference terminator;

[0152] And / or, the number of bar spaces of the reference barcode is determined by:

[0153] Based on the obtained regression model, the number of black and white bars and spaces in the area to which the reference barcode belongs is regressed and estimated to obtain the number of bars and spaces in the reference barcode;

[0154] And / or, before determining the start character area and the end character area corresponding to the reference barcode based on the preset area length and the reference barcode included in the barcode recognition area for the obtained coded image, the determining unit 601 is further used to:

[0155] For the current frame image obtained, if it is found that the barcode recognition areas corresponding to the consecutive N frames of images including the current frame image all have reference barcodes, then the N frames of images are all regarded as coded images;

[0156] For each coded image, a step of determining a start character area and a stop character area corresponding to the reference barcode based on the reference barcode included in the barcode recognition area in the coded image and a preset area length is performed for the obtained coded image;

[0157] And / or, the identification unit 603 is further configured to:

[0158] Select candidate images corresponding to reference barcodes that are not determined to be truncated barcodes from N frames of images;

[0159] In the case of multiple candidate images, determining the target image corresponding to the reference barcode with the largest number of bars and spaces from the candidate images;

[0160] Decoding the reference barcode included in the target image to obtain a recognition result of the reference barcode;

[0161] And / or, the identification unit 603 is further configured to:

[0162] If there is no candidate image in the N frames of images, decoding of the reference barcodes included in the N frames of images is prohibited;

[0163] When the next image of N frames is received, the next image is taken as the first image, and the current frame image is returned. If it is found that reference barcodes exist in the barcode recognition areas corresponding to the consecutive N frames including the current frame image, the N frames are taken as coded images.

[0164] So far, completed Figure 6 The description of the barcode recognition device is truncated in the middle.

[0165] Correspondingly, in the embodiments of the present application, the embodiments of the present application also provide a computer-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed, the method disclosed in the above example of the present application can be implemented.

[0166] Exemplarily, the computer-readable storage medium may be any electronic, magnetic, optical or other physical storage device that may contain or store information, such as executable instructions, data, etc. For example, the computer-readable storage medium may be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.

[0167] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of protection of the present application.

Claims

1. A truncated barcode recognition method, characterized in that: The method includes: For each coded image obtained, based on the reference barcode included in the barcode recognition area in the coded image and the preset area length, determine the start character area and the end character area corresponding to the reference barcode; the barcode recognition area refers to a preset designated area in the reference image for barcode recognition, and the coded image refers to a reference image in which the reference barcode is detected in the barcode recognition area; Performing start character detection on the start character area, and performing end character detection on the end character area; If it is determined according to the detection result that the reference barcode meets the truncated code determination condition, the reference barcode is determined to be a truncated barcode, and decoding of the reference barcode is prohibited; the truncated barcode refers to a barcode with incomplete barcode information; The truncated code determination condition includes one or more of the following conditions: there is no start character in the start character area; there is no terminator in the terminator area; the start character in the start character area does not match the terminator in the terminator area; the start character in the start character area matches the terminator in the terminator area, but the number of bars and spaces in the reference bar code does not meet the encoding rule corresponding to the start character and the terminator, and the number of bars and spaces refers to the number of black bars and white spaces in the reference bar code; Screening out candidate images from the obtained N consecutive frames of coded images, wherein the reference barcode included in the candidate images is not determined to be the truncated barcode; In the case that there are multiple candidate images, determining a target image from the multiple candidate images, wherein the number of bars and spaces of the reference barcode included in the target image is greater than the number of bars and spaces of the reference barcode included in other candidate images; The reference barcode included in the target image is decoded to obtain a recognition result of the reference barcode.

2. The method according to claim 1, characterized in that The determining, based on the reference barcode included in the barcode recognition area in the coded image and the preset area length, of the start character area and the end character area corresponding to the reference barcode comprises: A barcode area corresponding to the area length is intercepted from the starting position of the reference barcode as a start character area, and a barcode area corresponding to the area length is intercepted in reverse from the ending position of the reference barcode as a terminator area.

3. The method according to claim 2, characterized in that Performing start character detection on the start character area includes: Determine whether the barcode included from the starting position of the start character area to any position in the start character area is the same as the barcode corresponding to any reference start character in the obtained start character set; If yes, it is determined that there is a start character in the start character area, and the start character included in the start character area is the reference start character; Performing terminator detection on the terminator area includes: Determine whether the barcode included from the end position of the terminator area to any position in the terminator area is the same as the barcode corresponding to any reference terminator in the obtained terminator set; If so, it is determined that a terminator exists in the terminator area, and the terminator included in the terminator area is the reference terminator.

4. The method according to claim 1, characterized in that: The number of bars and spaces of the reference barcode is determined by the following method: Based on the obtained regression model, a regression estimation is performed on the number of black and white bars and spaces in the area to which the reference barcode belongs to obtain the number of bars and spaces of the reference barcode.

5. The method according to claim 1, characterized in that Before determining the start character area and the end character area corresponding to the reference barcode based on the preset area length and the reference barcode included in the barcode recognition area for each obtained coded image, the method further includes: For the current frame image obtained, if it is found that reference barcodes exist in the barcode recognition areas corresponding to the continuous N frame images including the current frame image, the N frame images are all regarded as coded images.

6. The method according to claim 5, characterized in that The method further includes: If the candidate image does not exist in the consecutive N frames of coded images, decoding of the reference barcode included in the consecutive N frames of coded images is prohibited; When the next image of the continuous N frames of coded images is received, the next image is taken as the first image, and the current frame image obtained is returned. If it is found that reference barcodes exist in the barcode recognition areas corresponding to the continuous N frames of images including the current frame image, the N frames of images are all taken as coded images.

7. A truncated barcode recognition device, characterized in that: The device includes: a determination unit, for determining, for each coded image obtained, a start character region and a stop character region corresponding to the reference barcode based on a reference barcode included in a barcode recognition region in the coded image and a preset region length; the barcode recognition region refers to a designated region preset in the reference image for barcode recognition, and the coded image refers to a reference image in which a reference barcode is detected in the barcode recognition region; A detection unit, configured to perform start character detection on the start character area and perform end character detection on the end character area; an identification unit, configured to determine that the reference barcode is a truncated barcode and prohibit decoding of the reference barcode when it is determined according to the detection result that the reference barcode meets the truncated code determination condition; the truncated barcode refers to a barcode with incomplete barcode information; The truncated code determination condition includes one or more of the following conditions: there is no start character in the start character area; there is no terminator in the terminator area; the start character in the start character area does not match the terminator in the terminator area; the start character in the start character area matches the terminator in the terminator area, but the number of bars and spaces in the reference bar code does not meet the encoding rule corresponding to the start character and the terminator, and the number of bars and spaces refers to the number of black bars and white spaces in the reference bar code; Screening out candidate images from the obtained N consecutive frames of coded images, wherein the reference barcode included in the candidate images is not determined to be the truncated barcode; In the case that there are multiple candidate images, determining a target image from the multiple candidate images, wherein the number of bars and spaces of the reference barcode included in the target image is greater than the number of bars and spaces of the reference barcode included in other candidate images; The reference barcode included in the target image is decoded to obtain a recognition result of the reference barcode.

8. The device according to claim 7, characterized in that The determining unit is specifically used for: Starting from the starting position of the reference barcode, a barcode area corresponding to the area length is intercepted as a start character area, and starting from the ending position of the reference barcode, a barcode area corresponding to the area length is intercepted in reverse direction as a terminator area; And / or, the detection unit is specifically used for: Determine whether the barcode included from the starting position of the start character area to any position in the start character area is the same as the barcode corresponding to any reference start character in the obtained start character set; If yes, it is determined that there is a start character in the start character area, and the start character included in the start character area is the reference start character; The detection unit is specifically used for: Determine whether the barcode included from the end position of the terminator area to any position in the terminator area is the same as the barcode corresponding to any reference terminator in the obtained terminator set; If yes, it is determined that there is a terminator in the terminator area, and the terminator included in the terminator area is the reference terminator; And / or, the number of bars and spaces of the reference barcode is determined by the following method: Based on the obtained regression model, a regression estimation is performed on the number of black and white bars and spaces in the area to which the reference barcode belongs, so as to obtain the number of bars and spaces of the reference barcode; And / or, before determining the start character area and the end character area corresponding to the reference barcode based on the preset area length and the reference barcode included in the barcode recognition area for each coded image obtained, the determining unit is further used to: For the current frame image obtained, if it is found that the barcode recognition areas corresponding to the consecutive N frames of images including the current frame image all have reference barcodes, then the N frames of images are all regarded as coded images; And / or, the identification unit is further used for: If the candidate image does not exist in the consecutive N frames of coded images, decoding of the reference barcode included in the consecutive N frames of coded images is prohibited; When the next image of the continuous N frames of coded images is received, the next image is taken as the first image, and the current frame image obtained is returned. If it is found that reference barcodes exist in the barcode recognition areas corresponding to the continuous N frames of images including the current frame image, the N frames of images are all taken as coded images.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Evaluation method and device for decoding result of bar code and electronic equipment

    CN110874538A

  • Image recognition method and device, storage medium and program product

    CN115496084A