Code scanning light supplementing device
By analyzing barcode brightness and recognition time to generate a supplementary lighting signal, performing uniformity analysis after supplementary lighting, and selecting a suitable supplementary lighting method, the problem of low quality of supplementary lighting for barcode scanning is solved, and the success rate of barcode scanning and resource utilization efficiency are improved.
Patent Information
- Application Number
- CN202411722065.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-09-27
AI Technical Summary
In existing technologies, the quality of supplementary lighting for barcode scanning is low, and there is a lack of analysis on the uniformity of supplementary lighting, which leads to a decrease in the accuracy of barcode scanning and recognition. Furthermore, the analysis on the impact of brightness on the uniformity of supplementary lighting under conditions without supplementary lighting is insufficient.
By analyzing the barcode brightness value and recognition time, a signal to be supplemented with light is generated. After supplementing with light, uniformity analysis is performed, and dual-region or multi-region supplementation methods are selected to ensure the uniformity of supplementation.
It improves the accuracy and efficiency of QR code scanning with supplemental lighting, prevents unnecessary waste of resources, and ensures a high success rate for QR code scanning.
Smart Images

Figure CN119670775B_ABST
Abstract
Description
[0001] This divisional application is a divisional application of the Chinese patent application with application date of September 27, 2024, application number 2024113600074, and invention name “Code scanning fill light method and device”. Technical Field
[0002] The present invention belongs to the technical field of code scanning light filling, and in particular relates to a code scanning light filling method and device. Background Art
[0003] In a dimly lit environment, the success rate of scanning a barcode will drop significantly, affecting the user experience. In the existing technology, there is already fill light technology, but fill light technology methods often have problems such as low fill light quality. Therefore, it is particularly important to study a method and device for scanning barcodes with fill light.
[0004] A Chinese patent application with publication number CN109165539A discloses a method and device for providing fill-in light when scanning a barcode, comprising: obtaining a barcode scanning instruction, activating the camera's barcode scanning function, scanning an image, and storing the scanned image in a cache; recognizing the cached image; if recognition is unsuccessful, analyzing the image's brightness to determine whether the analyzed brightness is below a predetermined threshold; if the brightness is below the predetermined threshold, activating the flashlight function for fill-in light. Method 2 includes: upon obtaining a light-sensing instruction, activating the light-sensing function to sense the ambient light intensity; determining whether the light intensity is below a light intensity threshold; if the light intensity is below the light intensity threshold, activating the flashlight function for fill-in light, and activating the camera's barcode scanning function.
[0005] In the existing technology, there is a lack of analysis and evaluation of the accuracy of the fill light during the fill light process, that is, there is a lack of analysis of the uniformity of the fill light during the fill light process. If there is no analysis, uniform fill light of the barcode cannot be achieved, thereby reducing the accuracy of code scanning and recognition. In addition, in the existing technology, there is also a lack of analysis of whether the brightness of the barcode without fill light will affect the uniformity of the fill light, resulting in an inability to make a better choice of the fill light method, thereby reducing the quality of the fill light for code scanning and also leading to a reduction in the accuracy of code scanning.
[0006] To this end, the present invention provides a method and device for scanning code to fill in light. Summary of the Invention
[0007] In order to make up for the deficiencies of the prior art, at least one technical problem raised in the background technology is solved.
[0008] The technical solution adopted by the present invention to solve the technical problem is: a code scanning light filling method, comprising:
[0009] Under the condition of no fill light, an image of the barcode is captured by an image acquisition device and marked as an initial image. The initial image is processed and analyzed to obtain a brightness value of the barcode. The brightness value of the barcode is compared with a preset brightness threshold of the barcode to obtain a signal to be filled with light;
[0010] Based on the signal to be filled in with light, the barcode is recognized by the barcode scanning device. When the barcode is completely within the recognition frame of the barcode scanning device, the barcode is not recognized successfully, and real-time timing is started to obtain the cumulative recognition time. If the cumulative recognition time reaches the preset recognition time, and the barcode is still not recognized successfully, a fill-in light signal is generated.
[0011] Based on the determined fill light signal, the barcode is filled with light using a fill light device. During the fill light process, an image of the barcode after the fill light is obtained and marked as a fill light image. A uniformity analysis of the brightness within the barcode area of the fill light image is performed to obtain a fill light brightness uniformity value. Whether the fill light is uniform during scanning is determined based on the fill light brightness uniformity value, and a fill light status signal is generated. The fill light status signal includes a fill light uniformity signal and a fill light non-uniformity signal.
[0012] Based on the fill light non-uniformity signal, the initial image is analyzed to obtain the regional impact value. According to the regional impact value, it is determined whether the brightness of the barcode without fill light will affect the fill light non-uniformity. If it does, an impact signal is generated;
[0013] Based on the impact signal, the initial image is processed and analyzed to obtain a non-uniform concentration value, and a fill light mode is selected according to the non-uniform concentration value, wherein the fill light mode includes dual-area fill light and multi-area fill light.
[0014] As a further technical solution of the present invention, the brightness value of the barcode is obtained by:
[0015] The image processing database is used to convert the collected initial image into a grayscale image. The area where the barcode is located is marked as the barcode area in the grayscale image. The grayscale value of each pixel in the barcode area is obtained. The grayscale value of each pixel in the barcode area is summed and averaged to obtain the brightness value of the barcode.
[0016] As a further technical solution of the present invention, the method for generating the light signal to be filled is:
[0017] Comparing the brightness value of the barcode with a preset brightness threshold of the barcode;
[0018] If the brightness value of the barcode is lower than the preset barcode brightness threshold, it means that the brightness of the barcode does not meet the brightness requirement for scanning, and fill light is needed, generating a fill light signal.
[0019] As a further technical solution of the present invention, the method for obtaining the uniform brightness value of the fill light is:
[0020] The brightness highlight quantity value SL and the brightness highlight degree value CD are processed by the formula: The fill light brightness uniform value JY is obtained, where s1 and s2 are both preset proportional coefficients.
[0021] As a further technical solution of the present invention, the brightness highlight value SL is obtained as follows:
[0022] Compare the absolute deviation of the fill light brightness in the barcode sub-region with the mean absolute deviation of the fill light brightness in all barcode sub-regions;
[0023] If the absolute deviation of the fill light brightness in the barcode sub-region is greater than the average of the absolute deviations of the fill light brightness in all barcode sub-regions, then the barcode sub-region is marked as a brightness-highlighted sub-region;
[0024] The number of brightness-highlighted sub-regions is counted and compared with the number of barcode sub-regions to obtain a brightness-highlighted value, which is marked as SL.
[0025] As a further technical solution of the present invention, the brightness prominence value CD is obtained as follows:
[0026] Obtain the fill light brightness absolute deviation corresponding to the brightness-prominent sub-area, and perform subtraction processing on it with the mean of the fill light brightness absolute deviation to obtain the fill light brightness relative deviation of the brightness-prominent sub-area. Sum and average the fill light brightness relative deviations of all brightness-prominent sub-areas to obtain the mean of the fill light brightness relative deviation. Ratio the mean of the fill light brightness relative deviation with the mean of the fill light brightness absolute deviation to obtain the brightness prominence value, which is marked as CD.
[0027] As a further technical solution of the present invention, the method for obtaining the mean absolute deviation of the fill light brightness is:
[0028] Obtain the brightness value of each barcode sub-region in the fill light image, sum and average the brightness values in all barcode sub-regions to obtain the brightness mean of all barcode sub-regions, perform difference processing on the brightness value in the barcode sub-region and the brightness mean of all barcode sub-regions to obtain the fill light brightness deviation in the barcode sub-region, take the absolute value of the fill light brightness deviation in the barcode sub-region to obtain the fill light brightness absolute deviation in the barcode sub-region, sum and average the fill light brightness absolute deviations in all barcode sub-regions to obtain the average of the fill light brightness absolute deviations in all barcode sub-regions.
[0029] As a further technical solution of the present invention, the brightness value of the barcode sub-region is obtained by:
[0030] Obtain a fill-light image, divide the barcode area in the fill-light image into several barcode sub-areas of equal area, and use the image processing database to obtain the brightness value in the barcode sub-area, where the brightness value in the barcode sub-area is obtained by summing and averaging the grayscale values of all pixels in the barcode sub-area.
[0031] As a further technical solution of the present invention, the fill light status signal is generated in the following manner:
[0032] Compare the fill light brightness average value JY with the fill light brightness average threshold;
[0033] If the fill light brightness uniformity value JY is greater than the fill light brightness uniformity threshold, a fill light non-uniformity signal is generated;
[0034] If the fill light brightness uniformity value JY is less than or equal to the fill light brightness uniformity threshold, a fill light uniformity signal is generated.
[0035] As a further technical solution of the present invention, the regional influence value is obtained by:
[0036] Divide the barcode area in the initial image into several initial barcode sub-areas of equal area, obtain the brightness value of each initial barcode sub-area in the initial image, and based on the brightness value of each initial barcode sub-area in the initial image, obtain the brightness deviation, the absolute brightness deviation, and the average of the absolute brightness deviations of all initial barcode sub-areas, and perform processing and analysis to obtain a first impact value DYy, a second impact value DRy, and a third impact value DSy;
[0037] The obtained first impact value DYy, second impact value DRy and third impact value DSy are processed by the formula: The regional influence value QYy is obtained, where a1, a2, and a3 are all preset proportional coefficients.
[0038] As a further technical solution of the present invention, the first impact value DYy is obtained as follows:
[0039] Among all the brightness-prominent sub-regions, the brightness-prominent sub-region that coincides with the brightness-abnormal sub-region is marked as the first-affected sub-region;
[0040] The number of first-influence sub-regions is counted, and the first-influence value is obtained by performing ratio processing on the first-influence sub-regions and marking the first-influence value as DYy.
[0041] As a further technical solution of the present invention, the second impact value DRy is obtained as follows:
[0042] In the first affected sub-region, the brightness deviation and the fill light brightness deviation in the first affected sub-region are obtained, and a positive and negative comparison is performed. The affected sub-region is marked according to the comparison result, specifically:
[0043] If the brightness deviation in the first affected sub-region and the fill light brightness deviation are both positive or negative, the first affected sub-region is marked as the second affected sub-region;
[0044] The number of the second impact sub-regions is counted and the ratio is performed with the number of the first impact sub-regions to obtain a second impact value, which is marked as DRy.
[0045] As a further technical solution of the present invention, the third impact value DSy is obtained as follows:
[0046] In the second impact sub-region, the brightness deviation in the second impact sub-region is compared with the fill light brightness deviation, specifically:
[0047] If the brightness deviation in the second affected sub-region is equal to the fill light brightness deviation, the second affected sub-region is marked as the third affected sub-region;
[0048] The number of the third impact sub-regions is counted, and the ratio is performed with the number of the second impact sub-regions to obtain a third impact value, which is marked as DSy.
[0049] As a further technical solution of the present invention, the abnormal brightness sub-region is obtained by:
[0050] Compare the absolute brightness deviation within the initial barcode sub-region with the average absolute brightness deviation within all initial barcode sub-regions;
[0051] If the absolute brightness deviation in the initial barcode sub-region is greater than the average absolute brightness deviation in all initial barcode sub-regions, the initial barcode sub-region is marked as a brightness abnormal sub-region.
[0052] As a further technical solution of the present invention, the influencing signal is generated in the following manner:
[0053] Compare the regional impact value QYy with the regional impact threshold;
[0054] If the regional influence value QYy is greater than the regional influence threshold, an influence signal is generated.
[0055] As a further technical solution of the present invention, the non-uniform concentration value is obtained by:
[0056] The concentrated value JZ of the brightness highlight sub-region and the discrete brightness value LS of the brightness highlight sub-region are processed by the formula: The non-uniform concentration value FJ is obtained, where z1 and z2 are both preset proportional coefficients.
[0057] As a further technical solution of the present invention, the method for obtaining the concentrated value JZ of the brightness highlight sub-region is as follows:
[0058] The initial image is obtained, and the adjacent brightness-prominent subregions in the initial image are integrated into a continuous subregion. The number of continuous subregions is counted and the ratio is processed with the number of brightness-prominent subregions to obtain the concentration value of the brightness-prominent subregion and mark it as JZ.
[0059] As a further technical solution of the present invention, the brightness discrete value LS of the brightness highlight sub-region is obtained as follows:
[0060] The brightness values in all brightness-prominent sub-regions are integrated into a brightness value data group, and the variance value of the brightness value data group is obtained and marked as the brightness discrete value LS of the brightness-prominent sub-region.
[0061] As a further technical solution of the present invention, the process of selecting the fill light mode according to the non-uniform concentration value is as follows:
[0062] Compare the non-uniform concentration value FJ with the non-uniform concentration threshold;
[0063] If the non-uniform concentration value FJ is greater than the non-uniform concentration threshold, then the dual-area fill light is selected;
[0064] If the non-uniform concentration value FJ is less than or equal to the non-uniform concentration threshold, multi-area fill light is selected.
[0065] The code scanning fill light device includes:
[0066] Fill-light analysis module: Under the condition of no fill-light, the image of the barcode is captured by the image acquisition device and marked as the initial image. The initial image is processed and analyzed to obtain the brightness value of the barcode. The brightness value of the barcode is compared with the preset brightness threshold of the barcode to obtain the fill-light signal;
[0067] Fill light determination module: Based on the fill light signal, the barcode is identified by the barcode scanning device. When the barcode is completely within the recognition frame of the barcode scanning device, the barcode is not recognized successfully, and real-time timing is started to obtain the cumulative recognition time. If the cumulative recognition time reaches the preset recognition time and the barcode is still not recognized successfully, a fill light determination signal is generated;
[0068] Fill light uniformity analysis module: Based on the determined fill light signal, the fill light device is used to fill light the barcode. During the fill light process, the image of the barcode after fill light is obtained and marked as the fill light image. The brightness uniformity of the barcode area in the fill light image is analyzed to obtain the fill light brightness uniformity value. Based on the fill light brightness uniformity value, it is determined whether the fill light is uniform during scanning, and a fill light status signal is generated. The fill light status signal includes a fill light uniformity signal and a fill light non-uniformity signal.
[0069] Fill light interference analysis module: Based on the fill light non-uniformity signal, the initial image is analyzed to obtain the regional impact value. Based on the regional impact value, it is determined whether the brightness of the barcode without fill light will affect the fill light unevenness. If it does, an impact signal is generated;
[0070] Fill light selection module: Based on the impact signal, the initial image is processed and analyzed to obtain a non-uniform concentration value, and the fill light method is selected according to the non-uniform concentration value. The fill light methods include dual-area fill light and multi-area fill light.
[0071] The beneficial effects of the present invention are as follows:
[0072] 1. By comparing and analyzing the brightness values of the barcodes, a signal to be filled in is generated, and the fill-in signal is determined based on the cumulative analysis of the scanning time. This improves the accuracy of determining the fill-in for scanning and prevents unnecessary fill-in that wastes fill-in resources. Secondly, after the fill-in, the uniformity of the fill-in is determined to prevent uneven fill-in that may lead to scanning failure, thereby improving the accuracy of the fill-in.
[0073] 2. Based on the fill light non-uniform signal, the initial image is analyzed to obtain the regional influence value, and the regional influence value is used to determine whether the brightness of the barcode without fill light will affect the fill light unevenness. If it does, an influence signal is generated, and the initial image is processed and analyzed based on the influence signal to obtain the non-uniform concentration value. The fill light mode is selected according to the non-uniform concentration value, wherein the fill light mode includes dual-area fill light and multi-area fill light. The present invention analyzes whether the brightness of the barcode without fill light will affect the fill light unevenness, which is conducive to troubleshooting and analyzing the impact of its fill light unevenness. After determining that the brightness of the barcode without fill light will affect the fill light unevenness, the fill light mode is effectively selected by analyzing the concentration degree and brightness deviation of the brightness uneven area, thereby improving the fill light efficiency and fill light quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] The present invention will be further described below with reference to the accompanying drawings.
[0075] Figure 1 This is a flowchart of the steps of the code scanning light filling method described in Example 1 of the present invention;
[0076] Figure 2 This is a flowchart of the steps of the code scanning and light filling method described in Example 2 of the present invention.
[0077] Figure 3 This is a system module diagram of the code scanning and light supplement device described in Example 3 of the present invention. DETAILED DESCRIPTION
[0078] In order to make the technical means, creative features, objectives and effects achieved by the present invention easier to understand, the present invention is further described below in conjunction with specific implementation methods.
[0079] Example 1
[0080] like Figure 1 As shown, the code scanning fill light method according to the embodiment of the present invention includes:
[0081] Step 1: Under the condition of no fill light, use the image acquisition device to capture the image of the barcode and mark it as the initial image. The initial image is processed and analyzed to obtain the brightness value of the barcode. The brightness value of the barcode is compared with the preset brightness threshold of the barcode to obtain the signal to be filled light;
[0082] In some embodiments, the captured initial image is converted into a grayscale image using an image processing database, the area where the barcode is located is marked as the barcode area in the grayscale image, the grayscale value of each pixel in the barcode area is obtained, and the grayscale value of each pixel in the barcode area is summed and averaged to obtain the brightness value of the barcode;
[0083] It should be noted that image processing databases include but are not limited to Python's Pillow library and OpenCV library;
[0084] Comparing the brightness value of the barcode with a preset brightness threshold of the barcode;
[0085] If the brightness value of the barcode is higher than the preset barcode brightness threshold, it means that the brightness of the barcode meets the brightness requirement for scanning and no fill light is needed;
[0086] If the brightness value of the barcode is lower than the preset barcode brightness threshold, it means that the brightness of the barcode does not meet the brightness requirement for scanning, and fill light is needed, generating a fill light signal;
[0087] It should be noted that the brightness threshold of the barcode is set in advance by those skilled in the art according to the recognition specification requirements of the barcode scanning device;
[0088] Step 2: Based on the fill light signal, the barcode is recognized by the barcode scanning device. When the barcode is completely within the recognition frame of the barcode scanning device, the barcode is not recognized successfully, and real-time timing is started to obtain the cumulative recognition time. If the cumulative recognition time reaches the preset recognition time and the barcode is still not recognized successfully, a fill light signal is generated;
[0089] Step 3: Based on the determined fill light signal, the barcode is filled with light using a fill light device. During the fill light process, an image of the barcode after the fill light is obtained and marked as the fill light image. The brightness uniformity of the barcode area within the fill light image is analyzed to obtain a fill light brightness uniformity value. Whether the fill light is uniform during scanning is determined based on the fill light brightness uniformity value, and a fill light status signal is generated. The fill light status signal includes a fill light uniformity signal and a fill light non-uniformity signal.
[0090] In some embodiments, a fill-light image is obtained, and the barcode region in the fill-light image is divided into a plurality of barcode sub-regions of equal area. The brightness value within the barcode sub-region is obtained using an image processing database, wherein the brightness value within the barcode sub-region is obtained by summing and averaging the grayscale values of all pixels within the barcode sub-region.
[0091] Obtaining the brightness value of each barcode sub-region in the fill light image, summing and averaging the brightness values in all barcode sub-regions to obtain the brightness mean value of all barcode sub-regions, performing difference processing on the brightness value in the barcode sub-region and the brightness mean value of all barcode sub-regions to obtain the fill light brightness deviation in the barcode sub-region, taking the absolute value of the fill light brightness deviation in the barcode sub-region to obtain the fill light brightness absolute deviation in the barcode sub-region, summing and averaging the fill light brightness absolute deviations in all barcode sub-regions to obtain the average of the fill light brightness absolute deviations in all barcode sub-regions;
[0092] Compare the absolute deviation of the fill light brightness in the barcode sub-region with the mean absolute deviation of the fill light brightness in all barcode sub-regions;
[0093] If the absolute deviation of the fill light brightness in the barcode sub-region is greater than the average of the absolute deviations of the fill light brightness in all barcode sub-regions, then the barcode sub-region is marked as a brightness-highlighted sub-region;
[0094] If the absolute deviation of the fill light brightness in the barcode sub-region is less than or equal to the average of the absolute deviations of the fill light brightness in all barcode sub-regions, then the barcode sub-region is marked as a brightness non-prominent sub-region;
[0095] Count the number of brightness-highlighted sub-regions and compare it with the number of barcode sub-regions to obtain the brightness-highlighted value, which is marked as SL.
[0096] Obtain the fill light brightness absolute deviation corresponding to the brightness-prominent sub-region, and perform subtraction processing on it with the mean of the fill light brightness absolute deviation to obtain the fill light brightness relative deviation of the brightness-prominent sub-region. Sum and average the fill light brightness relative deviations of all brightness-prominent sub-regions to obtain the mean fill light brightness relative deviation. Ratio the mean fill light brightness relative deviation to the mean fill light brightness absolute deviation to obtain the brightness prominence value, which is marked as CD.
[0097] The obtained brightness highlight quantity value SL and brightness highlight degree value CD are processed by the formula: Get the fill light brightness uniform value JY, where s1 and s2 are both preset proportional coefficients;
[0098] It should be noted that the meaning of the fill light brightness uniformity value JY is that the fill light brightness uniformity value is calculated by the brightness highlight quantity value SL and the brightness highlight degree value CD, wherein the brightness highlight quantity value SL reflects the proportion of the barcode sub-regions in the barcode region after fill light, whose brightness is greatly different from the overall average brightness of the barcode region. The larger the brightness highlight quantity value SL, the more barcode sub-regions with uneven brightness are in the barcode region, and the worse the brightness uniformity in the barcode region. The brightness highlight degree value CD reflects the degree of deviation between the brightness of the barcode sub-regions with uneven brightness and the overall brightness of the barcode region, that is, the degree of brightness unevenness. The larger the brightness highlight degree value CD, the worse the brightness uniformity in the barcode region.
[0099] In some embodiments, the fill light brightness uniformity value JY is compared with the fill light brightness uniformity threshold;
[0100] If the fill light brightness uniformity value JY is greater than the fill light brightness uniformity threshold, it means that the barcode fill light is uneven, and a fill light non-uniformity signal is generated;
[0101] If the fill light brightness uniformity value JY is less than or equal to the fill light brightness uniformity threshold, it means that the barcode fill light is uniform, and a fill light uniformity signal is generated;
[0102] Based on the fill light uniform signal, code scanning and recognition are performed after fill light;
[0103] The technical solution of the embodiment of the present invention is: by comparing and analyzing the brightness values of the barcodes, a signal to be filled in is generated, and the fill light signal is determined based on the cumulative analysis of the scanning time, thereby improving the accuracy of determining the fill light for scanning and preventing unnecessary fill light for scanning, which leads to a waste of fill light resources. Secondly, after the fill light is filled in, the uniformity of the fill light is determined to prevent the problem of uneven fill light leading to scanning failure, thereby improving the accuracy of the fill light.
[0104] Example 2
[0105] like Figure 2 As shown, based on Example 1, the code scanning fill light method described in this embodiment of the present invention includes:
[0106] Step 4: Based on the fill light non-uniformity signal, analyze the initial image to obtain the regional impact value. Based on the regional impact value, determine whether the brightness of the barcode without fill light will affect the fill light non-uniformity. If it does, generate an impact signal.
[0107] Specifically, the barcode region in the initial image is divided into a number of initial barcode sub-regions of equal area;
[0108] It should be noted that the method of dividing the initial image into initial barcode sub-regions is the same as the method of dividing the fill light image into barcode sub-regions;
[0109] Obtaining the brightness value of each initial barcode sub-region in the initial image, and based on the brightness value of each initial barcode sub-region in the initial image, obtaining the brightness deviation, the absolute brightness deviation, and the average of the absolute brightness deviations in all initial barcode sub-regions;
[0110] It should be noted that the brightness value of each initial barcode sub-region in the initial image is obtained in the same manner as the brightness value of each barcode sub-region in the fill light image; the brightness deviation is obtained in the same manner as the fill light brightness deviation, the absolute brightness deviation is obtained in the same manner as the fill light brightness absolute deviation, and the average absolute brightness deviation of all initial barcode sub-regions is obtained in the same manner as the average absolute fill light brightness deviation of all barcode sub-regions.
[0111] Compare the absolute brightness deviation within the initial barcode sub-region with the average absolute brightness deviation within all initial barcode sub-regions;
[0112] If the absolute brightness deviation in the initial barcode sub-region is greater than the average absolute brightness deviation in all initial barcode sub-regions, then the initial barcode sub-region is marked as a brightness abnormal sub-region;
[0113] If the absolute brightness deviation in the initial barcode sub-region is less than or equal to the average absolute brightness deviation in all initial barcode sub-regions, then the initial barcode sub-region is marked as a brightness non-abnormal sub-region;
[0114] Among all the brightness-prominent sub-regions, the brightness-prominent sub-region that coincides with the brightness-abnormal sub-region is marked as the first-affected sub-region;
[0115] Count the number of first-influence sub-regions and perform ratio processing on the first-influence value with the number of brightness-highlighted sub-regions to obtain a first-influence value, which is marked as DYy.
[0116] In the first affected sub-region, the brightness deviation and the fill light brightness deviation in the first affected sub-region are obtained, and a positive and negative comparison is performed. The affected sub-region is marked according to the comparison result, specifically:
[0117] If the brightness deviation in the first affected sub-region and the fill light brightness deviation are both positive or negative, the first affected sub-region is marked as the second affected sub-region;
[0118] If the brightness deviation and fill light brightness deviation in the first impact sub-region are different positive or negative, no operation will be performed;
[0119] Count the number of the second impact sub-regions and perform a ratio processing on the second impact sub-regions to obtain a second impact value, which is marked as DRy;
[0120] In the second impact sub-region, the brightness deviation in the second impact sub-region is compared with the fill light brightness deviation, specifically:
[0121] If the brightness deviation in the second affected sub-region is equal to the fill light brightness deviation, the second affected sub-region is marked as the third affected sub-region;
[0122] If the brightness deviation in the second impact sub-region is not equal to the fill light brightness deviation, no operation is performed;
[0123] Count the number of the third impact sub-regions and perform a ratio processing on the third impact sub-region to obtain a third impact value, which is marked as DSy;
[0124] The obtained first impact value DYy, second impact value DRy and third impact value DSy are processed by the formula: Obtain the regional impact value QYy, where a1, a2, and a3 are preset proportional coefficients;
[0125] It should be noted that the meaning of the regional influence value QYy is: the regional influence value QYy is calculated through the first influence value DYy, the second influence value DRy and the third influence value DSy, among which the first influence value DYy reflects the proportion of the number of brightness-prominent sub-regions that coincide with the position of the brightness-abnormal sub-region. The larger the proportion, the higher the distribution similarity of the brightness-uneven sub-regions of the barcode before and after the fill light, which means that the brightness of the barcode before the fill light will affect the unevenness of the fill light. The second influence value DRy reflects the difference between the distribution similarity before and after the fill light. The proportion of sub-regions with the same positive and negative brightness deviations after fill light. A larger proportion indicates that the brightness deviations of the sub-regions with uneven brightness of the barcode before and after fill light are similar, which means that the brightness of the barcode before fill light will affect the unevenness of fill light. The third impact value DSy reflects the proportion of sub-regions with the same brightness deviations before and after fill light. A larger proportion indicates that the brightness deviations of the sub-regions with uneven brightness of the barcode before and after fill light are similar, which means that the brightness of the barcode before fill light will affect the unevenness of fill light.
[0126] In some embodiments, the regional influence value QYy is compared with a regional influence threshold;
[0127] If the regional impact value QYy is greater than the regional impact threshold, it means that the brightness of the barcode without fill light will affect the fill light unevenness, and an impact signal will be generated;
[0128] If the regional impact value QYy is less than or equal to the regional impact threshold, it means that the brightness of the barcode without fill light will not affect the fill light unevenness, and a no-impact signal is generated;
[0129] Based on the assumption that it does not affect the signal, other factors that affect the light uniformity are investigated and analyzed, including but not limited to the investigation of fill light equipment and barcode quality;
[0130] Step 5: Based on the impact signal, the initial image is processed and analyzed to obtain a non-uniform concentration value, and a fill light method is selected according to the non-uniform concentration value, wherein the fill light method includes dual-area fill light and multi-area fill light;
[0131] Among them, the meaning of dual-area fill light is: fill light is applied to two areas separately, and the meaning of multi-area fill light is: fill light is applied to more than two areas separately;
[0132] In some embodiments, an initial image is acquired, adjacent brightness-prominent subregions in the initial image are integrated into a continuous subregion, the number of continuous subregions is counted, and the number is compared with the number of brightness-prominent subregions to obtain a concentration value of the brightness-prominent subregions, which is marked as JZ;
[0133] Integrate the brightness values in all brightness-prominent sub-regions into a brightness value data group, obtain the variance value of the brightness value data group, and mark it as the brightness discrete value LS of the brightness-prominent sub-region;
[0134] The obtained concentrated value JZ of the brightness prominent sub-region and the brightness discrete value LS of the brightness prominent sub-region are processed, and the formula is: Obtain the non-uniform concentration value FJ, where z1 and z2 are both preset proportional coefficients;
[0135] It should be noted that the non-uniform concentration value FJ means that the non-uniform concentration value FJ is calculated by the concentration value JZ of the brightness-prominent sub-region and the brightness discrete value LS. The concentration value JZ of the brightness-prominent sub-region reflects the concentration degree of the brightness-prominent sub-region in the initial image. The higher the concentration degree, the more likely these brightness-prominent sub-regions can be treated as a whole area for fill light. The brightness discrete value LS reflects the brightness deviation between the brightness-prominent sub-regions. The smaller the brightness deviation between them, the more likely the brightness of the corresponding brightness sub-regions are similar, and the more likely these brightness-prominent sub-regions can be treated as a whole area for fill light.
[0136] In some embodiments, the non-uniform concentration value FJ is compared to a non-uniform concentration threshold;
[0137] If the non-uniform concentration value FJ is greater than the non-uniform concentration threshold, it means that these brightness-highlighted sub-regions can be treated as a whole region for fill light, and dual-region fill light is selected;
[0138] If the non-uniform concentration value FJ is less than or equal to the non-uniform concentration threshold, it means that these brightness-highlighted sub-regions cannot be treated as a whole region for fill light, and multi-region fill light is selected;
[0139] Based on dual-area fill light, all the sub-areas with prominent brightness are divided into one overall area for fill light, and the remaining sub-areas with non-prominent brightness are treated as one overall area for fill light;
[0140] Based on multi-area fill light, each sub-area with prominent brightness is filled with light independently, and the adjacent sub-areas with non-prominent brightness are integrated into an independent area for fill light;
[0141] The technical solution of the embodiment of the present invention is: based on the fill light non-uniform signal, its initial image is analyzed to obtain the regional influence value, and whether the brightness of the barcode under the condition of no fill light will affect the fill light unevenness is determined according to the regional influence value. If it does, an influence signal is generated, and based on the influence signal, its initial image is processed and analyzed to obtain the non-uniform concentration value, and its fill light mode is selected according to the non-uniform concentration value, wherein the fill light mode includes dual-area fill light and multi-area fill light. The present invention analyzes whether the brightness of the barcode under the condition of no fill light will affect the fill light unevenness, which is conducive to the investigation and analysis of the impact of its fill light unevenness, and after determining that the brightness of the barcode under the condition of no fill light will affect the fill light unevenness, by analyzing the concentration degree and brightness deviation of the brightness uneven area, its fill light mode is effectively selected to improve the fill light efficiency and fill light quality.
[0142] Example 3
[0143] like Figure 3 As shown, the barcode scanning light filling device according to the embodiment of the present invention includes:
[0144] Fill-light analysis module: Under the condition of no fill-light, the image of the barcode is captured by the image acquisition device and marked as the initial image. The initial image is processed and analyzed to obtain the brightness value of the barcode. The brightness value of the barcode is compared with the preset brightness threshold of the barcode to obtain the fill-light signal;
[0145] Fill light determination module: Based on the fill light signal, the barcode is identified by the barcode scanning device. When the barcode is completely within the recognition frame of the barcode scanning device, the barcode is not recognized successfully, and real-time timing is started to obtain the cumulative recognition time. If the cumulative recognition time reaches the preset recognition time and the barcode is still not recognized successfully, a fill light determination signal is generated;
[0146] Fill light uniformity analysis module: Based on the determined fill light signal, the fill light device is used to fill light the barcode. During the fill light process, the image of the barcode after fill light is obtained and marked as the fill light image. The brightness uniformity of the barcode area in the fill light image is analyzed to obtain the fill light brightness uniformity value. Based on the fill light brightness uniformity value, it is determined whether the fill light is uniform during scanning, and a fill light status signal is generated. The fill light status signal includes a fill light uniformity signal and a fill light non-uniformity signal.
[0147] Fill light interference analysis module: Based on the fill light non-uniformity signal, the initial image is analyzed to obtain the regional impact value. Based on the regional impact value, it is determined whether the brightness of the barcode without fill light will affect the fill light unevenness. If it does, an impact signal is generated;
[0148] Fill light selection module: Based on the impact signal, the initial image is processed and analyzed to obtain a non-uniform concentration value, and the fill light method is selected according to the non-uniform concentration value. The fill light methods include dual-area fill light and multi-area fill light.
[0149] The basic principles, main features, and advantages of the present invention are shown and described above. Those skilled in the art should understand that the present invention is not limited to the foregoing embodiments. The foregoing embodiments and descriptions are merely illustrative of the principles of the present invention. Various changes and modifications may be made to the present invention without departing from the spirit and scope of the present invention. Such changes and modifications are intended to fall within the scope of the present invention. The scope of protection claimed in the present invention is defined by the appended claims and their equivalents.
Claims
1. Scanning code fill light device, characterized by: include: Fill-light analysis module: Under the condition of no fill-light, the image of the barcode is captured by the image acquisition device and marked as the initial image. The initial image is processed and analyzed to obtain the brightness value of the barcode. The brightness value of the barcode is compared with the preset brightness threshold of the barcode to obtain the fill-light signal; Fill light determination module: Based on the fill light signal, the barcode is identified by the barcode scanning device. When the barcode is completely within the recognition frame of the barcode scanning device, the barcode is not recognized successfully, and real-time timing is started to obtain the cumulative recognition time. If the cumulative recognition time reaches the preset recognition time and the barcode is still not recognized successfully, a fill light determination signal is generated; Fill light uniformity analysis module: Based on the determined fill light signal, the fill light device is used to fill light the barcode. During the fill light process, the image of the barcode after fill light is obtained and marked as the fill light image. The brightness uniformity of the barcode area in the fill light image is analyzed to obtain the fill light brightness uniformity value. Based on the fill light brightness uniformity value, it is determined whether the fill light is uniform during scanning, and a fill light status signal is generated. The fill light status signal includes a fill light uniformity signal and a fill light non-uniformity signal. Fill light interference analysis module: Based on the fill light non-uniformity signal, the initial image is analyzed to obtain the regional impact value. Based on the regional impact value, it is determined whether the brightness of the barcode without fill light will affect the fill light unevenness. If it does, an impact signal is generated; Fill light mode selection module: Based on the impact signal, the initial image is processed and analyzed to obtain the non-uniform concentration value, and the fill light mode is selected according to the non-uniform concentration value. The fill light modes include dual-zone fill light and multi-zone fill light; The regional influence value is obtained by dividing the barcode area in the initial image into a number of initial barcode sub-areas of equal area, obtaining the brightness value of each initial barcode sub-area in the initial image, and processing the brightness deviation, absolute brightness deviation and average absolute brightness deviation of all initial barcode sub-areas based on the brightness value of each initial barcode sub-area in the initial image to obtain the first influence value DYy, the second influence value DRy and the third influence value DSy; performing data processing on the obtained first influence value DYy, the second influence value DRy and the third influence value DSy to obtain the regional influence value QYy; The concentrated value JZ of the brightness prominent sub-region and the discrete brightness value LS of the brightness prominent sub-region are processed to obtain the non-uniform concentrated value FJ; The method for obtaining the concentrated value JZ of the brightness prominent sub-region is as follows: obtaining an initial image, integrating adjacent brightness prominent sub-regions in the initial image into a continuous sub-region, counting the number of continuous sub-regions, and performing a ratio processing on the continuous sub-region and the ratio with the number of brightness prominent sub-regions to obtain the concentrated value of the brightness prominent sub-region, and marking it as JZ; The brightness discrete value LS of the brightness prominent sub-region is obtained by integrating the brightness values in all brightness prominent sub-regions into a brightness value data group, obtaining the variance value of the brightness value data group, and marking it as the brightness discrete value LS of the brightness prominent sub-region.
2. The barcode scanning light-filling device according to claim 1, characterized in that: In the fill light uniformity analysis module, the fill light brightness uniformity value is obtained as follows: The brightness highlight quantity value SL and the brightness highlight degree value CD are processed to obtain the fill light brightness uniformity value JY; Based on the fill light non-uniform signal, the initial image is analyzed to obtain the regional impact value. According to the regional impact value, it is determined whether the brightness of the barcode without fill light will affect the fill light non-uniformity. If it does, an impact signal is generated.
3. The code scanning light supplement device according to claim 2, characterized in that: The brightness prominence value CD is obtained as follows: Obtain the fill light brightness absolute deviation corresponding to the brightness-prominent sub-area, and perform subtraction processing on it with the mean of the fill light brightness absolute deviation to obtain the fill light brightness relative deviation of the brightness-prominent sub-area. Sum and average the fill light brightness relative deviations of all brightness-prominent sub-areas to obtain the mean of the fill light brightness relative deviation. Ratio the mean of the fill light brightness relative deviation with the mean of the fill light brightness absolute deviation to obtain the brightness prominence value, which is marked as CD.
4. The code scanning light supplement device according to claim 3, characterized in that: The method for obtaining the mean absolute deviation of fill light brightness is: Obtain the brightness value of each barcode sub-region in the fill light image, sum and average the brightness values in all barcode sub-regions to obtain the brightness mean of all barcode sub-regions, perform difference processing on the brightness value in the barcode sub-region and the brightness mean of all barcode sub-regions to obtain the fill light brightness deviation in the barcode sub-region, take the absolute value of the fill light brightness deviation in the barcode sub-region to obtain the fill light brightness absolute deviation in the barcode sub-region, sum and average the fill light brightness absolute deviations in all barcode sub-regions to obtain the average of the fill light brightness absolute deviations in all barcode sub-regions.
5. The barcode scanning light supplement device according to claim 4, characterized in that: The brightness value of the barcode sub-area is obtained as follows: Obtain a fill-light image, divide the barcode area in the fill-light image into several barcode sub-areas of equal area, and use the image processing database to obtain the brightness value in the barcode sub-area, where the brightness value in the barcode sub-area is obtained by summing and averaging the grayscale values of all pixels in the barcode sub-area.
6. The barcode scanning light supplement device according to claim 1, characterized in that: The process of selecting the fill light method according to the non-uniform concentration value is as follows: Compare the non-uniform concentration value FJ with the non-uniform concentration threshold; If the non-uniform concentration value FJ is greater than the non-uniform concentration threshold, then the dual-area fill light is selected; If the non-uniform concentration value FJ is less than or equal to the non-uniform concentration threshold, multi-area fill light is selected.
Citation Information
Patent Citations
A scanning code light supplementing method and device
CN109165539A
Two-dimensional code authenticated by opaque medium and authentication system thereof
CN110728163A
Method and device for reading two-dimensional code under complex background based on machine vision
CN111311226A