Card and barcode recognition method, device, electronic device and storage medium
By printing barcodes on hard plastic cards and using dynamic recognition methods, the problem of insufficient wear resistance of paper cards is solved, achieving higher recognition accuracy and extended service life.
Patent Information
- Application Number
- CN202410103550.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-25
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-01-25
AI Technical Summary
The strength and wear resistance of paper cards are insufficient, resulting in short service life and the encoded information is prone to wear, affecting the identification accuracy of card reading equipment.
The barcode is printed on the hard plastic card, and the separation block threshold detection area and the data block threshold detection area are used for electricity recognition. The data waveform is dynamically obtained to identify the code value and the number of interval blocks to improve the identification accuracy.
It extends the service life of the card, reduces the impact of card material and barcode material on the recognition results, improves the accuracy of the recognition results, and ensures the integrity of the data area by verifying the number of interval blocks.
Smart Images

Figure CN118153597B_ABST
Abstract
Description
Technical Field
[0001] 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
[0002] The card reader is used to identify the card and transmit data. For example, the card reader can obtain the data information carried by the card and output it to the processor and other computing control devices for further processing. Some card readers can identify cards that transmit data by power-on, inductive recognition, etc. Such cards can be, for example, TF cards, SD cards, metal cards or chip cards. There are also some card readers, such as children's learning machines, which have the function of non-electrical recognition of the cards inserted therein. Non-electrical recognition here refers to the recognition of the coded information on the card when no current passes through the card. In the related art, non-electrical recognition is usually performed by scanning the area on the card where the coded information such as barcodes and QR codes are set by radio frequency reflection to obtain the information in the card. Since the card used for non-electrical recognition does not need to have a built-in metal node or chip, it is mainly a paper card printed with coded information such as barcodes and QR codes. This type of card has the characteristics of lightness and low cost.
[0003] However, the strength and wear resistance of paper cards are limited. For devices that support multiple insertions and removals of the same card, the service life of paper cards is short. After a long period of use, the coded information on the paper card is likely to be worn out, resulting in the card reader being unable to correctly recognize it. To this end, some embodiments of this specification provide a hard plastic card with a barcode printed thereon, as well as a barcode recognition method, device, electronic device, and storage medium. Summary of the invention
[0004] Some embodiments of this specification are intended to provide a hard and wear-resistant card with a barcode printed on it, which improves the service life of the card to a certain extent. Some embodiments of this specification also provide a barcode recognition method, device, electronic device and storage medium, which can perform non-electrical recognition of the barcode on the card, reduce the influence of the card material and the barcode material on the recognition result to a certain extent, and improve the accuracy of the recognition result.
[0005] 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 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, 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 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; when the number of the interval blocks reaches the preset number, the code corresponding to the barcode is determined according to the code value corresponding to the one or more data blocks.
[0006] 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 sequentially arranged 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 the sampling value fluctuation of the data waveform is detected, the interval block threshold is obtained and recorded 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 the sampling value of the data waveform is detected to exceed the interval block threshold, the data block threshold is obtained and recorded based on the sampling value; the identifying of 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 includes: when the sampling value of the data waveform reaches the interval block threshold for the second time, the code value 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.
[0007] According to the barcode recognition method shown in some embodiments of the present specification, when the sampling value of the data waveform exceeds an initial threshold, it is determined that a sampling value fluctuation 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.
[0008] 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 to obtain 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.
[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 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.
[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 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.
[0011] 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.
[0012] According to the barcode recognition method shown in some embodiments of the present specification, the reading device has a reading area, and 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, and 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; compare 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 reaches 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 does not reach the interval block threshold again.
[0013] According to the barcode recognition method shown in some embodiments of this specification, the data waveform is obtained by preprocessing a 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.
[0014] 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.
[0015] 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, used to acquire a data waveform; the data waveform is obtained based on the barcode sampled 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 bar code according to the code value corresponding to the one or more data blocks when the number of the interval blocks reaches a preset number.
[0016] 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 sampling value fluctuation 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 value 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.
[0017] 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.
[0018] According to the barcode recognition device shown in some embodiments of the present 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.
[0019] According to the barcode recognition device shown in some embodiments of the present 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.
[0020] 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 according to 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.
[0021] According to the barcode recognition device shown in some embodiments of the present specification, the barcode also includes a read completion detection area, and the read completion detection area includes an interval block arranged after the data area according to the reading order; the device also includes a read 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 read abnormality prompt information when the sampling value does not reach the interval block threshold again.
[0022] According to the barcode recognition device shown in some embodiments of the present specification, the reading device has a reading area, and 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, and 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 for: 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; compare 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 reaches 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 does not reach the interval block threshold again.
[0023] According to the barcode recognition device shown in some embodiments of this specification, the acquisition module is also used to preprocess the waveform with the sampling point number as the horizontal coordinate and the sampling value as the vertical coordinate obtained by sampling the barcode by the reading device at a preset sampling frequency to obtain the data waveform.
[0024] 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.
[0025] One or more embodiments of the present 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 the present specification.
[0026] One or more embodiments of the present specification propose a computer-readable storage medium, in which at least one instruction or at least one program is stored. 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 the present specification.
[0027] One or more embodiments of the present specification propose a computer program product, including 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 a processor, the barcode recognition method described in one or more embodiments of the present specification can be implemented.
[0028] One or more embodiments of the present specification propose a card, the material of which 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.
[0029] 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 interval block threshold and the data block threshold based on the dynamically acquired data waveform each time the card is inserted, which improves 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 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 values corresponding to one or more data blocks. In this way, the non-electrical recognition of the barcode on the card is realized, and the influence of the card material and the barcode material on the recognition result is reduced to a certain extent, and the accuracy of the barcode recognition result is improved. 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. It should be noted that different embodiments may have 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 beneficial effects that may be obtained. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] This specification will be further explained by way of exemplary embodiments, which will be described in detail by way of the accompanying drawings. The same numbers in the drawings represent the same structures or steps.
[0031] Figure 1 It is a schematic diagram of a card provided in some embodiments of this specification.
[0032] Figure 2 It is a flowchart of a barcode recognition method provided in some embodiments of this specification.
[0033] Figure 3 It is a schematic diagram of a normal waveform corresponding to a barcode provided in some embodiments of this specification.
[0034] Figure 4 It is a schematic diagram of the measured waveform corresponding to the barcode provided in some embodiments of this specification.
[0035] Figure 5 It is another schematic diagram of the measured waveform corresponding to the barcode provided in some embodiments of this specification.
[0036] Figure 6 It is a flow chart of step S140 provided in some embodiments of this specification.
[0037] Figure 7 is another flow chart of step S140 provided in some embodiments of this specification.
[0038] Figure 8 This is another flow chart of step S140 provided in some embodiments of this specification.
[0039] Fig. 9 It is a flowchart of a barcode recognition method provided in some other embodiments of this specification.
[0040] Fig.10 It is a schematic block diagram of a barcode recognition device provided in some embodiments of this specification. DETAILED DESCRIPTION
[0041] In order 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 contents described below are some examples or embodiments of this specification. For ordinary technicians in this field, without paying creative work, the technical solutions or means disclosed in this specification can also be applied to other scenarios based on these technical contents.
[0042] It should be understood that the "system", "device", "unit" and / or "module" used in this specification is a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.
[0043] Unless otherwise specified, technical terms used in this specification to describe components, elements, etc. do not refer to the singular, but may also include the plural. Generally speaking, terms such as "include", "comprise", etc. only indicate that the steps, elements, or components that have been clearly identified are included, and these steps, elements, and components do not constitute an exclusive list, such as the method or device described may also include other steps or components.
[0044] Flowcharts are used in this specification to illustrate the operation steps performed by the device or system of the relevant embodiments, but unless otherwise specified, the order used to describe these steps should not be understood as a limitation on the order in which the steps are performed. A person of ordinary skill in the art can adjust the order in which these steps are performed based on the knowledge and information conveyed by the embodiments of this specification, and the adjustment includes but is not limited to swapping the order, merging multiple steps, and splitting a certain step.
[0045] 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, and its deformation resistance is between that of fiber and rubber, and has certain rigidity and wear resistance. Specifically, the plastic may further include polyvinyl chloride (PVC, polyvinylchloride), polyethylene glycol terephthalate (PET, polyethylene glycol terephthalate), polyvinyl chloride, polypropylene, polystyrene, etc. Printing a barcode on a plastic card can effectively solve the problem of short service life of the card. 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 identification and the actual value of the corresponding area of the barcode, which is prone to identification errors, non-identification, etc. For this reason, some embodiments of the present specification improve the barcode, and correspondingly provide a barcode identification method, device, electronic device and computer-readable storage medium, which can perform non-electrical identification on the barcode on the card, reduce the influence of the card material and the barcode material on the identification result to a certain extent, and improve the accuracy of the identification result.
[0046] The barcode recognition method 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, clock-in machines, 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, which are not limited by the embodiments of this specification.
[0047] The barcode identified by the barcode recognition method provided in some embodiments of the present specification includes 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.
[0048] 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, and 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 fixedly set. 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 by 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 sequence number as the horizontal coordinate and a sampling value as the vertical coordinate. Since the card, or specifically the barcode on the card, enters the card reading area in chronological order, the sampling point serial number can also reflect the sampling timing information corresponding to the sampling point and the front and rear position information of the sampling point corresponding to the area on the barcode. As an example, the sampling point with a larger sampling point serial number corresponds to the back area on the barcode.
[0049] Figure 1 is a schematic diagram of a card provided in some embodiments of this specification, specifically as Figure 1 As shown, a barcode is printed on the card, and the barcode is arranged in sequence according to the reading order of the reading device (such as when the card is inserted into the reading device, the various areas of the barcode on it pass through the direction of the reading area in sequence) spacer block threshold detection area, data block threshold detection area and data area. Figure 1In the example of , the interval block threshold detection area includes 1 white block, the data block threshold detection area includes 1 black block, the data area includes several black data blocks, several gray data blocks and several interval blocks separating adjacent data blocks, the black data block represents 0 in binary, the gray data block represents 1 in binary, and 10 data blocks arranged in different orders can express 2^10, i.e. 1024 different data.
[0050] 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 block is not limited to the above-mentioned white block, and the data block is not limited to the above-mentioned black block and gray block. The spacer block can be other color blocks, and the data block can also be other color blocks. 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 corresponding to the data block type in the data area to represent the data. For example, the data area includes three types of data blocks, and the encoding corresponding to the barcode can use ternary system to represent the data. The data area includes four types of data, and the encoding corresponding to the barcode can use quaternary system to represent 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 data blocks provided 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.
[0051] Figure 2 is a flowchart of a barcode recognition method provided in some embodiments of this specification. In some embodiments, Figure 2 The process shown can be represented by Fig.10 The barcode recognition device shown is implemented. Figure 2 As shown, in some embodiments, the method may include the following steps.
[0052] 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 coordinate and the sampling value as the vertical coordinate. In some embodiments, step S110 can be implemented by the acquisition module 310.
[0053] 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 in the previous text, and the description of the preprocessing can be found in the following text, which will not be repeated here.
[0054] As mentioned above, the card can be made of plastic materials with a certain degree of reflectivity, such as PVC and PET. In actual application scenarios, the reflectivity of the card, the color depth of the ink on the card, and the distance between the card and the reader after the card is inserted will affect the waveform read by the barcode.
[0055] Figure 3 is a schematic diagram of a normal waveform (i.e., a waveform obtained when there is no interference from factors such as reflection) corresponding to a barcode provided in some embodiments of this specification, and specifically Figure 3 As shown, the white block is the interval block, the white block corresponds to the highest level, the black block is the data block, the black block corresponds to the lowest level, the recognized code value is 0, and the gray block is the data block, the gray block corresponds to the middle level, and the recognized code value is 1.
[0056] Figure 4 is a schematic diagram of the measured waveform corresponding to the barcode provided in some embodiments of this specification, specifically, Figure 4 As shown in the figure, the sampling values corresponding to the white blocks, black blocks, and gray blocks in the barcode fluctuate. In other words, for a barcode printed on a card made of a material with a certain degree of reflectivity, such as PVC, the detection value of each color block in the barcode read by the photoelectric reader is a range, not a relatively fixed value.
[0057] Figure 5 is another schematic diagram of the measured waveform corresponding to the barcode provided in some embodiments of this specification, specifically as follows Figure 5 As shown, 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 that follows immediately. In the two card insertion processes, the range of the peak value in the left waveform is obviously different from the range of the peak value in the right waveform, but the range of the trough value in the left waveform is close to the range of the peak value in the right waveform. In other words, in 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.
[0058] To solve this problem, some embodiments of the present 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.
[0059] S120: Based on the sampling 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.
[0060] Please continue to refer to Figure 1In some embodiments, obtaining and recording the interval block threshold based on the sampling values corresponding to the interval block threshold detection area in the data waveform may include the following steps: the sampling values in the data waveform may be processed sequentially based on the horizontal coordinate, and when the sampling value fluctuation of the data waveform is detected, the interval block threshold is obtained and recorded based on the sampling value. In some embodiments, when the sampling value fluctuation of the data waveform is detected, multiple sampling values may be continuously obtained, and their average value may be recorded as the interval block threshold.
[0061] The interval block threshold detection area is used to determine the interval block threshold corresponding to each card insertion process, and the interval block threshold corresponding to each card insertion process is detected based on the same interval block threshold detection area. In other words, the interval block threshold detection area is used to calibrate the value range of the sampling value of the interval block in the same card insertion process.
[0062] 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, wherein the initial threshold is a value range of the sampling value counted before the barcode enters the reading area.
[0063] In some embodiments, a pad is provided in the reading area of the reading device, and the sampling value in the initial state is the sampling value corresponding to the pad read by the reading device before the card is inserted, and the interval between the sampling value corresponding to the pad and the sampling value threshold corresponding to the spacing block may be not less than a preset range, wherein the preset range may be set according to actual needs, and the preset range is preferably such that when the card is inserted, obvious fluctuations in the sampling value can be observed in the detection waveform. In this way, when the card is inserted, the sampling value read by the reading device will have obvious fluctuations, which can be used as a sign that the card has entered the reading state.
[0064] In some embodiments, the pad in the reading area can be black or approximately black, and the corresponding sampling value range is the same as or close to the data block threshold range. This setting is because the interval between the sampling value range of the black data block and the white spacing block is the largest. Setting the pad to black or approximately black can observe obvious sampling value fluctuations when the card is inserted. It should be noted that in other embodiments, the sampling value range corresponding to the pad can also be different from the data block threshold range, and other value ranges that can observe obvious sampling value fluctuations when the card is inserted can also be applied in this embodiment.
[0065] exist Figure 1 and Figure 3In the corresponding example, the spacer block is a white block, the data block is a black block, the pad 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, and the sampling value range of the spacer block is different from that of the data block. In the initial state, the reader detects the reading area and reads the sampling value corresponding to the pad. When the card is inserted, the reader reads the sampling value of the spacer block, and the sampling value will fluctuate greatly. If no large fluctuation in the sampling value is detected, it means that the barcode on the card has not entered the reading area, and the reader continues to poll the reading area.
[0066] S130: Based on the sampling value 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.
[0067] Please continue to refer to Figure 1 In some embodiments, based on the sampling value corresponding to the data block threshold detection area in the data waveform, obtaining and recording the data block threshold includes: continuing to sequentially process the sampling values in the data waveform based on the horizontal coordinate, and 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. In some embodiments, when it is detected that the sampling value of the data waveform exceeds the interval block threshold, multiple sampling values can be continuously obtained, and their average value can be recorded as the data block threshold.
[0068] 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.
[0069] S140: Identify the code values corresponding to one or more data blocks and the number of 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. In some embodiments, step S140 may be implemented by the identification module 340.
[0070] 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 sampling values corresponding to the data area in the data waveform according to 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 according to the sampling value, the interval block threshold and the data block threshold.
[0071] S150: When the number of the interval blocks reaches a preset number, determine the code corresponding to the barcode according to the code value corresponding to one or more data blocks. In some embodiments, step S150 may be implemented by the code determination module 350 .
[0072] The spacer blocks in the data area are used to separate adjacent data blocks. Generally speaking, when the number of bits of the encoded data 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 code corresponding to the barcode can be determined based on the code values of the multiple data blocks obtained. Figure 3 , the code values corresponding to the data blocks can be combined in sequence to obtain the code "1011011111". As another example, after the last data block in the data area of the barcode, an interval block belonging to the data area may not be set. After the number of interval blocks reaches a certain time (such as 30ms or 50ms, etc.) according to the preset data, it can be determined that the recognition of the data blocks in the data area has been completed. The aforementioned certain time can be understood as the time for the reader to recognize the last data block. Further, the code corresponding to the barcode can be determined based on the code values corresponding to the multiple data blocks obtained.
[0073] 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 to say, when the card enters the card reading device, the reading order of the barcode is 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 reading order of the barcode area can also be 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 data block threshold corresponding to the data block threshold detection area is that the interval between the data block threshold and the initial threshold satisfies a preset range, and the preset range enables the card to be identified by the fluctuation of the sampling value when entering the card reading area.
[0074] When it is necessary to explain, the number of the interval block threshold detection areas can be one or more, the number of the data block threshold detection areas can be one or more, and the number of the data areas can be one or more. In some possible implementations, the number of the interval block threshold detection areas is multiple and the number of the data areas is multiple, at least one interval block threshold detection area is set before the data area, and the other interval block threshold detection areas in the multiple interval block threshold detection areas are distributed between adjacent data areas, so that the interval block threshold can be corrected multiple times during a card insertion process. In some other possible implementations, the number of the data block threshold detection areas is multiple and the number of the 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 card insertion process. The above examples are only used to illustrate the possible implementation methods of the barcode, and should not be regarded as limiting the embodiments of this specification, because according to actual needs, the interval block threshold detection areas, data block threshold detection areas and data areas on the barcode can also have other combinations and distribution forms.
[0075] Figure 6 is a flow chart of step S140 provided in some embodiments of this specification. In some embodiments, Figure 6 The process shown can be implemented by the recognition module 340 in the barcode recognition device. Figure 6 As shown, in some embodiments, identifying code values corresponding to one or more data blocks and the number of interval blocks from sampling values corresponding to a data region in a data waveform based on an interval block threshold and a data block threshold may include the following steps.
[0076] S1411: Identify the interval blocks from the sampling values corresponding to the data area 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 direct comparison between the interval block threshold and the sampling values, and the number of interval blocks is counted.
[0077] S1412: 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. Figure 1 ,exist Figure 1 In the example of , step S1412 can be implemented as follows: determine the first type of data block based on a direct comparison between the data block threshold and the sampling value, determine the sampling values of the remaining data blocks in the data area as the second type of data blocks, and then determine the code value corresponding to the first type of data block and the code value corresponding to the second type of data block. Figure 1 As shown, the first type of data blocks corresponds to black blocks, and the second type of data blocks corresponds to gray blocks.
[0078] 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.
[0079] Figure 7 is another flow chart of step S140 provided in some embodiments of this specification. In some embodiments, Figure 7 The process shown can be implemented by the recognition module 340 in the barcode recognition device. Figure 7 As shown, in some embodiments, identifying code values corresponding to one or more data blocks and the number of interval blocks from sampling values corresponding to a data region in a data waveform according to an interval block threshold and a data block threshold may include the following steps.
[0080] 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.
[0081] 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.
[0082] S1422: Determine the sampling value corresponding to the peak or the trough as the sampling value corresponding to the interval block in the data area.
[0083] In some embodiments, Figure 1 As shown, the interval block corresponds to the peak, and step S1421 can be implemented as: determining the peak according to the change trend of the sampling value corresponding to the data area in the data waveform. Step S1422 can be implemented as: determining the sampling value corresponding to the peak as the sampling value corresponding to the interval block in the data area.
[0084] On the contrary, in some embodiments, when the interval block corresponds to a trough, step S1421 can be implemented as: determining the trough according to the variation trend of the sampling value corresponding to the data area in the data waveform. Step S1422 can be implemented as: determining the sampling value corresponding to the trough as the sampling value corresponding to the interval block in the data area.
[0085] Figure 8 is another flow chart of step S140 provided in some embodiments of this specification. In some embodiments, Figure 8 The process shown can be implemented by the recognition module 340 in the barcode recognition device. Figure 8 As shown, in some embodiments, identifying code values corresponding to one or more data blocks and the number of interval blocks from sampling values corresponding to a data region in a data waveform according to an interval block threshold and a data block threshold may include the following steps.
[0086] 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.
[0087] S1432: Determine whether the sampling value corresponding to the trough or peak exceeds the data block threshold.
[0088] S1433: When the sampling value corresponding to the trough or the peak exceeds the data block threshold, the data block sampling value corresponding to the trough or the peak is determined as the sampling value corresponding to the first type of data block.
[0089] S1434: When the sampling value corresponding to the trough or peak does not exceed the data block threshold, the data block sampling value 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.
[0090] In some embodiments, Figure 1 As shown, the interval block corresponds to the peak and the data block corresponds to the trough. Figure 8 The corresponding process can be implemented as follows: a trough is determined according to a change trend of the sampling value corresponding to the data area in the data waveform. It is determined whether the sampling value corresponding to the trough exceeds the data block threshold. When the sampling value corresponding to the trough exceeds the data block threshold, the data block sampling value corresponding to the trough is determined as the sampling value corresponding to the first type of data block. When the sampling value corresponding to the trough does not exceed the data block threshold, the data block sampling value corresponding to the trough is determined as the sampling value corresponding to the second type of data block. 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] On the contrary, in some embodiments, when the interval block corresponds to a trough and the data block corresponds to a peak, Figure 8 The corresponding process can be implemented as follows: a peak is determined according to a change trend of the sampling value corresponding to the data area in the data waveform. It is determined whether the sampling value corresponding to the peak exceeds the data block threshold. When the sampling value corresponding to the peak exceeds the data block threshold, the data block sampling value corresponding to the peak is determined as the sampling value corresponding to the first type of data block. When the sampling value corresponding to the peak does not exceed the data block threshold, the data block sampling value corresponding to the peak is determined as the sampling value corresponding to the second type of data block. 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.
[0092] The barcode recognition method shown in some embodiments of this specification is not limited by the order of the steps described, because according to some embodiments of this specification, some steps can be performed in other orders or simultaneously. For example, when executing step S140, Figure 7 and Figure 8 The processes shown can be performed simultaneously or first Figure 7 Re-execute the process shown Figure 8The process shown can be performed in the reverse order.
[0093] 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.
[0094] Fig. 9 is another flow chart of the barcode recognition method provided by some embodiments of this specification. In some embodiments, Fig. 9 The process shown can be represented by Fig.10 The barcode recognition device shown is implemented. Fig. 9 Steps S210 to S240 in the flowchart shown in FIG. Figure 2 The steps S110 to S140 are similar, and their detailed descriptions can be found in Figure 2 The relevant description will not be repeated here. Fig. 9 As shown, the method may further include the following steps after the number of interval blocks reaches a preset number and before determining the code corresponding to the barcode according to the code values corresponding to one or more data blocks.
[0095] S260: Determine whether the sampling value reaches the interval block threshold again; when the sampling value reaches the interval block threshold again, go to step S270; when the sampling value does not reach the interval block threshold again, go to step S280. In some embodiments, step S260 can be implemented by a reading completion detection module in the barcode recognition device.
[0096] Please continue to refer to Figure 1 When the number of interval blocks reaches the preset value, it means that the data has been read fully. At this time, if the subsequent sample value read falls into the interval block threshold, it means that the barcode on the card is still in the reading area corresponding to the reading device and the interval block read is the reading completion detection area. At this time, the card reader completes the reading of the barcode on the card. At this time, 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 the code determination module 350.
[0097] 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 jitters 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, moving in the direction of exiting the reading area during the barcode reading process, and then continuing 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.
[0098] 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.
[0099] 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 information is used to indicate that the card is not in place, and the reading error prompt information is used to indicate that an intermediate 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 the situation where the data area has not been completely 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 timely identified, and the reading abnormality prompt information is generated. Among them, the reading abnormality prompt information can be displayed in a combination of one or more of text, image, audio, light, etc.
[0100] In some embodiments, the reading device has a reading area, and 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, and 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, and when the duration of the read interval block is longer than the duration of the interval block read before, it means that the barcode reading is completed without considering the change of the insertion speed. Specifically, judging whether the sampling value reaches the interval block threshold again may include the following steps: 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 counted 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 reaches 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 does not reach the interval block threshold again.
[0101] The barcode recognition method provided in some embodiments of the present 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 preprocessed waveform 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.
[0102] Some embodiments of the present specification also provide a barcode recognition device, wherein the barcode recognized by the device 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.
[0103] Fig.10 is a structural block diagram of a barcode recognition device provided in some embodiments of this specification, specifically Fig.10 As shown, in one embodiment, the barcode recognition device may include the following modules: an acquisition module 310, used to acquire a data waveform; wherein the data waveform is obtained based on a waveform obtained by sampling the barcode by a reading device at a preset sampling frequency, with the sampling point sequence number as the horizontal coordinate and the sampling value as the vertical coordinate. An interval block threshold setting module 320, used to acquire 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 330, used to acquire 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 340, used to identify the code value corresponding to one or more data blocks and the number of 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 350, used to determine the coding corresponding to the barcode according to the code value corresponding to one or more data blocks when the number of interval blocks reaches a preset number.
[0104] For more information about each module, see Figure 2 as well as Figure 6~Figure 9 The relevant description of will not be repeated here. It should be understood that Fig.10 The system and its modules shown 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 dedicated design hardware. Those skilled in the art will understand that the above methods and systems can be implemented using computer executable instructions and / or control codes contained in a processor, such as a disk, CD or DVD-ROM, etc., and such codes are provided in a carrier medium or a memory of a programmable device. The system and its modules of this specification can not only be implemented by hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., but can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above hardware circuits and software (e.g., firmware).
[0105] It should be noted that the above description of the system and its modules is only for convenience of description and does not limit this specification to the scope of the embodiments. It is understandable that for those skilled in the art, after understanding the principle of the system, it is possible to arbitrarily combine the modules without deviating from this principle to form a subsystem connected to other modules. Or some modules may be split to obtain more modules or multiple units under the module. Such variations are all within the scope of the disclosure of this specification.
[0106] Some embodiments of the present specification also provide an electronic device, comprising 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 the present specification.
[0107] Some embodiments of the present specification also provide a non-transitory computer-readable storage medium, in which at least one instruction or at least one program is stored, 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 the present specification.
[0108] Optionally, in this embodiment, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, 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.
[0109] One or more embodiments of the present specification propose a computer program product, including 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 a processor, the barcode recognition method provided in the above-mentioned various optional implementations can be implemented.
[0110] 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 of the data blocks and one or more of the spacer blocks arranged in a certain order, and the spacer blocks in the data area are used to separate adjacent data blocks.
[0111] It 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 that 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, which improves 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, the non-electrical recognition of the barcode on the card is realized, and the influence of the card material and the barcode material on the recognition result is reduced to a certain extent, and the accuracy of the barcode recognition result is improved. In addition, by judging whether the number of identified interval blocks reaches the preset number, the integrity of the read barcode data area is verified, which is also conducive to improving the accuracy of the recognition result.
[0112] The basic concepts have been described above. Obviously, for those skilled in the art, the above detailed disclosure is only for example and does not constitute a limitation of this specification. Although not explicitly stated here, those skilled in the art may make various modifications, improvements and corrections to this specification. Such modifications, improvements and corrections are taught in this specification, so such modifications, improvements and corrections still belong to the spirit and scope of the exemplary embodiments of this specification.
Claims
1. A barcode recognition method, characterized in that: 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 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 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, obtaining and recording the interval block threshold; Based on the sampling value corresponding to the data block threshold detection area in the data waveform, obtaining and recording the data block threshold; 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 area 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 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 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 a fluctuation in the sampling value of the data waveform is detected, obtaining and recording the interval block threshold based on the sampling value; 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, acquiring 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 area 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 sampling value fluctuation of the data waveform is detected; wherein the initial threshold is a value range of the sampling values counted before the barcode enters a reading area of the reading device.
4. The method according to claim 1, 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 area in the data waveform according to the interval block threshold and the data block threshold comprises: Identify the interval blocks 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; 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, 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 area 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 wave peak or the wave 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 area 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; 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, the sampling value of the data block corresponding to the trough or the peak is determined 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 includes a spacer block arranged after the data area according to the read 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 according to the code values corresponding to the one or more data blocks: Determine 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 value corresponding to the one or more data blocks; When the sampling value does not reach the interval block threshold again, read abnormality prompt information 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 reading completion detection area on the barcode sequentially pass through the reading area, and in the direction of entering the reading area, the length of the spacer block of the reading completion detection area is greater than the length of the spacer block of 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, the duration of the sampling value reaching the interval block threshold is counted according to the data waveform to obtain a first duration; Compare the first duration with the second duration; wherein the second duration is the duration during which the sampling value in the data area reaches the interval block threshold value calculated based on the 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 preprocessing a waveform obtained by sampling the barcode by a reading device at a preset sampling frequency, with the sampling point sequence 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 sampling values from the waveform in sequence in a sliding window manner; The average of the sampling values extracted each time is calculated respectively, and the average is used as the sampling value in the data waveform.
11. A barcode recognition device, characterized in that: 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 comprises: An acquisition module, used for acquiring a data waveform; the data waveform is obtained based on 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; An interval block threshold setting module, used for acquiring and recording 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, used for acquiring and recording the data block threshold based on the 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, the 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 used 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 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 of 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 identification 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.
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 used for: Identify the interval blocks 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; 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 used for: 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 wave peak or the wave 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 used for: Determine a trough or a peak according to a change trend of the sampling values 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, the sampling value of the data block corresponding to the trough or the peak is determined 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 also 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 reading 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 reading completion detection area is greater than the length of the spacer block in the data area. The reading completion detection module is further used to: When the sampling value reaches the interval block threshold, the duration of the sampling value reaching the interval block threshold is counted according to the data waveform to obtain a first duration; Compare the first duration with the second duration; wherein the second duration is the duration during which the sampling value in the data area reaches the interval block threshold value calculated based on the 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 also used to pre-process the waveform obtained by sampling the barcode by the reading device 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.
20. The device according to claim 19, characterized in that The acquisition module is further used for: Extracting a plurality of sampling values from the waveform in sequence in a sliding window manner; The average of the sampling values extracted each time is calculated respectively, and the average is used as the sampling 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 as described in 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 as described in any one of claims 1 to 10 can be implemented.
23. A computer program product, characterized in that It 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, it can implement the barcode recognition method as described in 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.
