Code scanning method, system and device for code scanning
By analyzing the relative position between the barcode and the scanning frame, generating a control signal and adjusting the angle and interval area of the scanning frame to make it symmetrical, the problem of scanning accuracy and inefficiency in the existing technology is solved, and more efficient scanning and recognition is achieved.
Patent Information
- Application Number
- CN202411407978.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-10-10
AI Technical Summary
The existing code scanning technology lacks the relative position between the barcode and the code scanning box, which leads to inaccurate scanning and inefficient scanning and the inability to effectively adjust the scanning process.
By obtaining the scan image of the barcode in the scanning code box, analyzing the deviation data of the barcode, determining whether the relative position between it and the scanning code box is qualified. If it fails, a control signal will be generated, and the angle and interval area of the scanning code box are adjusted to make it symmetrical, thereby improving the accuracy of scanning code recognition.
It realizes accurate monitoring and control of the relative position of the barcode and the scanning frame, and improves the accuracy of scanning code recognition and analysis and processing efficiency.
Smart Images

Figure CN118917338B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of code scanning, and specifically relates to a code scanning method, a system and a device for code scanning. Background Art
[0002] As the wave of digitalization sweeps the world, code scanning technology, with its high efficiency and convenience, has become a bridge connecting the online and offline worlds, profoundly changing our lifestyles. From payment, identity authentication to information acquisition, code scanning is everywhere, greatly improving the efficiency of life and work.
[0003] A Chinese patent application with publication number CN112464679A discloses a code scanning method and a code scanning device, including: a first light source and a second light source, the first light source and the second light source have different colors, and the code scanning method includes: controlling the first light source to emit light, and obtaining a first scanning result of scanning a first graphic code; judging whether the first scanning result meets a preset condition; if not, switching to the second light source to emit light, and obtaining a second scanning result of scanning the first graphic code.
[0004] In the prior art, during the scanning process, there is a lack of analysis of the relative position between the barcode and the scanning frame. In practice, if this analysis is not performed, the accuracy of the scanning cannot be guaranteed, and when the relative position of the barcode and the scanning frame is unqualified, the impact and degree of impact cannot be analyzed, and accurate judgment of the scanning process adjustment cannot be achieved, which reduces the efficiency of the scanning analysis and processing and the scanning quality.
[0005] To this end, the present invention provides a code scanning method, system and device for code scanning. Summary of the invention
[0006] In order to make up for the deficiencies of the prior art, at least one technical problem raised in the background technology is solved.
[0007] The technical solution adopted by the present invention to solve the technical problem is: a code scanning method, comprising:
[0008] Obtain a scanned image of the barcode in the scanned frame, obtain deviation data of the barcode based on the scanned image, wherein the deviation data includes the distance between the top of the barcode and the edge of the scanned frame, process and analyze the deviation data, mark the barcode, obtain a prominent barcode, process and analyze the prominent barcode, and obtain a prominent performance value;
[0009] Based on the prominence value, it is determined whether the relative position between the barcode and the scanning frame is qualified, and if not, a control signal is generated;
[0010] Based on the control signal, an angle control value is obtained, and the angle of the code scanning frame is adjusted according to the angle control value;
[0011] After adjusting the angle of the code scanning frame, the adjusted code scanning image is obtained, and based on the code scanning image, the width data of the spacing area is obtained, wherein the width data includes a width value, and based on the width data, a symmetry performance value is obtained by processing and analyzing, and based on the symmetry performance value, it is judged whether the spacing area of the barcode in the code scanning image is symmetrical, and if it is asymmetrical, an asymmetry signal is generated;
[0012] Based on the asymmetry signal, the brightness value of the barcode in the scanned image is obtained, and a brightness change curve is constructed according to the brightness value of the barcode. Based on the brightness change curve, an asymmetry influence value is obtained through processing and analysis, and it is determined whether the asymmetry of the interval area of the barcode will affect the brightness of the barcode according to the asymmetry influence value;
[0013] Based on the influence of the asymmetry of the spacer area of the barcode on the brightness of the barcode, an influence evaluation value is obtained, and the influence degree of the asymmetry of the spacer area of the barcode on the brightness of the barcode is determined based on the influence evaluation value, and if the influence degree is high, a strong influence signal is generated;
[0014] Based on the strong influencing signal, a spacing adjustment value is obtained, and the code scanning frame is adjusted based on the spacing adjustment value to make the spacing area of the barcode symmetrical.
[0015] As a further technical solution of the present invention, the process of marking the barcode is:
[0016] Obtaining the top distance deviation of the barcode and the average of the top distance deviation of the barcode and comparing them;
[0017] If the top distance deviation of the barcode is greater than the mean top distance deviation of the barcode, the barcode is marked as a protruding barcode;
[0018] If the top distance deviation of the barcode is less than or equal to the mean top distance deviation of the barcode, the barcode is marked as a non-protruding barcode.
[0019] As a further technical solution of the present invention, the top distance deviation of the barcode and the mean value of the top distance deviation of the barcode are obtained by:
[0020] The distances between the top of all barcodes and the edge of the scanning box are summed and averaged to obtain the mean of the barcode top distances. The barcode top distance is subtracted from the mean of the barcode top distances, and the absolute value of the difference is taken to obtain the barcode top distance deviation. The top distance deviations of all barcodes are summed and averaged to obtain the mean of the barcode top distance deviations.
[0021] As a further technical solution of the present invention, the outstanding performance value is obtained by:
[0022] Obtain a protrusion quantity value SL and a protrusion degree value CD;
[0023] The obtained protrusion quantity value SL and protrusion degree value CD are processed by data, and the formula is: The outstanding performance value TC is obtained, wherein s1 and s2 are both preset proportional coefficients.
[0024] As a further technical solution of the present invention, the method for obtaining the protrusion quantity value SL is:
[0025] The number of protruding barcodes is counted and the ratio is processed with the total number of barcodes to obtain the protruding number value of the barcode, which is marked as SL.
[0026] As a further technical solution of the present invention, the protrusion degree value CD is obtained in the following manner:
[0027] The top distance deviation of the protruding barcode is processed by difference with the mean of the top distance deviation to obtain the relative deviation of the top distance of the barcode. The top distance relative deviations of all barcodes are summed and averaged to obtain the mean of the top distance relative deviation. The mean of the top distance relative deviation is processed by ratio with the mean of the top distance deviation to obtain the protrusion degree value, which is marked as CD.
[0028] As a further technical solution of the present invention, the angle control value is obtained by:
[0029] In the XY coordinate system, the tops of all barcodes are connected in sequence to obtain the top connection line of the barcode, the top connection line of the barcode is extended and intersected with the X-axis, and the angle formed by the top connection line after the extension and the X-axis is obtained to obtain the angle control value;
[0030] The angle of the code scanning frame is adjusted based on the angle adjustment value.
[0031] As a further technical solution of the present invention, the symmetry performance value is obtained by:
[0032] Obtain the width values of the spacers on both sides of the barcode, and sum and average them to obtain the theoretical value of width symmetry;
[0033] The width values of the spacers on both sides of the barcode are processed by difference, and the absolute value of the difference is taken to obtain the spacer width deviation value;
[0034] The symmetry performance value is obtained by ratioing the width deviation value of the interval area with the width symmetry theoretical value.
[0035] As a further technical solution of the present invention, the asymmetric influence value is obtained by:
[0036] Get the ascending sub-polylines, count the number of ascending sub-polylines and the number of descending sub-polylines respectively, and compare them;
[0037] If the number of ascending sub-fold lines is greater than the number of descending sub-fold lines, the ascending sub-fold lines are marked as target sub-fold lines, and the number of target sub-fold lines is ratioed to the number of brightness change sub-fold lines to obtain the asymmetric influence value YX;
[0038] If the number of ascending sub-fold lines is less than the number of descending sub-fold lines, the descending sub-fold lines are marked as target sub-fold lines, and the number of target sub-fold lines is ratio-processed with the number of brightness change sub-fold lines to obtain the asymmetric influence value YX.
[0039] As a further technical solution of the present invention, the method for obtaining the ascending sub-broken line is:
[0040] Divide the brightness change polyline into a plurality of brightness change sub-polylines, obtain the slope values of the brightness change sub-polylines, and mark the brightness change sub-polylines according to the slope values of the brightness change sub-polylines;
[0041] It should be noted that the two end points of the brightness change sub-polyline correspond to the brightness values corresponding to the two ringing barcodes;
[0042] If the slope value of the brightness change sub-line is greater than 0, the brightness change sub-line is marked as a rising sub-line.
[0043] As a further technical solution of the present invention, the method for obtaining the impact assessment value is:
[0044] Obtain the brightness deviation mean LDp, the variance value FCz of the brightness data group, and the asymmetric influence value YX;
[0045] The obtained brightness deviation mean LDp, the variance value FCz of the brightness data group and the asymmetric influence value YX are processed by the formula: An impact assessment value PG is obtained, wherein a1, a2 and a3 are all preset proportional coefficients.
[0046] As a further technical solution of the present invention, the brightness deviation mean LDp is obtained by:
[0047] Get the target sub-line, perform difference processing on the brightness values corresponding to the two ends of the target sub-line, obtain the brightness deviation corresponding to the target sub-line, sum and average the brightness deviations corresponding to all target sub-lines, obtain the brightness deviation mean, and mark it as LDp.
[0048] As a further technical solution of the present invention, the variance value FCz of the brightness data group is obtained as follows:
[0049] The brightness values of all barcodes are integrated into a brightness data group, and the variance value of the brightness data group is obtained and marked as FCz.
[0050] As a further technical solution of the present invention, the process of adjusting the code scanning frame based on the spacing adjustment value is as follows:
[0051] Get the spacing adjustment value, where the spacing adjustment value , where PC represents the interval width deviation value;
[0052] Compare the width values of the spacing areas on both sides of the barcode, and select the direction of the spacing area with the smaller width value as the direction for adjusting the barcode scanning frame;
[0053] Adjust the scanning frame according to the spacing adjustment value and the scanning frame adjustment direction.
[0054] Scanning system, including:
[0055] Position analysis module: when scanning a barcode, a scanned image of the barcode in the scanned frame is obtained, and based on the scanned image, deviation data of the barcode is obtained, wherein the deviation data includes the distance between the top of the barcode and the edge of the scanned frame, the deviation data is processed and analyzed, the barcode is marked, and a prominent barcode is obtained, and the prominent barcode is processed and analyzed to obtain a prominent performance value;
[0056] Position judgment module: judging whether the relative position between the barcode and the scanning frame is qualified based on the prominent performance value, and generating a control signal if it is unqualified;
[0057] The first control module: obtains an angle control value based on the control signal, and controls the angle of the code scanning frame according to the angle control value;
[0058] Symmetry analysis module: after adjusting the angle of the code scanning frame, the regulated code scanning image is obtained, and based on the code scanning image, the width data of the spacing area is obtained, wherein the width data includes a width value, and based on the width data, a symmetry performance value is obtained by processing and analyzing, and based on the symmetry performance value, it is judged whether the spacing area of the barcode in the code scanning image is symmetrical, and if it is asymmetrical, an asymmetry signal is generated;
[0059] Impact analysis module: Based on the asymmetric signal, the brightness value of the barcode in the scanned image is obtained, and a brightness change curve is constructed according to the brightness value of the barcode. Based on the brightness change curve, an asymmetric impact value is obtained through processing and analysis, and it is determined whether the asymmetry of the spacer area of the barcode will affect the brightness of the barcode according to the asymmetric impact value;
[0060] Impact assessment module: based on the influence of the asymmetry of the spacer area of the barcode on the brightness of the barcode, an impact assessment value is obtained, and the influence degree of the asymmetry of the spacer area of the barcode on the brightness of the barcode is judged based on the impact assessment value. If the influence degree is high, a strong influence signal is generated;
[0061] The second control module: based on the strong influencing signal, obtains the spacing adjustment value, and adjusts the code scanning frame based on the spacing adjustment value to make the spacing area of the barcode symmetrical.
[0062] A device for scanning codes, wherein the device for scanning codes is prepared according to a code scanning method.
[0063] The beneficial effects of the present invention are as follows:
[0064] 1. When scanning a code, obtain a scanned image of the barcode in the scanned frame, and based on the scanned image, obtain the deviation data of the barcode, wherein the deviation data includes the distance between the top of the barcode and the edge of the scanned frame. The deviation data is processed and analyzed to obtain a prominent performance value, and it is judged whether the relative position between the barcode and the scanned frame is qualified. If it is unqualified, an unqualified signal is generated. The present invention monitors the relative position between the barcode and the scanned frame, which is conducive to timely judging the qualification of the relative position between the barcode and the scanned frame, and is convenient for subsequent timely adjustment. Secondly, the angle of the scanned frame is adjusted by the angle adjustment value during scanning, so that the barcode is closer to the edge of the scanned frame, which is conducive to improving the accuracy of scanned code recognition.
[0065] 2. Obtain the scanned code image after adjustment, and based on the width data, process and analyze to obtain the symmetry performance value, and judge whether the spacing area of the barcode in the scanned code image is symmetrical based on the symmetry performance value. If it is asymmetrical, obtain the brightness value of the barcode in the scanned code image, and construct a brightness change curve based on the brightness value of the barcode. Based on the brightness change curve, process and analyze to obtain the asymmetry influence value, and judge whether the asymmetry of the spacing area of the barcode will affect the brightness of the barcode. The present invention analyzes whether the spacing area is symmetrical, and judges whether it affects the brightness of the barcode (affecting the uniform distribution of the light spot on the barcode) in the case of asymmetry, so as to facilitate the accurate judgment and analysis of subsequent scan code adjustment and improve the efficiency of scan code analysis and processing.
[0066] 3. Obtain an impact assessment value to determine the degree of influence of the asymmetric spacing area of the barcode on the brightness of the barcode. If the degree of influence is high, obtain a spacing adjustment value, and adjust the code scanning frame based on the spacing adjustment value to make the spacing area of the barcode symmetrical. The present invention adjusts the code scanning frame based on the case of a high degree of influence, thereby further improving the accuracy of code scanning. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The present invention will be further described below in conjunction with the accompanying drawings.
[0068] Figure 1 is a flowchart of the steps of the code scanning method according to an embodiment of the present invention;
[0069] Figure 2 It is a flowchart of the code scanning system described in an embodiment of the present invention. DETAILED DESCRIPTION
[0070] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further explained below in conjunction with specific implementation methods.
[0071] Example 1
[0072] like Figure 1 As shown, the code scanning method described in the embodiment of the present invention includes:
[0073] Step 1: When scanning a barcode, obtain a scanned image of the barcode in the scanned frame, obtain deviation data of the barcode based on the scanned image, wherein the deviation data includes the distance between the top of the barcode and the edge of the scanned frame, process and analyze the deviation data, mark the barcode, obtain a prominent barcode, process and analyze the prominent barcode, and obtain a prominent performance value;
[0074] It should be noted that the scanned image is the image when all barcodes are completely within the scanned frame;
[0075] In some embodiments, in the scanned code image, an XY rectangular coordinate system is constructed with the top edge of the scanned code frame as the X axis and the side edge of the scanned code frame as the Y axis;
[0076] It should be noted that the top edge of the code scanning frame is the edge of the code scanning frame that is perpendicular to all barcodes, and the side edge of the code scanning frame is the edge of the code scanning frame that is parallel to all barcodes;
[0077] Mark the end of the barcode close to the X-axis as the top, obtain the shortest vertical distance from the top of the barcode to the X-axis, and obtain the distance between the top of the barcode and the edge of the scanning box;
[0078] The distances between the top of all barcodes and the edge of the code scanning frame are summed and averaged to obtain the mean of the top distance of the barcodes. The top distance of the barcodes is subtracted from the mean of the top distance of the barcodes, and the absolute value of the obtained difference is taken to obtain the top distance deviation of the barcode. The top distance deviations of all barcodes are summed and averaged to obtain the mean of the top distance deviation of the barcodes.
[0079] Compare the barcode's tip distance deviation to the mean barcode's tip distance deviation:
[0080] If the top distance deviation of the barcode is greater than the mean top distance deviation of the barcode, the barcode is marked as a protruding barcode;
[0081] If the top distance deviation of the barcode is less than or equal to the mean top distance deviation of the barcode, the barcode is marked as a non-protruding barcode;
[0082] Count the number of protruding barcodes and perform ratio processing on the total number of barcodes to obtain the protruding number value of the barcode and mark it as SL;
[0083] The top distance deviation of the protruding barcode is processed by difference with the mean of the top distance deviation to obtain the top distance relative deviation of the barcode, the top distance relative deviations of all barcodes are summed and averaged to obtain the mean of the top distance relative deviation, the mean of the top distance relative deviation is processed by ratio with the mean of the top distance deviation to obtain the protrusion degree value, which is marked as CD;
[0084] The obtained protrusion quantity value SL and protrusion degree value CD are processed by data, and the formula is: Obtain a prominent performance value TC, where s1 and s2 are both preset proportional coefficients;
[0085] It should be noted that the meaning of the prominent performance value is: the prominent performance value is obtained by calculating the prominent quantity value SL and the prominent degree value CD, wherein the prominent quantity value SL reflects the proportion of the number of prominent barcodes. The greater the proportion, the greater the difference between the distance between the barcode and the edge of the scanning box and the overall distance level, and the higher the degree of unqualified relative position between the barcode and the scanning box. Similarly, the prominent degree value CD reflects the difference between the distance level between all prominent barcodes and the scanning box and the overall distance level. The greater the difference, the higher the degree of unqualified relative position between the barcode and the scanning box.
[0086] Step 2: judging whether the relative position between the barcode and the scanning frame is qualified based on the prominence performance value, and generating a control signal if it is unqualified;
[0087] In some embodiments, the prominence value is compared to a prominence threshold;
[0088] If the prominence value is greater than the prominence threshold, a control signal is generated;
[0089] If the prominence value is less than or equal to the prominence threshold, no action is taken;
[0090] Step 3: Based on the control signal, obtain the angle control value, and adjust the angle of the code scanning frame according to the angle control value;
[0091] Specifically, in the XY coordinate system, the tops of all the barcodes are connected in sequence to obtain the top connection line of the barcode, the top connection line of the barcode is extended and intersected with the X-axis, and the angle formed by the top connection line after the extension and the X-axis is obtained to obtain the angle control value;
[0092] Adjust the angle of the code scanning frame based on the angle control value;
[0093] The technical solution of the embodiment of the present invention is: when scanning a code, a scanning image of the barcode in the scanning frame is obtained, and based on the scanning image, the deviation data of the barcode is obtained, wherein the deviation data includes the distance between the top of the barcode and the edge of the scanning frame, the deviation data is processed and analyzed to obtain a prominent performance value, and whether the relative position between the barcode and the scanning frame is qualified is judged, and if unqualified, an unqualified signal is generated. The present invention monitors the relative position between the barcode and the scanning frame, which is conducive to timely judging the qualification of the relative position between the barcode and the scanning frame, and is convenient for subsequent timely adjustment. Secondly, the angle of the scanning frame is adjusted by the angle adjustment value during scanning, so that the barcode is closer to the edge of the scanning frame, which is conducive to improving the accuracy of scanning recognition.
[0094] Example 2
[0095] like Figure 1 As shown, based on Example 1, the code scanning method described in this embodiment of the present invention includes:
[0096] Step 4: After adjusting the angle of the barcode scanning frame, obtain the adjusted barcode scanning image, obtain the width data of the spacing area based on the barcode scanning image, wherein the width data includes a width value, and obtain a symmetry performance value based on the width data by processing and analyzing, and determine whether the spacing area of the barcode in the barcode scanning image is symmetrical based on the symmetry performance value, and if it is asymmetrical, generate an asymmetry signal;
[0097] It should be noted that the spacing area refers to the area formed by the outermost barcode and the side edge of the adjacent nearest scanning box among all the barcodes;
[0098] Specifically, the width values of the spacing areas on both sides of the barcode are obtained, and the sum and average are taken to obtain the width symmetry theoretical value;
[0099] The width values of the spacers on both sides of the barcode are processed by difference, and the absolute value of the difference is taken to obtain the spacer width deviation value;
[0100] The symmetry performance value is obtained by performing a ratio processing on the width deviation value of the interval area and the width symmetry theoretical value;
[0101] In some embodiments, the symmetry performance value is compared with the symmetry performance threshold, specifically:
[0102] If the symmetric representation value is greater than the symmetric representation value, it means that the spacer region of the barcode is asymmetric, generating an asymmetric signal;
[0103] If the symmetry representation value is less than or equal to the symmetry representation value, it means that the spacing area of the barcode is symmetrical, and no operation is performed;
[0104] Step 5: Based on the asymmetric signal, the brightness value of the barcode in the scanned image is obtained, and a brightness change curve is constructed according to the brightness value of the barcode. Based on the brightness change curve, an asymmetric influence value is obtained through processing and analysis, and it is determined whether the asymmetry of the spacer area of the barcode will affect the brightness of the barcode according to the asymmetric influence value;
[0105] Specifically, the barcodes are numbered in sequence, the brightness values of the barcodes are obtained, a two-dimensional coordinate system is constructed with the number as the X-axis and the brightness value as the Y-axis, and the brightness values of the barcodes are marked and connected in the coordinate system to obtain a brightness change line;
[0106] Divide the brightness change polyline into a plurality of brightness change sub-polylines, obtain the slope values of the brightness change sub-polylines, and mark the brightness change sub-polylines according to the slope values of the brightness change sub-polylines;
[0107] It should be noted that the two end points of the brightness change sub-polyline correspond to the brightness values corresponding to the two ringing barcodes;
[0108] If the slope value of the brightness change sub-line is greater than 0, the brightness change sub-line is marked as a rising sub-line;
[0109] If the slope value of the brightness change sub-line is less than 0, the brightness change sub-line is marked as a descending sub-line;
[0110] If the slope value of the brightness change sub-line is equal to 0, the brightness change sub-line is marked as an unchanged sub-line;
[0111] Count the number of ascending sub-lines and the number of descending sub-lines respectively, and compare them;
[0112] If the number of ascending sub-fold lines is greater than the number of descending sub-fold lines, the ascending sub-fold lines are marked as target sub-fold lines, and the number of target sub-fold lines is ratioed to the number of brightness change sub-fold lines to obtain the asymmetric influence value YX;
[0113] If the number of ascending sub-fold lines is less than the number of descending sub-fold lines, the descending sub-fold lines are marked as target sub-fold lines, and the number of target sub-fold lines is ratioed with the number of brightness change sub-fold lines to obtain the asymmetric influence value YX;
[0114] If the number of ascending sub-broken lines is equal to the number of descending sub-broken lines, it means that the asymmetry of the interval area of the barcode does not affect the brightness of the barcode;
[0115] In some embodiments, the asymmetric impact value YX is compared to an asymmetric impact threshold;
[0116] If the asymmetry impact value YX is greater than the asymmetry impact threshold, it means that the asymmetry of the spacer area of the barcode affects the brightness of the barcode;
[0117] If the asymmetry impact value YX is less than or equal to the asymmetry impact threshold, the asymmetry of the interval area of the barcode does not affect the brightness of the barcode;
[0118] The technical solution of the embodiment of the present invention is: obtaining the scanned code image after adjustment, processing and analyzing to obtain the symmetry performance value based on the width data, judging whether the spacing area of the barcode in the scanned code image is symmetrical based on the symmetry performance value, if it is asymmetrical, obtaining the brightness value of the barcode in the scanned code image, constructing a brightness change curve according to the brightness value of the barcode, and processing and analyzing to obtain the asymmetry influence value based on the brightness change curve, judging whether the asymmetry of the spacing area of the barcode will affect the brightness of the barcode. The present invention analyzes whether the spacing area is symmetrical, and judges whether it affects the brightness of the barcode (affecting the uniform distribution of the light spot on the barcode) in the case of asymmetry, so as to facilitate the accurate judgment and analysis of subsequent scan code adjustment and improve the efficiency of scan code analysis and processing.
[0119] Example 3
[0120] like Figure 1 As shown, based on Example 1 and Example 2, the code scanning method described in the embodiment of the present invention includes:
[0121] Step 6: based on the influence of the asymmetry of the spacer area of the barcode on the brightness of the barcode, an influence evaluation value is obtained, and based on the influence evaluation value, the influence degree of the asymmetry of the spacer area of the barcode on the brightness of the barcode is determined, and if the influence degree is high, a strong influence signal is generated;
[0122] Specifically, the target sub-fold line is obtained, the brightness values corresponding to the two ends of the target sub-fold line are subjected to difference processing to obtain the brightness deviation corresponding to the target sub-fold line, the brightness deviations corresponding to all target sub-fold lines are summed and averaged to obtain the brightness deviation mean, which is marked as LDp;
[0123] The brightness values of all barcodes are integrated into a brightness data group, and the variance value of the brightness data group is obtained and marked as FCz;
[0124] The obtained brightness deviation mean LDp, the variance value FCz of the brightness data group and the asymmetric influence value YX are processed by the formula: Obtaining an impact assessment value PG, where a1, a2, and a3 are all preset proportional coefficients;
[0125] It should be noted that the impact evaluation value PG means: by analyzing the degree of continuous change of the brightness of the barcode and the degree of dispersion of the brightness between the barcodes, it reflects the degree of influence of the asymmetry of the interval area of the barcode on the brightness of the barcode;
[0126] In some embodiments, the impact assessment value PG is compared to an impact assessment threshold;
[0127] If the impact evaluation value PG is greater than the impact evaluation threshold, it means that the asymmetry of the spacer area of the barcode has a high degree of influence on the brightness of the barcode, generating a strong impact signal;
[0128] If the impact assessment value PG is less than or equal to the impact assessment threshold, it means that the asymmetry of the spacer area of the barcode has a low impact on the brightness of the barcode;
[0129] Step 7: Based on the strong signal, obtain the spacing adjustment value, and adjust the code scanning frame based on the spacing adjustment value to make the spacing area of the barcode symmetrical;
[0130] Specifically, the spacing adjustment value , where PC represents the interval width deviation value;
[0131] Compare the width values of the spacing areas on both sides of the barcode, and select the direction of the spacing area with the smaller width value as the direction for adjusting the barcode scanning frame;
[0132] Adjust the code scanning frame according to the spacing adjustment value and the code scanning frame adjustment direction;
[0133] The technical solution of the embodiment of the present invention is: obtain an impact assessment value, determine the degree of influence of the asymmetry of the spacing area of the barcode on the brightness of the barcode, if the influence degree is high, obtain a spacing adjustment value, and adjust the code scanning frame based on the spacing adjustment value to make the spacing area of the barcode symmetrical. The present invention adjusts the code scanning frame based on the case of a high influence degree, thereby further improving the accuracy of code scanning.
[0134] Example 4
[0135] like Figure 2 As shown, the code scanning system described in the embodiment of the present invention includes:
[0136] Position analysis module: when scanning a barcode, a scanned image of the barcode in the scanned frame is obtained, and based on the scanned image, deviation data of the barcode is obtained, wherein the deviation data includes the distance between the top of the barcode and the edge of the scanned frame, the deviation data is processed and analyzed, the barcode is marked, and a prominent barcode is obtained, and the prominent barcode is processed and analyzed to obtain a prominent performance value;
[0137] Position judgment module: judging whether the relative position between the barcode and the scanning frame is qualified based on the prominent performance value, and generating a control signal if it is unqualified;
[0138] The first control module: obtains an angle control value based on the control signal, and controls the angle of the code scanning frame according to the angle control value;
[0139] Symmetry analysis module: after adjusting the angle of the code scanning frame, the regulated code scanning image is obtained, and based on the code scanning image, the width data of the spacing area is obtained, wherein the width data includes a width value, and based on the width data, a symmetry performance value is obtained by processing and analyzing, and based on the symmetry performance value, it is judged whether the spacing area of the barcode in the code scanning image is symmetrical, and if it is asymmetrical, an asymmetry signal is generated;
[0140] Impact analysis module: Based on the asymmetric signal, the brightness value of the barcode in the scanned image is obtained, and a brightness change curve is constructed according to the brightness value of the barcode. Based on the brightness change curve, an asymmetric impact value is obtained through processing and analysis, and it is determined whether the asymmetry of the spacer area of the barcode will affect the brightness of the barcode according to the asymmetric impact value;
[0141] Impact assessment module: based on the influence of the asymmetry of the spacer area of the barcode on the brightness of the barcode, an impact assessment value is obtained, and the influence degree of the asymmetry of the spacer area of the barcode on the brightness of the barcode is judged based on the impact assessment value. If the influence degree is high, a strong influence signal is generated;
[0142] The second control module: based on the strong influencing signal, obtains the spacing adjustment value, and adjusts the code scanning frame based on the spacing adjustment value to make the spacing area of the barcode symmetrical.
[0143] Example 5
[0144] The device for scanning a code described in an embodiment of the present invention includes: the device for scanning a code described in the present invention is prepared according to the code scanning method.
[0145] The above shows and describes the basic principles, main features and advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A code scanning method, characterized in that: include: Obtain a scanned image of the barcode in the scanned frame, obtain deviation data of the barcode based on the scanned image, wherein the deviation data includes the distance between the top of the barcode and the edge of the scanned frame, process and analyze the deviation data, mark the barcode, obtain a prominent barcode, process and analyze the prominent barcode, and obtain a prominent performance value; The process of marking the barcode is as follows: Obtaining the top distance deviation of the barcode and the average of the top distance deviation of the barcode and comparing them; If the top distance deviation of the barcode is greater than the mean top distance deviation of the barcode, the barcode is marked as a protruding barcode; If the top distance deviation of the barcode is less than or equal to the mean top distance deviation of the barcode, the barcode is marked as a non-protruding barcode; The outstanding performance value is obtained in the following manner: Obtain a protrusion quantity value SL and a protrusion degree value CD; The obtained protrusion quantity value SL and protrusion degree value CD are processed by data, and the formula is: Obtain a prominent performance value TC, where s1 and s2 are both preset proportional coefficients; The method for obtaining the protrusion quantity value SL is as follows: Count the number of protruding barcodes and perform ratio processing on the total number of barcodes to obtain the protruding number value of the barcode and mark it as SL; The protrusion degree value CD is obtained as follows: The top distance deviation of the protruding barcode is processed by difference with the mean of the top distance deviation to obtain the top distance relative deviation of the barcode, the top distance relative deviations of all barcodes are summed and averaged to obtain the mean of the top distance relative deviation, the mean of the top distance relative deviation is processed by ratio with the mean of the top distance deviation to obtain the protrusion degree value, which is marked as CD; Based on the prominence value, it is determined whether the relative position between the barcode and the scanning frame is qualified, and if not, a control signal is generated; Based on the control signal, an angle control value is obtained, and the angle of the code scanning frame is adjusted according to the angle control value; After adjusting the angle of the code scanning frame, the adjusted code scanning image is obtained, and based on the code scanning image, the width data of the spacing area is obtained, wherein the width data includes a width value, and based on the width data, a symmetry performance value is obtained by processing and analyzing, and based on the symmetry performance value, it is judged whether the spacing area of the barcode in the code scanning image is symmetrical, and if it is asymmetrical, an asymmetry signal is generated; Based on the asymmetry signal, the brightness value of the barcode in the scanned image is obtained, and a brightness change curve is constructed according to the brightness value of the barcode. Based on the brightness change curve, an asymmetry influence value is obtained through processing and analysis, and it is determined whether the asymmetry of the interval area of the barcode will affect the brightness of the barcode according to the asymmetry influence value; Based on the influence of the asymmetry of the spacer area of the barcode on the brightness of the barcode, an influence evaluation value is obtained, and the influence degree of the asymmetry of the spacer area of the barcode on the brightness of the barcode is determined based on the influence evaluation value, and if the influence degree is high, a strong influence signal is generated; Based on the strong influencing signal, a spacing adjustment value is obtained, and the code scanning frame is adjusted based on the spacing adjustment value to make the spacing area of the barcode symmetrical.
2. The code scanning method according to claim 1, characterized in that: The top distance deviation of the barcode and the average value of the top distance deviation of the barcode are obtained as follows: The distances between the top of all barcodes and the edge of the scanning box are summed and averaged to obtain the mean of the barcode top distances. The barcode top distance is subtracted from the mean of the barcode top distances, and the absolute value of the difference is taken to obtain the barcode top distance deviation. The top distance deviations of all barcodes are summed and averaged to obtain the mean of the barcode top distance deviations.
3. The code scanning method according to claim 1, characterized in that: The angle control value is obtained as follows: In the XY coordinate system, the tops of all barcodes are connected in sequence to obtain the top connection line of the barcode, the top connection line of the barcode is extended and intersected with the X-axis, and the angle formed by the top connection line after the extension and the X-axis is obtained to obtain the angle control value; The angle of the code scanning frame is adjusted based on the angle adjustment value.
4. The code scanning method according to claim 1, characterized in that: The symmetry performance value is obtained as follows: Obtain the width values of the spacers on both sides of the barcode, and sum and average them to obtain the theoretical value of width symmetry; The width values of the spacers on both sides of the barcode are processed by difference, and the absolute value of the difference is taken to obtain the spacer width deviation value; The symmetry performance value is obtained by ratioing the width deviation value of the interval area with the width symmetry theoretical value.
5. The code scanning method according to claim 1, characterized in that: The asymmetric influence value is obtained in the following manner: Get the ascending sub-polylines, count the number of ascending sub-polylines and the number of descending sub-polylines respectively, and compare them; If the number of ascending sub-fold lines is greater than the number of descending sub-fold lines, the ascending sub-fold lines are marked as target sub-fold lines, and the number of target sub-fold lines is ratioed to the number of brightness change sub-fold lines to obtain the asymmetric influence value YX; If the number of ascending sub-fold lines is less than the number of descending sub-fold lines, the descending sub-fold lines are marked as target sub-fold lines, and the number of target sub-fold lines is ratio-processed with the number of brightness change sub-fold lines to obtain the asymmetric influence value YX.
6. The code scanning method according to claim 5, characterized in that: The method for obtaining the rising sub-fold line is: Divide the brightness change polyline into a plurality of brightness change sub-polylines, obtain the slope values of the brightness change sub-polylines, and mark the brightness change sub-polylines according to the slope values of the brightness change sub-polylines; It should be noted that the two end points of the brightness change sub-polyline correspond to the brightness values corresponding to the two ringing barcodes; If the slope value of the brightness change sub-line is greater than 0, the brightness change sub-line is marked as a rising sub-line.
7. The code scanning method according to claim 6, characterized in that: The impact assessment value is obtained in the following manner: Obtain the brightness deviation mean LDp, the variance value FCz of the brightness data group, and the asymmetric influence value YX; The obtained brightness deviation mean LDp, the variance value FCz of the brightness data group and the asymmetric influence value YX are processed by the formula: An impact assessment value PG is obtained, wherein a1, a2 and a3 are all preset proportional coefficients.
8. The code scanning method according to claim 7, characterized in that: The brightness deviation mean LDp is obtained as follows: Get the target sub-line, perform difference processing on the brightness values corresponding to the two ends of the target sub-line, obtain the brightness deviation corresponding to the target sub-line, sum and average the brightness deviations corresponding to all target sub-lines, obtain the brightness deviation mean, and mark it as LDp.
9. The code scanning method according to claim 8, characterized in that: The variance value FCz of the brightness data group is obtained as follows: The brightness values of all barcodes are integrated into a brightness data group, and the variance value of the brightness data group is obtained and marked as FCz.
10. The code scanning method according to claim 1, characterized in that: The process of adjusting the code scanning frame based on the spacing adjustment value is as follows: Get the spacing adjustment value, where the spacing adjustment value , where PC represents the interval width deviation value; Compare the width values of the spacing areas on both sides of the barcode, and select the direction of the spacing area with the smaller width value as the direction for adjusting the barcode scanning frame; Adjust the scanning frame according to the spacing adjustment value and the scanning frame adjustment direction.
11. A code scanning system, the system being used to implement the code scanning method according to any one of claims 1 to 10, characterized in that: include: Position analysis module: when scanning a barcode, a scanned image of the barcode in the scanned frame is obtained, and based on the scanned image, deviation data of the barcode is obtained, wherein the deviation data includes the distance between the top of the barcode and the edge of the scanned frame, the deviation data is processed and analyzed, the barcode is marked, and a prominent barcode is obtained, and the prominent barcode is processed and analyzed to obtain a prominent performance value; Position judgment module: judging whether the relative position between the barcode and the scanning frame is qualified based on the prominent performance value, and generating a control signal if it is unqualified; The first control module: obtains an angle control value based on the control signal, and controls the angle of the code scanning frame according to the angle control value; Symmetry analysis module: after adjusting the angle of the code scanning frame, the regulated code scanning image is obtained, and based on the code scanning image, the width data of the spacing area is obtained, wherein the width data includes a width value, and based on the width data, a symmetry performance value is obtained by processing and analyzing, and based on the symmetry performance value, it is judged whether the spacing area of the barcode in the code scanning image is symmetrical, and if it is asymmetrical, an asymmetry signal is generated; Impact analysis module: Based on the asymmetric signal, the brightness value of the barcode in the scanned image is obtained, and a brightness change curve is constructed according to the brightness value of the barcode. Based on the brightness change curve, an asymmetric impact value is obtained through processing and analysis, and it is determined whether the asymmetry of the spacer area of the barcode will affect the brightness of the barcode according to the asymmetric impact value; Impact assessment module: based on the influence of the asymmetry of the spacer area of the barcode on the brightness of the barcode, an impact assessment value is obtained, and the influence degree of the asymmetry of the spacer area of the barcode on the brightness of the barcode is judged based on the impact assessment value. If the influence degree is high, a strong influence signal is generated; The second control module: based on the strong influencing signal, obtains the spacing adjustment value, and adjusts the code scanning frame based on the spacing adjustment value to make the spacing area of the barcode symmetrical.
12. A device for scanning a code, characterized in that: The device for scanning codes is prepared according to the code scanning method described in any one of claims 1 to 10.
Citation Information
Patent Citations
Code scanning method and code scanning equipment
CN112464679A
Graphics barcode scanning method and device, mobile terminal and storage medium
CN109033911A
Optical information reader
JP2004094876A