Card, barcode recognition method and apparatus, electronic device, and storage medium
By printing barcodes on hard plastic cards and using the method of using the interval block and data block threshold detection area, the sampling values are dynamically obtained, which solves the problem of insufficient wear resistance of paper cards, and achieves higher recognition accuracy and card service life.
Patent Information
- Application Number
- PCT/CN2024/137359
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-25
- Filing Date
- 2024-12-06
- Publication Date
- 2025-07-31
AI Technical Summary
The wear resistance and service life of paper cards are insufficient, resulting in easy wear of coded information, affecting the identification accuracy of card reading equipment.
The barcode is printed on hard plastic cards, and the sampling values are dynamically obtained, barcode encoding is identified, material impact is reduced, and identification is improved through the method of interval block threshold detection area, data block threshold detection area and data area.
It improves the service life of the card and the accuracy of the identification results, reduces the impact of the material on the identification results, and ensures the integrity of the data area by verifying the number of interval blocks.
Smart Images

Figure CN2024137359_31072025_PF_FP_ABST
Abstract
Description
Card and barcode identification method, device, electronic device and storage medium Cross-references
[0001] This disclosure claims priority to Chinese patent application No. 202410103550.X filed on January 25, 2024, entitled “A card and barcode identification method, device, electronic device and storage medium”. The entire contents of this Chinese patent application are incorporated herein by reference. Technical Field
[0002] The present invention relates to the field of information processing technology, and in particular to a card, a barcode recognition method, a device, an electronic device, a storage medium, and a computer program product. Background Art
[0003] Card readers are used to identify cards and transmit data. For example, they can retrieve the data carried by a card and output it to a processor or other computing control device for further processing. Some card readers can identify cards that transmit data through power, inductive recognition, or other methods. Examples of such cards include TF cards, SD cards, metal cards, or chip cards. Some card readers, such as children's learning machines, also have the ability to perform non-electrical identification of inserted cards. Non-electrical identification refers to the identification of coded information on a card without current flowing through it. In related technologies, non-electrical identification typically involves scanning the area on the card containing coded information, such as a barcode or QR code, through radio frequency reflection to obtain the information within the card. Because the cards used for non-electrical identification do not require built-in metal nodes or chips, they are primarily paper cards printed with coded information, such as barcodes and QR codes. These cards are lightweight and inexpensive.
[0004] However, paper cards have limited strength and wear resistance. For devices that support multiple insertions and removals of the same card, the lifespan of paper cards is relatively short. Over time, the coded information on the card is likely to wear away, resulting in card reader errors. To address this issue, some embodiments of this specification provide a rigid plastic card with a printed barcode, as well as a barcode recognition method, device, electronic device, and storage medium. Summary of the Invention
[0005] Some embodiments of this specification aim to provide a hard, wear-resistant card with a printed barcode, which increases the card's service life to a certain extent. Some embodiments of this specification also provide a barcode recognition method, device, electronic device, and storage medium capable of performing non-electrical recognition of barcodes on cards, thereby reducing the impact of card and barcode material on recognition results and improving the accuracy of recognition results.
[0006] One or more embodiments of the present specification propose a barcode recognition method, wherein the barcode includes an interval block threshold detection area, a data block threshold detection area, and a data area, wherein the interval block threshold detection area is used to set the interval block threshold, and the interval block threshold represents the value range of the sampling value corresponding to the interval block; the data block threshold detection area is used to set the data block threshold, and the data block threshold represents the value range of the sampling value corresponding to the data block; the data area includes one or more data blocks and one or more interval blocks arranged in a certain order, and the interval blocks in the data area are used to separate adjacent data blocks; the method includes: obtaining a data waveform; the data waveform is based on a reading device The barcode is sampled at a preset sampling frequency to obtain a waveform with the sampling point number as the horizontal coordinate and the sampling value as the vertical coordinate; based on the sampling value corresponding to the interval block threshold detection area in the data waveform, the interval block threshold is obtained and recorded; based on the sampling value corresponding to the data block threshold detection area in the data waveform, the data block threshold is obtained and recorded; according to the interval block threshold and the data block threshold, the code value corresponding to the one or more data blocks and the number of the interval blocks are identified from the sampling value corresponding to the data area in the data waveform; when the number of the interval blocks reaches a preset number, the code corresponding to the barcode is determined according to the code value corresponding to the one or more data blocks.
[0007] According to the barcode recognition method shown in some embodiments of the present specification, the interval block threshold detection area, the data block threshold detection area and the data area are arranged in sequence according to the reading order of the reading device; the obtaining and recording of the interval block threshold based on the sampling value corresponding to the interval block threshold detection area in the data waveform includes: when a fluctuation of the sampling value of the data waveform is detected, the obtaining and recording of the interval block threshold based on the sampling value; the obtaining and recording of the data block threshold based on the sampling value corresponding to the data block threshold detection area in the data waveform includes: when it is detected that the sampling value of the data waveform exceeds the interval block threshold, the obtaining and recording of the data block threshold based on the sampling value; the identifying of the code values corresponding to the one or more data blocks and the number of the interval blocks from the sampling values corresponding to the data area in the data waveform according to the interval block threshold and the data block threshold includes: when the sampling value of the data waveform reaches the interval block threshold for the second time, identifying the code values corresponding to the one or more data blocks and the number of the interval blocks according to the sampling value, the interval block threshold and the data block threshold.
[0008] According to the barcode recognition method shown in some embodiments of this specification, when the sampling value of the data waveform exceeds an initial threshold value, it is determined that a fluctuation in the sampling value of the data waveform is detected; wherein the initial threshold value is a value range of the sampling value counted before the barcode enters the reading area of the reading device.
[0009] According to the barcode recognition method shown in some embodiments of the present specification, the code values corresponding to the one or more data blocks and the number of the interval blocks are identified from the sampling values corresponding to the data area in the data waveform according to the interval block threshold and the data block threshold, including: identifying the interval blocks from the sampling values corresponding to the data area in the data waveform according to the interval block threshold, and obtaining the number of the interval blocks; identifying the data blocks from the sampling values corresponding to the data area in the data waveform according to the data block threshold, and determining the code values corresponding to the data blocks.
[0010] According to the barcode recognition method shown in some embodiments of the present specification, the code values corresponding to the one or more data blocks and the number of the interval blocks are identified from the sampling values corresponding to the data area in the data waveform based on the interval block threshold and the data block threshold, including: determining a peak or a trough based on a changing trend of the sampling values corresponding to the data area in the data waveform; and determining the data block sampling value corresponding to the peak or the trough as the sampling value corresponding to the interval block in the data area.
[0011] According to the barcode recognition method shown in some embodiments of the present specification, the code values corresponding to the one or more data blocks and the number of the interval blocks are identified from the sampling values corresponding to the data area in the data waveform according to the interval block threshold and the data block threshold, including: determining a trough or a peak according to a change trend of the sampling values corresponding to the data area in the data waveform; judging whether the sampling value corresponding to the trough or the peak exceeds the data block threshold; when the sampling value corresponding to the trough or the peak exceeds the data block threshold, determining the data block sampling value corresponding to the trough or the peak as the sampling value corresponding to the first type of data block; when the sampling value corresponding to the trough or the peak does not exceed the data block threshold, determining the data block sampling value corresponding to the trough or the peak as the sampling value corresponding to the second type of data block; wherein, the first type of data block corresponds to a first code value, and the second type of data block corresponds to a second code value.
[0012] According to the barcode recognition method shown in some embodiments of the present specification, the barcode also includes a reading completion detection area, and the reading completion detection area includes an interval block arranged after the data area according to the reading order; the method also includes, after the number of the interval blocks reaches the preset number, before determining the encoding corresponding to the barcode according to the code values corresponding to the one or more data blocks: judging whether the sampling value reaches the interval block threshold again; when the sampling value reaches the interval block threshold again, turning to the step of determining the encoding corresponding to the barcode according to the code values corresponding to the one or more data blocks; when the sampling value does not reach the interval block threshold again, generating a reading abnormality prompt message.
[0013] According to the barcode recognition method shown in some embodiments of the present specification, the reading device has a reading area. When the reading device samples from the reading area, the interval block threshold detection area, the data block threshold detection area, the data area and the reading completion detection area on the barcode pass through the reading area in sequence. In the direction of entering the reading area, the length of the interval block of the reading completion detection area is greater than the length of the interval block of the data area; the judgment of whether the sampling value reaches the interval block threshold again includes: when the sampling value reaches the interval block threshold, according to the data waveform, the continuous time length of the sampling value reaching the interval block threshold is obtained to obtain a first time length; comparing the first time length with the second time length; wherein the second time length is the continuous time length of the sampling value in the data area reaching the interval block threshold calculated according to the data waveform; when the first time length is greater than the second time length, it is determined that the sampling value has reached the interval block threshold again; when the first time length is not greater than the second time length, it is determined that the sampling value has not reached the interval block threshold again.
[0014] According to the barcode recognition method shown in some embodiments of this specification, the data waveform is obtained by preprocessing the waveform obtained by sampling the barcode by a reading device at a preset sampling frequency, with the sampling point number as the horizontal axis and the sampling value as the vertical axis.
[0015] According to the barcode recognition method shown in some embodiments of this specification, the preprocessing includes: extracting a number of sampling values from the waveform in sequence in a sliding window manner; calculating the average of the sampling values extracted each time, and using the average as the sampling value in the data waveform.
[0016] One or more embodiments of the present specification propose a barcode recognition device, wherein the barcode includes an interval block threshold detection area, a data block threshold detection area and a data area, wherein the interval block threshold detection area is used to set the interval block threshold, and the interval block threshold represents the value range of the sampling value corresponding to the interval block; the data block threshold detection area is used to set the data block threshold, and the data block threshold represents the value range of the sampling value corresponding to the data block; the data area includes one or more data blocks and one or more interval blocks arranged in a certain order, and the interval blocks in the data area are used to separate adjacent data blocks; the device includes: an acquisition module for acquiring a data waveform; the data waveform is obtained based on the barcode sampling by the reading device at a preset sampling frequency The waveform with the sampling point sequence number as the horizontal coordinate and the sampling value as the vertical coordinate is obtained; an interval block threshold setting module is used to obtain and record the interval block threshold based on the sampling value corresponding to the interval block threshold detection area in the data waveform; a data block threshold setting module is used to obtain and record the data block threshold based on the sampling value corresponding to the data block threshold detection area in the data waveform; an identification module is used to identify the code value corresponding to the one or more data blocks and the number of the interval blocks from the sampling value corresponding to the data area in the data waveform according to the interval block threshold and the data block threshold; a coding determination module is used to determine the coding corresponding to the barcode according to the code value corresponding to the one or more data blocks when the number of the interval blocks reaches a preset number.
[0017] According to the barcode recognition device shown in some embodiments of the present specification, the interval block threshold detection area, the data block threshold detection area and the data area are arranged in sequence according to the reading order of the reading device; the interval block threshold setting module is further used to obtain and record the interval block threshold based on the sampling value when a fluctuation in the sampling value of the data waveform is detected; the data block threshold setting module is further used to obtain and record the data block threshold based on the sampling value when it is detected that the sampling value of the data waveform exceeds the interval block threshold; the recognition module is further used to identify the code values corresponding to the one or more data blocks and the number of the interval blocks according to the sampling value, the interval block threshold and the data block threshold after the sampling value of the data waveform reaches the interval block threshold for the second time.
[0018] According to the barcode recognition device shown in some embodiments of the present specification, the interval block threshold setting module is further used to determine that a sampling value fluctuation of the data waveform is detected when the sampling value of the data waveform exceeds an initial threshold; wherein the initial threshold is a value range of the sampling values counted before the barcode enters the reading area of the reading device.
[0019] According to the barcode recognition device shown in some embodiments of this specification, the recognition module is further used to: identify the interval block from the sampling values corresponding to the data area in the data waveform according to the interval block threshold, and obtain the number of the interval blocks; identify the data block from the sampling values corresponding to the data area in the data waveform according to the data block threshold, and determine the code value corresponding to the data block.
[0020] According to the barcode recognition device shown in some embodiments of this specification, the recognition module is further used to: determine a peak or a trough based on a change trend of the sampling value corresponding to the data area in the data waveform; and determine the data block sampling value corresponding to the peak or the trough as the sampling value corresponding to the interval block in the data area.
[0021] According to the barcode recognition device shown in some embodiments of the present specification, the recognition module is further used to: determine a trough or a peak based on a change trend of the sampling value corresponding to the data area in the data waveform; determine whether the sampling value corresponding to the trough or the peak exceeds the data block threshold; when the sampling value corresponding to the trough or the peak exceeds the data block threshold, determine the data block sampling value corresponding to the trough or the peak as the sampling value corresponding to the first type of data block; when the sampling value corresponding to the trough or the peak does not exceed the data block threshold, determine the data block sampling value corresponding to the trough or the peak as the sampling value corresponding to the second type of data block; wherein, the first type of data block corresponds to a first code value, and the second type of data block corresponds to a second code value.
[0022] According to the barcode recognition device shown in some embodiments of the present specification, the barcode also includes a reading completion detection area, and the reading completion detection area includes an interval block arranged after the data area according to the reading order; the device also includes a reading completion detection module, which is used to determine whether the sampling value reaches the interval block threshold again after the number of the interval blocks reaches the preset number and before determining the encoding corresponding to the barcode according to the code values corresponding to the one or more data blocks; the encoding determination module is also used to determine the encoding corresponding to the barcode according to the code values corresponding to the one or more data blocks when the sampling value reaches the interval block threshold again; the device also includes a prompt information generation module, which is used to generate a reading abnormality prompt information when the sampling value does not reach the interval block threshold again.
[0023] According to the barcode recognition device shown in some embodiments of the present specification, the reading device has a reading area. When the reading device samples from the reading area, the interval block threshold detection area, the data block threshold detection area, the data area and the reading completion detection area on the barcode pass through the reading area in sequence. In the direction of entering the reading area, the length of the interval block of the reading completion detection area is greater than the length of the interval block of the data area; the reading completion detection module is further used to: when the sampling value reaches the interval block threshold, obtain a first time length by counting the duration of the sampling value reaching the interval block threshold according to the data waveform; compare the first time length with the second time length; wherein the second time length is the duration of the sampling value in the data area reaching the interval block threshold calculated according to the data waveform; when the first time length is greater than the second time length, determine that the sampling value reaches the interval block threshold again; when the first time length is not greater than the second time length, determine that the sampling value does not reach the interval block threshold again.
[0024] According to the barcode recognition device shown in some embodiments of this specification, the acquisition module is also used to preprocess the waveform obtained by the reading device sampling the barcode at a preset sampling frequency, with the sampling point sequence number as the horizontal coordinate and the sampling value as the vertical coordinate, to obtain the data waveform.
[0025] According to the barcode recognition device shown in some embodiments of this specification, the acquisition module is further used to: extract a number of sampling values from the waveform in sequence in a sliding window manner; calculate the average of the sampling values extracted each time, and use the average as the sampling value in the data waveform.
[0026] One or more embodiments of this specification propose an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the barcode recognition method as described in one or more embodiments of this specification.
[0027] One or more embodiments of this specification propose a computer-readable storage medium, which stores at least one instruction or at least one program. The at least one instruction or at least one program is loaded and executed by a processor to implement the barcode recognition method as described in one or more embodiments of this specification.
[0028] One or more embodiments of this specification propose a computer program product, including at least one instruction or at least one program segment. When the at least one instruction or the at least one program segment is loaded and executed by a processor, it can implement the barcode recognition method described in one or more embodiments of this specification.
[0029] One or more embodiments of the present specification propose a card, the material of which includes plastic, and a barcode printed on the card, the barcode including a spacer block threshold detection area, a data block threshold detection area and a data area, the spacer block threshold detection area is used to set the spacer block threshold, and the spacer block threshold represents the value range of the sampling value corresponding to the spacer block; the data block threshold detection area is used to set the data block threshold, and the data block threshold represents the value range of the sampling value corresponding to the data block; the data area includes one or more data blocks and one or more spacer blocks arranged in a certain order, and the spacer blocks in the data area are used to separate adjacent data blocks.
[0030] The beneficial effects that may be brought about by the embodiments of this specification include but are not limited to: one or more embodiments provided in this specification determine the spacer block threshold and data block threshold based on the dynamically acquired data waveform each time a card is inserted, thereby improving the accuracy of the threshold to a certain extent. On this basis, the code values corresponding to one or more data blocks and the number of spacer blocks are identified based on the spacer block threshold and data block threshold. When the number of spacer blocks reaches a preset number, the code corresponding to the barcode on the card is determined based on the code values corresponding to the one or more data blocks. In this way, non-electrical recognition of the barcode on the card is achieved, which to a certain extent reduces the influence of the card material and barcode material on the recognition results and improves the accuracy of the barcode recognition results. In addition, by determining whether the number of identified spacer blocks reaches a preset number, the integrity of the read barcode data area is verified, which is also conducive to improving the accuracy of the recognition results. It should be noted that different embodiments may produce different beneficial effects. In different embodiments, the beneficial effects that may be produced may be any one or a combination of the above, or any other possible beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] This specification will be further described in the form of exemplary embodiments, which will be described in detail with reference to the accompanying drawings. The same numbers in the drawings represent the same structures or steps.
[0032] FIG1 is a schematic diagram of a card provided in some embodiments of this specification.
[0033] FIG2 is a flowchart of a barcode recognition method provided by some embodiments of this specification.
[0034] FIG3 is a schematic diagram of a normal waveform corresponding to a barcode provided in some embodiments of this specification.
[0035] FIG4 is a schematic diagram of a measured waveform corresponding to a barcode provided in some embodiments of this specification.
[0036] FIG5 is another schematic diagram of a measured waveform corresponding to a barcode provided in some embodiments of this specification.
[0037] FIG6 is a flow chart of step S140 provided in some embodiments of this specification.
[0038] FIG. 7 is another flow chart of step S140 provided in some embodiments of this specification.
[0039] FIG8 is another flow chart of step S140 provided in some embodiments of this specification.
[0040] FIG9 is a flowchart of a barcode recognition method provided in some other embodiments of this specification.
[0041] FIG10 is a schematic block diagram of a barcode recognition device provided in some embodiments of this specification. DETAILED DESCRIPTION
[0042] To more clearly illustrate the technical solutions of the embodiments of this specification, the embodiments will be described in detail below with reference to the accompanying drawings. Obviously, the following descriptions are some examples or embodiments of this specification, and those skilled in the art can apply the technical solutions or methods disclosed in this specification to other scenarios based on these technical contents without inventive effort.
[0043] It should be understood that the terms "system," "device," "unit," and / or "module" used in this specification are a method for distinguishing different components, elements, parts, portions, or assemblies at different levels. However, if other terms can achieve the same purpose, the terms may be replaced by other expressions.
[0044] Unless otherwise specified, technical terms used in this specification to describe components, elements, and the like do not necessarily refer to the singular but may include the plural. Generally speaking, terms such as "include" and "comprising" only indicate the inclusion of the steps, elements, or components specifically identified, and these steps, elements, and components do not constitute an exclusive list. For example, the method or device being described may also include other steps or components.
[0045] This specification uses flowcharts to illustrate the operational steps performed by the devices or systems of the relevant embodiments. However, unless otherwise specified, the order in which these steps are described should not be construed as limiting the order in which the steps are performed. A person of ordinary skill in the art may adjust the order in which these steps are performed based on the knowledge and information conveyed by the embodiments of this specification. Such adjustments include, but are not limited to, reversing the order of these steps, combining multiple steps, and splitting a step.
[0046] Some embodiments of the present specification provide a hard card, the material of which may include plastic. Plastic is a polymer compound formed by polymerization of monomers through addition polymerization or condensation polymerization. Its deformation resistance is between that of fiber and rubber, and it has a certain rigidity and wear resistance. Specifically, the plastic may further include polyvinyl chloride (PVC), polyethylene glycol terephthalate (PET), polyvinyl chloride, polypropylene, polystyrene, etc. Printing a barcode on a plastic card can effectively solve the problem of a short card life. However, hard plastic cards may have problems such as reflection, resulting in a large deviation between the sampled value of the barcode obtained by the card reader during non-electrical recognition and the actual value of the barcode corresponding area, which is prone to recognition errors, non-recognition, etc. For this reason, some embodiments of the present specification improve the barcode and provide a corresponding barcode recognition method, device, electronic device and computer-readable storage medium, which can perform non-electrical recognition on the barcode on the card, reduce the influence of the card material and barcode material on the recognition result to a certain extent, and improve the accuracy of the recognition result.
[0047] The barcode recognition methods provided in some embodiments of this specification can be applied to electronic devices. The electronic devices provided in some embodiments of this specification can be implemented as various types of user terminals such as learning machines, audio and video players, time clocks, AR glasses, laptops, tablet computers, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), and can also be implemented as servers, without limitation in the embodiments of this specification.
[0048] The barcodes recognized by the barcode recognition methods provided in some embodiments of this specification include an interval block threshold detection area, a data block threshold detection area, and a data area. The interval block threshold detection area is used to set the interval block threshold, and the interval block threshold represents the value range of the sampling value corresponding to the interval block. The data block threshold detection area is used to set the data block threshold, and the data block threshold represents the value range of the sampling value corresponding to the data block. The data area includes one or more data blocks and one or more interval blocks arranged in a certain order. The interval blocks in the data area are used to separate adjacent data blocks. In some embodiments, the aforementioned barcode can be printed on a hard card, such as a plastic card, and the barcode on the card is read or sampled by a reading device to obtain a waveform including sampling values corresponding to multiple sampling points.
[0049] In some embodiments, the reading device can realize barcode reading or recognition based on the photoelectric principle. Specifically, the reading device has a photoelectric reader and a corresponding reading area. The photoelectric reader can obtain a sampling point sequence for the reading area according to a preset sampling frequency. The sampling frequency can be, for example, 30ms / time, 40ms / time, etc. In some embodiments, the photoelectric reader and the reading area are fixed. When the card is inserted into the reading device, each area of the barcode on the card can pass through the reading area in turn, and then the photoelectric reader can sample the barcode on the card according to the aforementioned sampling frequency to obtain a sampling point sequence. In other embodiments, the card reading device can have multiple photoelectric readers, each of which is configured to read a data block in the barcode, and the photoelectric reader corresponds to the data block in the barcode one-to-one. The embodiments of this specification do not limit the specific structure and working principle of the reading device. After obtaining a sampling point sequence consisting of multiple sampling points, a waveform corresponding to the sampling point sequence can be further obtained. As an example, the waveform can be a sampling point number as the horizontal coordinate and a sampling value as the vertical coordinate. Because the card, or more specifically, the barcode on the card, enters the card reader in chronological order, the sampling point number can also reflect both the sampling timing information corresponding to the sampling point and the position information of the sampling point relative to the area on the barcode. For example, the sampling point with a larger sampling point number corresponds to the area further back on the barcode.
[0050] FIG1 is a schematic diagram of a card provided in some embodiments of the present specification. Specifically, as shown in FIG1 , a barcode is printed on the card. The barcode includes a spacer block threshold detection area, a data block threshold detection area, and a data area, arranged sequentially according to the reading order of a reader (e.g., when the card is inserted into the reader, the various areas of the barcode on the card sequentially pass through the reading area). Continuing with the example of FIG1 , the spacer block threshold detection area includes a white block, the data block threshold detection area includes a black block, and the data area includes several black data blocks, several gray data blocks, and several spacer blocks separating adjacent data blocks. The black data block represents 0 in binary, and the gray data block represents 1 in binary. Arranging 10 data blocks in different orders can express 2^10, or 1024 different data.
[0051] It should be noted that, in some embodiments, it is also feasible to let the black data block represent 1 in binary and the gray data block represent 0 in binary. In other embodiments, the spacer blocks are not limited to the above-mentioned white blocks, and the data blocks are not limited to the above-mentioned black blocks and gray blocks. The spacer blocks can be blocks of other colors, and the data blocks can also be blocks of other colors. In some other embodiments, the types of data blocks in the data area can also be three or more, and accordingly, the encoding corresponding to the barcode can be based on the base representation of the data corresponding to the type of data blocks in the data area. For example, the data area includes three types of data blocks, and the encoding corresponding to the barcode can use ternary representation of the data; the data area includes four types of data, and the encoding corresponding to the barcode can use quaternary representation of the data. In order to facilitate a clear and intuitive understanding of the technical solution, the embodiments of this specification are mainly explained by taking the case where the provided data blocks are composed of the first type of data blocks and the second type of data blocks as an example, but it should not be regarded as a limitation to the embodiments of this specification.
[0052] Figure 2 is a flow chart of a barcode recognition method provided in some embodiments of this specification. In some embodiments, the process shown in Figure 2 can be implemented by the barcode recognition device shown in Figure 10. Specifically, as shown in Figure 2, in some embodiments, the method can include the following steps.
[0053] S110: Acquire a data waveform; wherein the data waveform is obtained based on a waveform obtained by sampling the barcode by the reader at a preset sampling frequency, with the sampling point number as the horizontal axis and the sampling value as the vertical axis. In some embodiments, step S110 can be implemented by the acquisition module 310.
[0054] In some embodiments, the data waveform may be a waveform obtained by sampling a barcode on a card by a reader, or may be a result of preprocessing the waveform. The description of the waveform can be found above, and the description of the preprocessing can be found below, which will not be repeated here.
[0055] As mentioned above, cards can be made of plastic materials with a certain degree of reflectivity, such as PVC and PET. In actual application scenarios, the card's reflectivity, the color depth of the ink on the card, and the distance between the card and the reader after insertion will all affect the waveform of the barcode.
[0056] Figure 3 is a schematic diagram of the normal waveform corresponding to the barcode provided in some embodiments of this specification (i.e., the waveform obtained when there is no interference from factors such as reflection). Specifically, as shown in Figure 3, the white block is the interval block, the white block corresponds to the highest electrical level, the black block is the data block, the black block corresponds to the lowest electrical level, and the identified code value is 1; the gray block is the data block, the gray block corresponds to the middle electrical level, and the identified code value is 0.
[0057] Figure 4 is a schematic diagram of the measured waveforms corresponding to barcodes provided in some embodiments of this specification. Specifically, as shown in Figure 4, the sampled values corresponding to the white, black, and gray blocks in the barcode fluctuate. In other words, for barcodes printed on cards made of materials with a certain degree of reflectivity, such as PVC, the detection values of each color block in the barcode read by the photoelectric reader fall within a range, rather than being fixed values.
[0058] FIG5 is another schematic diagram of the measured waveform corresponding to the barcode provided in some embodiments of this specification. Specifically, as shown in FIG5 , the waveform on the left (dashed box 1) corresponds to a card insertion process, and the waveform on the right (dashed box 2) corresponds to another card insertion process immediately thereafter. During the two card insertion processes, the range of the peak values in the waveform on the left is significantly different from the range of the peak values in the waveform on the right. On the contrary, the range of the trough values in the waveform on the left is close to the range of the peak values in the waveform on the right. In other words, during the two card insertion processes, the interval block thresholds detected based on the same interval block threshold detection area may be different, and the data block thresholds detected based on the same data block detection area may also be different.
[0059] To solve this problem, some embodiments of this specification obtain an accurate interval block threshold by executing step S120 and obtain an accurate data block threshold by executing step S130 during each card insertion process.
[0060] S120: Based on the sample values corresponding to the interval block threshold detection area in the data waveform, obtain and record the interval block threshold. In some embodiments, step S120 can be implemented by the interval block threshold setting module 320.
[0061] Continuing with FIG. 1 , in some embodiments, obtaining and recording the interval block threshold based on sample values corresponding to the interval block threshold detection region in the data waveform may include the following steps: sequentially processing the sample values in the data waveform based on a horizontal coordinate, and when fluctuations in the sample values of the data waveform are detected, obtaining and recording the interval block threshold based on the sample values. In some embodiments, when fluctuations in the sample values of the data waveform are detected, multiple sample values may be continuously obtained, and their average value may be recorded as the interval block threshold.
[0062] The spacer threshold detection area is used to determine the spacer threshold for each card insertion process. Each spacer threshold for each card insertion process is determined based on the same spacer threshold detection area. In other words, the spacer threshold detection area calibrates the range of spacer sampling values within the same card insertion process.
[0063] In some embodiments, when the sampling value of the data waveform exceeds an initial threshold, it is determined that the sampling value fluctuation of the data waveform is detected. The initial threshold is a value range of the sampling values counted before the barcode enters the reading area.
[0064] In some embodiments, a pad is provided within the reading area of the reader. The sampling value in the initial state, i.e., the sampling value corresponding to the pad read by the reader before the card is inserted, can be at least within a preset range between the sampling value corresponding to the pad and the sampling value threshold corresponding to the spacer. The preset range can be set based on actual needs. Preferably, the preset range is such that significant fluctuations in the sampling value can be observed in the detection waveform when the card is inserted. Thus, when the card is inserted, the sampling value read by the reader will fluctuate significantly, which can be used as a sign that the card has entered the reading state.
[0065] In some embodiments, the pad within the reading area can be black or approximately black, and its corresponding sampling value range is the same as or similar to the data block threshold range. This setting is because the interval between the sampling value ranges of the black data block and the white spacer block is the largest. Setting the pad to black or approximately black allows for significant fluctuations in the sampling values to be observed upon card insertion. It should be noted that in other embodiments, the sampling value range corresponding to the pad can also differ from the data block threshold range. Other value ranges that allow for significant fluctuations in the sampling values to be observed upon card insertion can also be applied to this embodiment.
[0066] In the examples corresponding to Figures 1 and 3, the spacer block is white, the data block is black, and the backing plate is black or approximately black. The sampling value range of the data block is the same or approximately the same as that of the initial state, while the sampling value range of the spacer block and the data block is different. In the initial state, the reader detects the reading area and reads the sampling value corresponding to the backing plate. When a card is inserted, the reader reads the sampling value of the spacer block, which may fluctuate significantly. If no significant fluctuation in the sampling value is detected, it indicates that the barcode on the card has not entered the reading area, and the reader continues to poll the reading area.
[0067] S130: Based on the sampling values corresponding to the data block threshold detection area in the data waveform, obtain and record the data block threshold. In some embodiments, step S130 can be implemented by the data block threshold setting module 330.
[0068] Continuing with FIG. 1 , in some embodiments, obtaining and recording the data block threshold based on sample values corresponding to the data block threshold detection region in the data waveform includes: sequentially processing the sample values in the data waveform based on the horizontal axis, and when a sample value of the data waveform is detected to exceed the interval block threshold, obtaining and recording the data block threshold based on the sample value. In some embodiments, when a sample value of the data waveform is detected to exceed the interval block threshold, multiple sample values may be continuously obtained, and their average value may be recorded as the data block threshold.
[0069] Among them, the data block threshold detection area is used to determine the data block threshold corresponding to each card insertion process. The data block threshold corresponding to each card insertion process is obtained based on the detection of the same data block threshold detection area. The data block thresholds corresponding to different card insertion processes may be the same or different. In other words, the data block threshold detection area is used to calibrate the value range of the sampling value of the data block in the same card insertion process.
[0070] S140: Identify code values corresponding to one or more data blocks and the number of interval blocks from the sample values corresponding to the data region in the data waveform according to the interval block threshold and the data block threshold. In some embodiments, step S140 may be implemented by the identification module 340.
[0071] Please continue to refer to Figure 1. In some embodiments, code values corresponding to one or more data blocks and the number of interval blocks are identified from the sampling values corresponding to the data area in the data waveform based on the interval block threshold and the data block threshold, including: continuing to process the sampling values in the data waveform in sequence based on the horizontal axis, and when the sampling value of the data waveform reaches the interval block threshold for the second time, identifying the code values corresponding to one or more data blocks and the number of interval blocks based on the sampling value, the interval block threshold and the data block threshold.
[0072] S150: When the number of the spacer blocks reaches a preset number, determine the code corresponding to the barcode according to the code values corresponding to the one or more data blocks. In some embodiments, step S150 can be implemented by the code determination module 350.
[0073] The spacer blocks in the data area are used to separate adjacent data blocks. Generally speaking, when the number of encoded data bits corresponding to the barcode is determined, the preset number of spacer blocks is also determined. As an example, in the data area of the barcode, the last spacer block in the data area can be set after the last data block. Therefore, when the number of spacer blocks detected from the data area reaches the preset number, it means that the recognition of the data blocks in the data area is also completed. At this time, the encoding corresponding to the barcode can be determined based on the code values of the multiple data blocks obtained. Continuing with Figure 3, the code values corresponding to each data block can be combined in sequence to obtain the encoding "1011011111". As another example, the spacer block belonging to the data area can be not set after the last data block in the data area of the barcode. It can be determined that the recognition of the data blocks in the data area has been completed after the number of spacer blocks reaches a preset data certain time (such as 30ms or 50ms, etc.). The aforementioned certain time can be understood as the time it takes for the reader to recognize the last data block. Further, the encoding corresponding to the barcode can be determined based on the code values corresponding to the multiple data blocks obtained.
[0074] In some embodiments, the interval block threshold detection area, the data block threshold detection area, and the data area are arranged in sequence according to the reading order of the reading device. That is, when the card enters the card reading device, the barcode is read in the order of the interval block threshold detection area, the data block threshold detection area, and the data area. In some embodiments, when the interval between the data block threshold and the initial threshold meets the judgment condition that the barcode enters the reading area, the barcode area can also be read in the order of the data block threshold detection area, the interval block threshold detection area, and the data area. Among them, the judgment condition that the barcode enters the reading area can be that the interval between the data block threshold corresponding to the data block threshold detection area and the initial threshold meets a preset range, and the preset range allows the card to be identified by the fluctuation of the sampling value when it enters the card reading area.
[0075] It should be noted that the number of spacer block threshold detection areas can be one or more, the number of data block threshold detection areas can be one or more, and the number of data areas can be one or more. In some possible implementations, the number of spacer block threshold detection areas is multiple and the number of data areas is multiple, at least one spacer block threshold detection area is set before the data area, and the other spacer block threshold detection areas in the multiple spacer block threshold detection areas are distributed between adjacent data areas, so that the spacer block threshold can be corrected multiple times during a single card insertion process. In other possible implementations, the number of data block threshold detection areas is multiple and the number of data areas is multiple, at least one data block threshold detection area is set before the data area, and the other data block threshold detection areas in the multiple data block threshold detection areas are distributed between adjacent data areas, so that the data block threshold can be corrected multiple times during a single card insertion process. The above examples are only used to illustrate possible implementations of the barcode and should not be regarded as limiting the embodiments of this specification, because according to actual needs, the spacer block threshold detection areas, data block threshold detection areas and data areas on the barcode can also have other combinations and distribution forms.
[0076] FIG6 is a flow chart of step S140 provided in some embodiments of this specification. In some embodiments, the process shown in FIG6 can be implemented by the recognition module 340 in the barcode recognition device. Specifically, as shown in FIG6, in some embodiments, identifying the code values corresponding to one or more data blocks and the number of interval blocks from the sample values corresponding to the data region in the data waveform based on the interval block threshold and the data block threshold can include the following steps.
[0077] S1411: Identify interval blocks from the sampling values corresponding to the data region in the data waveform according to the interval block threshold and obtain the number of interval blocks. In other words, the interval blocks are determined based on a direct comparison between the interval block threshold and the sampling values, and the number of interval blocks is counted.
[0078] S1412: Identify data blocks from the sampled values corresponding to the data region in the data waveform based on the data block threshold, and determine the code values corresponding to the data blocks. Continuing with FIG1 , in the example of FIG1 , step S1412 can be implemented as follows: determine the first type of data blocks based on a direct comparison between the data block threshold and the sampled values, determine the sampled values of the remaining data blocks in the data region as the second type of data blocks, and then determine the code values corresponding to the first type of data blocks and the code values corresponding to the second type of data blocks. As shown in FIG1 , the first type of data blocks correspond to black blocks, and the second type of data blocks correspond to gray blocks.
[0079] This embodiment obtains the number of interval blocks and the code value corresponding to each data block in the data area by directly comparing the interval block threshold, the data block threshold and the sampling value.
[0080] FIG7 is another flow chart of step S140 provided in some embodiments of this specification. In some embodiments, the process shown in FIG7 can be implemented by the recognition module 340 in the barcode recognition device. Specifically, as shown in FIG7, in some embodiments, identifying the code values corresponding to one or more data blocks and the number of interval blocks from the sample values corresponding to the data region in the data waveform based on the interval block threshold and the data block threshold can include the following steps.
[0081] S1421: Determine a peak or a trough according to a change trend of the sampling values corresponding to the data area in the data waveform.
[0082] Among them, the peak point corresponding to the peak in the data waveform satisfies that the first-stage derivative is 0 and the second-stage derivative is negative, while the trough value corresponding to the trough satisfies that the first-stage derivative is 0 and the second-stage derivative is positive.
[0083] S1422: Determine the sampling value corresponding to the peak or trough as the sampling value corresponding to the interval block in the data area.
[0084] In some embodiments, as shown in FIG1 , the interval block corresponds to a peak, and step S1421 can be implemented as follows: determining the peak based on a trend of changes in the sample values corresponding to the data region in the data waveform. Step S1422 can be implemented as follows: determining the sample value corresponding to the peak as the sample value corresponding to the interval block in the data region.
[0085] Conversely, in some embodiments, when the interval block corresponds to a trough, step S1421 may be implemented as: determining the trough based on the variation trend of the sampling values corresponding to the data region in the data waveform. Step S1422 may be implemented as: determining the sampling value corresponding to the trough as the sampling value corresponding to the interval block in the data region.
[0086] FIG8 is another flow chart of step S140 provided in some embodiments of this specification. In some embodiments, the process shown in FIG8 can be implemented by the recognition module 340 in the barcode recognition device. Specifically, as shown in FIG8, in some embodiments, identifying the code values corresponding to one or more data blocks and the number of interval blocks from the sample values corresponding to the data region in the data waveform based on the interval block threshold and the data block threshold can include the following steps.
[0087] S1431: Determine a trough or a peak according to a change trend of the sampling values corresponding to the data area in the data waveform.
[0088] S1432: Determine whether the sampling value corresponding to the trough or peak exceeds the data block threshold.
[0089] S1433: When the sampling value corresponding to the trough or peak exceeds the data block threshold, the sampling value of the data block corresponding to the trough or peak is determined as the sampling value corresponding to the first type of data block.
[0090] S1434: When the sampling value corresponding to the trough or peak does not exceed the data block threshold, the sampling value of the data block corresponding to the trough or peak is determined as the sampling value corresponding to the second type of data block, wherein the first type of data block corresponds to the first code value and the second type of data block corresponds to the second code value.
[0091] In some embodiments, as shown in FIG1 , the interval blocks correspond to peaks and the data blocks correspond to troughs. The process corresponding to FIG8 can be implemented as follows: a trough is determined based on a changing trend of the sampled values corresponding to the data region in the data waveform. A determination is made as to whether the sampled value corresponding to the trough exceeds a data block threshold. When the sampled value corresponding to the trough exceeds the data block threshold, the sampled value of the data block corresponding to the trough is determined as the sampled value corresponding to the first type of data block. When the sampled value corresponding to the trough does not exceed the data block threshold, the sampled value of the data block corresponding to the trough is determined as the sampled value corresponding to the second type of data block. The first type of data block corresponds to a first code value, and the second type of data block corresponds to a second code value.
[0092] Conversely, in some embodiments, when the interval block corresponds to a trough and the data block corresponds to a peak, the process corresponding to FIG8 can be implemented as follows: a peak is determined based on the changing trend of the sampled values corresponding to the data region in the data waveform. A determination is made as to whether the sampled value corresponding to the peak exceeds a data block threshold. When the sampled value corresponding to the peak exceeds the data block threshold, the sampled value of the data block corresponding to the peak is determined as the sampled value corresponding to the first type of data block. When the sampled value corresponding to the peak does not exceed the data block threshold, the sampled value of the data block corresponding to the peak is determined as the sampled value corresponding to the second type of data block. The first type of data block corresponds to a first code value, and the second type of data block corresponds to a second code value.
[0093] The barcode recognition methods described in some embodiments of this specification are not limited by the order of the steps described. Depending on the embodiments of this specification, certain steps may be performed in a different order or simultaneously. For example, when executing step S140, the processes shown in FIG. 7 and FIG. 8 may be performed simultaneously, or the process shown in FIG. 7 may be performed first and then the process shown in FIG. 8, or the processes may be performed in the reverse order.
[0094] In one embodiment, the barcode identified by the method further includes a read completion detection area, and the read completion detection area includes a spacer block arranged after the data area according to the reading order.
[0095] FIG9 is another flow chart of the barcode recognition method provided by some embodiments of this specification. In some embodiments, the process shown in FIG9 can be implemented by the barcode recognition device shown in FIG10. Steps S210 to S240 in the flow chart shown in FIG9 are similar to steps S110 to S140 shown in FIG2. For detailed descriptions, please refer to the relevant description of FIG2 and will not be repeated here. Specifically, as shown in FIG9, after the number of interval blocks reaches a preset number, the method may further include the following steps before determining the encoding corresponding to the barcode based on the code values corresponding to one or more data blocks.
[0096] S260: Determine whether the sampled value reaches the interval block threshold again. If the sampled value reaches the interval block threshold again, proceed to step S270. If the sampled value does not reach the interval block threshold again, proceed to step S280. In some embodiments, step S260 can be implemented by a read completion detection module in the barcode recognition device.
[0097] Continuing with Figure 1, when the number of interval blocks reaches a preset value, the data has been fully read. If a subsequent sample value falls within the interval block threshold, this indicates that the barcode on the card is still within the corresponding reading area of the reader and that the interval block read is within the read completion detection area. The card reader has now completed reading the barcode on the card. At this point, step S270 can be executed to determine the code corresponding to the barcode based on the code values of the multiple data blocks obtained. In some embodiments, step S270 can be implemented by code determination module 350.
[0098] There are two possible scenarios when the sampling value does not reach the interval block threshold again. One possible scenario is that the card is pulled out after being read, and what is subsequently read is actually the sampling value corresponding to the pad, which will not fall within the interval block threshold. Another possible scenario is that the card shakes during the insertion process, that is, intermediate insertion and removal occurs. Intermediate insertion and removal refers to the barcode moving from the direction of entering the reading area to entering the reading area, and during the barcode reading process, it moves in the direction of exiting the reading area, and then continues to move in the direction of entering the reading area. Intermediate insertion and removal may cause several more data bits in the middle of the read barcode. In this case, when the number of interval blocks reaches the preset number, what is subsequently read is the sampling value of the data block, which will not fall within the interval block threshold.
[0099] S280: Generate reading abnormality prompt information. In some embodiments, step S280 can be implemented by a prompt information generation module in the barcode recognition device.
[0100] Among them, the reading abnormality prompt information can include card-not-in-place prompt information and reading error prompt information. The card-not-in-place prompt information is used to indicate that the card is not in place, and the reading error prompt information is used to indicate that insertion or removal has occurred during the barcode reading process. After the number of spacer blocks reaches the preset number, by detecting whether the card is in place and whether the data area has been read, it is possible to detect that the data area has not been fully read, thereby improving the accuracy of the recognition result to a certain extent. When the card is pulled out without being fully inserted, the reading abnormality can be identified in time, and a reading abnormality prompt information can be generated. Among them, the reading abnormality prompt information can be displayed through a combination of one or more of text, images, audio, lighting, etc.
[0101] In some embodiments, the reader comprises a reading region, and when the reader samples from the reading region, a spacer threshold detection region, a data block threshold detection region, a data region, and a read completion detection region on the barcode sequentially pass through the reading region. In the direction of entering the reading region, the length of the spacer in the read completion detection region is greater than the length of the spacer in the data region. Without considering changes in insertion speed, when the duration of a read spacer is longer than the duration of a previously read spacer, it indicates that the barcode has been read. Specifically, determining whether a sample value has reached the spacer threshold again may include the following steps: when the sample value reaches the spacer threshold, calculating the duration of the sample value reaching the spacer threshold based on a data waveform to obtain a first duration; comparing the first duration with a second duration; wherein the second duration is the duration of the sample value in the data region reaching the spacer threshold, calculated based on the data waveform; determining that the sample value has reached the spacer threshold again when the first duration is greater than the second duration; and determining that the sample value has not reached the spacer threshold again when the first duration is less than the second duration.
[0102] The barcode recognition method provided in some embodiments of this specification may also include preprocessing the waveform obtained by the reading device sampling the barcode on the card. The preprocessing may include the following steps: extracting a number of sampling values from the waveform in sequence in the form of a sliding window; calculating the average of the sampling values extracted each time, and using the average as the sampling value in the data waveform. The length of the sliding window can be set according to actual needs. As an example, the length of the sliding window can be 5 sampling points, 10 sampling points, 100 sampling points, etc. In some embodiments, the moving step of the sliding window can also be set. For example, the moving step can be set to 1 sampling point, 5 sampling points, etc. The waveform after preprocessing can be used as the data waveform in the barcode recognition method. Due to the preprocessing, the noise or jitter of the original waveform can be eliminated, thereby improving the accuracy of barcode recognition. In some embodiments, the aforementioned preprocessing step can be implemented by the acquisition module 310.
[0103] Some embodiments of this specification also provide a barcode recognition device. The barcode recognized by the device includes a spacer block threshold detection area, a data block threshold detection area, and a data area. The spacer block threshold detection area is used to set the spacer block threshold, which represents the value range of the sampling value corresponding to the spacer block. The data block threshold detection area is used to set the data block threshold, which represents the value range of the sampling value corresponding to the data block. The data area includes one or more data blocks and one or more spacer blocks arranged in a certain order. The spacer blocks in the data area are used to separate adjacent data blocks.
[0104] FIG10 is a block diagram of a barcode recognition device provided in some embodiments of this specification. Specifically, as shown in FIG10 , in one embodiment, the barcode recognition device may include the following modules: an acquisition module 310 for acquiring a data waveform; wherein the data waveform is obtained based on a waveform obtained by sampling the barcode by a reader at a preset sampling frequency, with the sampling point number as the horizontal axis and the sampling value as the vertical axis. An interval block threshold setting module 320 for acquiring and recording an interval block threshold based on the sampling values corresponding to the interval block threshold detection area in the data waveform. A data block threshold setting module 330 for acquiring and recording a data block threshold based on the sampling values corresponding to the data block threshold detection area in the data waveform. An identification module 340 for identifying, from the sampling values corresponding to the data area in the data waveform, the code values corresponding to one or more data blocks and the number of interval blocks based on the interval block threshold and the data block threshold. An encoding determination module 350 for determining the encoding corresponding to the barcode based on the code values corresponding to the one or more data blocks when the number of interval blocks reaches a preset number.
[0105] For more information about each module, please refer to Figure 2 and the relevant descriptions of Figures 6 to 9, which will not be repeated here. It should be understood that the system and its modules shown in Figure 10 can be implemented in various ways. For example, in some embodiments, the system and its modules can be implemented by hardware, software, or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or specially designed hardware. Those skilled in the art will understand that the above-mentioned methods and systems can be implemented using computer-executable instructions and / or control code contained in a processor, such as such as a carrier medium such as a disk, CD or DVD-ROM, or a memory of a programmable device. The system and its modules of this specification can be implemented not only by hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, or programmable hardware devices such as field programmable gate arrays, programmable logic devices, but can also be implemented by software executed by various types of processors, or by a combination of the above-mentioned hardware circuits and software (for example, firmware).
[0106] It should be noted that the above description of the system and its modules is for convenience only and does not limit this specification to the scope of the illustrated embodiments. It is understood that those skilled in the art, after understanding the principles of the system, may, without departing from these principles, arbitrarily combine the modules to form subsystems connected to other modules. Alternatively, they may split certain modules to obtain more modules or multiple units within a module. Such variations are within the scope of this specification.
[0107] Some embodiments of this specification also provide an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the barcode recognition method as described in one or more embodiments of this specification.
[0108] Some embodiments of this specification also provide a non-transitory computer-readable storage medium, which stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the barcode recognition method as described in one or more embodiments of this specification.
[0109] Optionally, in this embodiment, the storage medium may be located in at least one of a plurality of network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0110] One or more embodiments of this specification propose a computer program product, including at least one instruction or at least one program segment, which, when loaded and executed by a processor, can implement the barcode recognition method provided in the various optional implementations described above.
[0111] One or more embodiments of the present specification propose a card, characterized in that its material includes plastic, and a barcode is printed on the card, the barcode includes a spacer block threshold detection area, a data block threshold detection area and a data area, the spacer block threshold detection area is used to set the spacer block threshold, and the spacer block threshold represents the value range of the sampling value corresponding to the spacer block; the data block threshold detection area is used to set the data block threshold, and the data block threshold represents the value range of the sampling value corresponding to the data block; the data area includes one or more data blocks and one or more spacer blocks arranged in a certain order, and the spacer blocks in the data area are used to separate adjacent data blocks.
[0112] As can be seen from the embodiments of the card and barcode recognition method, device, electronic device or storage medium provided by one or more embodiments of the present specification, in some embodiments of the present specification, the interval block threshold and the data block threshold are determined based on the dynamically acquired data waveform each time the card is inserted, thereby improving the accuracy of the threshold to a certain extent. On this basis, the code value corresponding to one or more data blocks and the number of interval blocks are identified according to the interval block threshold and the data block threshold. When the number of interval blocks reaches a preset number, the code corresponding to the barcode on the card is determined according to the code value corresponding to one or more data blocks. In this way, non-electrical recognition of the barcode on the card is achieved, which reduces the influence of the card material and the barcode material on the recognition result to a certain extent and improves the accuracy of the barcode recognition result. In addition, by judging whether the number of identified interval blocks reaches a preset number, the integrity of the read barcode data area is verified, which is also conducive to improving the accuracy of the recognition result.
[0113] While the basic concepts have been described above, it will be apparent to those skilled in the art that the detailed disclosure is merely illustrative and does not limit this specification. Although not explicitly stated herein, various modifications, improvements, and revisions to this specification may be made by those skilled in the art. Such modifications, improvements, and revisions are taught in this specification and remain within the spirit and scope of the exemplary embodiments of this specification.
Claims
1. A barcode recognition method, characterized in that: The barcode includes a spacer block threshold detection area, a data block threshold detection area, and a data area. The spacer block threshold detection area is used to set a spacer block threshold, and the spacer block threshold represents a value range of sampling values corresponding to the spacer block. The data block threshold detection area is used to set a data block threshold, and the data block threshold represents a value range of sampling values corresponding to the data block. The data area includes one or more data blocks and one or more spacer blocks arranged in a certain order. The spacer blocks in the data area are used to separate adjacent data blocks. The method comprises: Acquire a data waveform; the data waveform is obtained based on a waveform obtained by sampling the barcode by a reader at a preset sampling frequency, with the sampling point number as the horizontal axis and the sampling value as the vertical axis; Based on the sampling value corresponding to the interval block threshold detection area in the data waveform, obtaining and recording the interval block threshold; Obtaining and recording the data block threshold based on a sampling value corresponding to the data block threshold detection area in the data waveform; Identify the code values corresponding to the one or more data blocks and the number of the interval blocks from the sampling values corresponding to the data region in the data waveform according to the interval block threshold and the data block threshold; When the number of the interval blocks reaches a preset number, the code corresponding to the barcode is determined according to the code values corresponding to the one or more data blocks.
2. The method according to claim 1, characterized in that The spacer block threshold detection area, the data block threshold detection area and the data area are sequentially arranged according to the reading order of the reading device; The acquiring and recording the interval block threshold based on the sampling value corresponding to the interval block threshold detection area in the data waveform includes: When fluctuations in the sampling values of the data waveform are detected, obtaining and recording the interval block threshold based on the sampling values; The acquiring and recording the data block threshold based on the sampling value corresponding to the data block threshold detection area in the data waveform includes: When it is detected that the sampling value of the data waveform exceeds the interval block threshold, obtaining and recording the data block threshold based on the sampling value; The step of identifying the code values corresponding to the one or more data blocks and the number of the interval blocks from the sampling values corresponding to the data region in the data waveform according to the interval block threshold and the data block threshold comprises: After the sampling value of the data waveform reaches the interval block threshold for the second time, the code values corresponding to the one or more data blocks and the number of the interval blocks are identified according to the sampling value, the interval block threshold and the data block threshold.
3. The method according to claim 2, characterized in that When the sampling value of the data waveform exceeds an initial threshold, it is determined that a fluctuation of the sampling value of the data waveform is detected; wherein the initial threshold is a value range of the sampling values counted before the barcode enters the reading area of the reading device.
4. The method according to claim 1, wherein The step of identifying the code values corresponding to the one or more data blocks and the number of the interval blocks from the sampling values corresponding to the data region in the data waveform according to the interval block threshold and the data block threshold comprises: identifying the interval blocks from the sampling values corresponding to the data region in the data waveform according to the interval block threshold, and obtaining the number of the interval blocks; The data block is identified from the sampling values corresponding to the data area in the data waveform according to the data block threshold, and a code value corresponding to the data block is determined.
5. The method according to claim 1, wherein The step of identifying the code values corresponding to the one or more data blocks and the number of the interval blocks from the sampling values corresponding to the data region in the data waveform according to the interval block threshold and the data block threshold comprises: Determine a peak or a trough according to a change trend of the sampling values corresponding to the data area in the data waveform; The data block sampling value corresponding to the peak or the trough is determined as the sampling value corresponding to the interval block in the data area.
6. The method according to claim 1 or 5, characterized in that The step of identifying the code values corresponding to the one or more data blocks and the number of the interval blocks from the sampling values corresponding to the data region in the data waveform according to the interval block threshold and the data block threshold comprises: Determine a trough or a peak according to a change trend of the sampling values corresponding to the data area in the data waveform; Determining whether the sampling value corresponding to the trough or the peak exceeds the data block threshold; When the sampling value corresponding to the trough or the peak exceeds the data block threshold, determining the data block sampling value corresponding to the trough or the peak as the sampling value corresponding to the first type of data block; When the sampling value corresponding to the trough or the peak does not exceed the data block threshold, determining the data block sampling value corresponding to the trough or the peak as the sampling value corresponding to the second type of data block; The first type of data blocks corresponds to a first code value, and the second type of data blocks corresponds to a second code value.
7. The method according to claim 2, characterized in that The barcode further includes a read completion detection area, the read completion detection area including a spacer block arranged after the data area according to the reading order; the method further includes, after the number of the spacer blocks reaches the preset number, and before determining the code corresponding to the barcode based on the code values corresponding to the one or more data blocks: Determining whether the sampling value reaches the interval block threshold again; When the sampling value reaches the interval block threshold again, turning to the step of determining the code corresponding to the barcode according to the code values corresponding to the one or more data blocks; When the sampling value does not reach the interval block threshold again, a read abnormality prompt message is generated.
8. The method according to claim 7, characterized in that The reading device has a reading area. When the reading device samples from the reading area, the spacer block threshold detection area, the data block threshold detection area, the data area, and the read completion detection area on the barcode sequentially pass through the reading area. In the direction of entering the reading area, the length of the spacer block in the read completion detection area is greater than the length of the spacer block in the data area. The determining whether the sampling value reaches the interval block threshold again includes: When the sampling value reaches the interval block threshold, a duration during which the sampling value reaches the interval block threshold is counted according to the data waveform to obtain a first duration; Comparing the first duration with the second duration; wherein the second duration is the duration during which the sampling value in the data region reaches the interval block threshold value calculated based on statistics of the data waveform; When the first duration is greater than the second duration, determining that the sampling value reaches the interval block threshold again; When the first duration is not greater than the second duration, it is determined that the sampling value does not reach the interval block threshold again.
9. The method according to claim 1, characterized in that The data waveform is obtained by pre-processing a waveform obtained by sampling the barcode by a reading device at a preset sampling frequency, with the sampling point number as the horizontal coordinate and the sampling value as the vertical coordinate.
10. The method according to claim 9, characterized in that The preprocessing comprises: extracting a plurality of sample values from the waveform in sequence in a sliding window manner; The average of the sample values extracted each time is calculated respectively, and the average is used as the sample value in the data waveform.
11. A barcode recognition device, characterized in that: The barcode includes a spacer block threshold detection area, a data block threshold detection area, and a data area. The spacer block threshold detection area is used to set a spacer block threshold, and the spacer block threshold represents a value range of sampling values corresponding to the spacer block. The data block threshold detection area is used to set a data block threshold, and the data block threshold represents a value range of sampling values corresponding to the data block. The data area includes one or more data blocks and one or more spacer blocks arranged in a certain order. The spacer blocks in the data area are used to separate adjacent data blocks. The device comprises: An acquisition module is used to acquire a data waveform; the data waveform is obtained based on a waveform obtained by sampling the barcode by a reader at a preset sampling frequency, with the sampling point number as the horizontal coordinate and the sampling value as the vertical coordinate; an interval block threshold setting module, configured to obtain and record the interval block threshold based on a sampling value corresponding to the interval block threshold detection area in the data waveform; a data block threshold setting module, configured to obtain and record the data block threshold based on a sampling value corresponding to the data block threshold detection area in the data waveform; an identification module, configured to identify, from the sampling values corresponding to the data region in the data waveform, code values corresponding to the one or more data blocks and the number of the interval blocks according to the interval block threshold and the data block threshold; The coding determination module is configured to determine the coding corresponding to the barcode according to the code values corresponding to the one or more data blocks when the number of the interval blocks reaches a preset number.
12. The device according to claim 11, characterized in that The spacer block threshold detection area, the data block threshold detection area and the data area are sequentially arranged according to the reading order of the reading device; The interval block threshold setting module is further configured to obtain and record the interval block threshold based on the sampling value when fluctuations in the sampling value of the data waveform are detected; The data block threshold setting module is further configured to obtain and record the data block threshold based on the sampling value when it is detected that the sampling value of the data waveform exceeds the interval block threshold; The identification module is further configured to identify the code values corresponding to the one or more data blocks and the number of the interval blocks according to the sampling value, the interval block threshold and the data block threshold after the sampling value of the data waveform reaches the interval block threshold for the second time.
13. The device according to claim 12, characterized in that The interval block threshold setting module is further used to determine that a sampling value fluctuation of the data waveform is detected when the sampling value of the data waveform exceeds an initial threshold; wherein the initial threshold is a value range of the sampling values counted before the barcode enters the reading area of the reading device.
14. The device according to claim 11, characterized in that The identification module is further configured to: identifying the interval blocks from the sampling values corresponding to the data region in the data waveform according to the interval block threshold, and obtaining the number of the interval blocks; The data block is identified from the sampling values corresponding to the data area in the data waveform according to the data block threshold, and a code value corresponding to the data block is determined.
15. The device according to claim 11, characterized in that The identification module is further configured to: Determine a peak or a trough according to a change trend of the sampling values corresponding to the data area in the data waveform; The data block sampling value corresponding to the peak or the trough is determined as the sampling value corresponding to the interval block in the data area.
16. The device according to claim 11 or 15, characterized in that The identification module is further configured to: Determine a trough or a peak according to a change trend of the sampling values corresponding to the data area in the data waveform; Determining whether the sampling value corresponding to the trough or the peak exceeds the data block threshold; When the sampling value corresponding to the trough or the peak exceeds the data block threshold, determining the data block sampling value corresponding to the trough or the peak as the sampling value corresponding to the first type of data block; When the sampling value corresponding to the trough or the peak does not exceed the data block threshold, determining the data block sampling value corresponding to the trough or the peak as the sampling value corresponding to the second type of data block; The first type of data blocks corresponds to a first code value, and the second type of data blocks corresponds to a second code value.
17. The device according to claim 12, characterized in that The barcode further includes a read completion detection area, wherein the read completion detection area includes a spacer block arranged after the data area according to the read order; the device further includes: a reading completion detection module, configured to determine whether the sampling value reaches the interval block threshold again after the number of the interval blocks reaches the preset number and before determining the code corresponding to the barcode according to the code values corresponding to the one or more data blocks; The code determination module is further configured to determine the code corresponding to the barcode according to the code values corresponding to the one or more data blocks when the sampling value reaches the interval block threshold again; The device further includes a prompt information generating module, which is used to generate read abnormality prompt information when the sampling value does not reach the interval block threshold again.
18. The device according to claim 17, characterized in that The reading device has a reading area. When the reading device samples from the reading area, the spacer block threshold detection area, the data block threshold detection area, the data area, and the read completion detection area on the barcode sequentially pass through the reading area. In the direction of entering the reading area, the length of the spacer block in the read completion detection area is greater than the length of the spacer block in the data area. The read completion detection module is further configured to: When the sampling value reaches the interval block threshold, a duration during which the sampling value reaches the interval block threshold is counted according to the data waveform to obtain a first duration; Comparing the first duration with the second duration; wherein the second duration is the duration during which the sampling value in the data region reaches the interval block threshold value calculated based on statistics of the data waveform; When the first duration is greater than the second duration, determining that the sampling value reaches the interval block threshold again; When the first duration is not greater than the second duration, it is determined that the sampling value does not reach the interval block threshold again.
19. The device according to claim 11, characterized in that The acquisition module is further configured to pre-process a waveform obtained by sampling the barcode by a reader at a preset sampling frequency, the waveform having the sampling point number as the horizontal coordinate and the sampling value as the vertical coordinate, to obtain the data waveform.
20. The device according to claim 19, characterized in that The acquisition module is further configured to: extracting a plurality of sample values from the waveform in sequence in a sliding window manner; The average of the sample values extracted each time is calculated respectively, and the average is used as the sample value in the data waveform.
21. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the processor is used to load and execute the at least one instruction or the at least one program to implement the barcode recognition method according to any one of claims 1 to 10.
22. A computer-readable storage medium, characterized in that The storage medium stores at least one instruction or at least one program. When the at least one instruction or the at least one program is loaded and executed by the processor, the barcode recognition method according to any one of claims 1 to 10 can be implemented.
23. A computer program product, characterized in that The method comprises at least one instruction or at least one program, and when the at least one instruction or the at least one program is loaded and executed by a processor, the method can implement the barcode recognition method according to any one of claims 1 to 10.
24. A card, characterized in that: Its material includes plastic, and a barcode is printed on the card. The barcode includes a spacer block threshold detection area, a data block threshold detection area and a data area. The spacer block threshold detection area is used to set the spacer block threshold, and the spacer block threshold represents the value range of the sampling value corresponding to the spacer block; the data block threshold detection area is used to set the data block threshold, and the data block threshold represents the value range of the sampling value corresponding to the data block; the data area includes one or more data blocks and one or more spacer blocks arranged in a certain order, and the spacer blocks in the data area are used to separate adjacent data blocks.
Citation Information
Patent Citations
Method of determining bar code type
CN105844200A
Colorized barcode identification method, electronic equipment and storage medium
CN107862234A
Card and bar code identification method and device, electronic equipment and storage medium
CN118153597A
Bar code and its reader
JP1999039447A