Parameter adjustment method, device and storage medium for a code reader
Patent Information
- Application Number
- CN202511428744.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2045-09-30
AI Technical Summary
[0003]然而,由于实际工业场景的环境较复杂,且读码器需要设置的参数较多,相关人员需要花费大量的时间来手动调整读码器的相关参数
Smart Images

Figure CN121503510B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of barcode reader technology, and in particular to a method, device and storage medium for adjusting the parameters of a barcode reader. Background Technology
[0002] Currently, barcode readers typically include mobile readers and fixed readers. Mobile readers read barcode images that are stationary, while fixed readers read barcode images that have moved into the field of view. When installing a fixed reader, the reader's parameters need to be adjusted according to the site environment to ensure the imaging effect of the barcode image acquired by the reader.
[0003] However, due to the complexity of the actual industrial environment and the large number of parameters that need to be set for the barcode reader, relevant personnel need to spend a lot of time manually adjusting the relevant parameters of the barcode reader.
[0004] Therefore, improving the efficiency of parameter adjustment for barcode readers has become an urgent technical problem to be solved. Summary of the Invention
[0005] The main technical problem addressed by this application is to provide a method, device, and storage medium for adjusting the parameters of a barcode reader, which can improve the efficiency of parameter adjustment of the barcode reader.
[0006] To solve the above-mentioned technical problems, one technical solution adopted in this application is: providing a parameter adjustment method for a barcode reader, the method comprising: selecting a light type that meets the requirements from a plurality of first light types as the optimal light type; determining a plurality of first brightness values within the brightness range of the optimal light type; for each first brightness value, adjusting imaging parameters to obtain at least one first barcode image corresponding to the first brightness value; and decoding each first barcode image to obtain a first decoding result for each first barcode image; wherein, the imaging parameters include at least one of exposure time and gain; and obtaining the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition as the optimal imaging parameter value for the barcode reader.
[0007] Optionally, selecting a suitable light type from a plurality of first light types as the optimal light type includes: determining multiple second brightness values corresponding to each first light type, wherein each second brightness value is within the brightness range of the corresponding first light type; adjusting imaging parameters to obtain at least one second barcode image corresponding to each second brightness value of each first light type; and decoding each second barcode image to obtain a second decoding result for each second barcode image; wherein the second decoding result of the second barcode image includes at least the number of decoded second barcode images; and combining the second decoding results of each first light type to determine the optimal light type.
[0008] Optionally, the optimal light type is determined by combining the second decoding results of each first light type, including: using the second decoding results of each first light type to obtain the first total decoding quantity corresponding to each first light type; selecting at least one second light type from each first light type whose first total decoding quantity meets the preset quantity requirement; and determining the optimal light type from at least one second light type.
[0009] Optionally, there may be multiple second light types, and the second decoding result of the second barcode image may also include the image decoding score of the second barcode image and the barcode decoding score of each decoded barcode of the second barcode image; determining the optimal light type from at least one second light type includes: determining the maximum decoding score among the first target decoding scores of the multiple second light types; wherein each first target decoding score is the image decoding score of the multiple second light types, or the barcode decoding score of the multiple second light types; and taking the second light type corresponding to the maximum decoding score as the optimal light type.
[0010] Optionally, for each second barcode image, the step of determining the image decoding score of the second barcode image includes: in response to the number of decoded bars in the second barcode image being equal to the number of barcodes in the second barcode image, combining the decoding scores of each barcode in the second barcode image to obtain the image decoding score of the second barcode image; in response to the number of decoded bars in the second barcode image being less than the number of barcodes in the second barcode image, determining the image decoding score of the second barcode image as a preset score.
[0011] Optionally, for each first light type, determining multiple second brightness values corresponding to the first light type includes: determining a first search step size for the first light type using the brightness range of the first light type and a preset number of step sizes; performing a brightness search based on the first reference brightness value using the first search step size to obtain multiple second brightness values within the brightness range of the first light type; wherein, the first reference brightness value is the image brightness value corresponding to the first successfully decoded third barcode image in the pre-search stage, and the third barcode images under different parameter combinations are decoded sequentially in the pre-search stage, and each parameter combination includes one of several third light types, one of several third brightness values, and one of several first preprocessing types.
[0012] Optionally, after obtaining the first reference brightness value, the method further includes: determining the first brightness count using the image decoding score of the third barcode image corresponding to the first reference brightness value; wherein the first brightness count is negatively correlated with the image decoding score of the third barcode image corresponding to the first reference brightness value; performing a brightness search based on the first reference brightness value with a second search step size to obtain a fourth brightness value of the first brightness count; wherein each fourth brightness value is located at the intersection of the brightness ranges of several first light types; in response to the number of second brightness values of the first light type being searched being less than a first quantity threshold, using the fourth brightness value of the first brightness count as multiple second brightness values corresponding to the first light type.
[0013] And / or, the step of determining a plurality of first light types includes: removing at least one fourth light type from a plurality of third light types to obtain a plurality of first light types; wherein all third barcode images under the fourth light type are not successfully decoded.
[0014] Optionally, each first target decoding score is a decoding score for each image of multiple second light types. Determining several first brightness values within the brightness range of the optimal light type includes: determining the image brightness of the second barcode image corresponding to the maximum decoding score as a second reference brightness value; determining the larger brightness value between the first and second reference brightness values as a baseline brightness value; wherein the first reference brightness value is the image brightness value corresponding to the first successfully decoded third barcode image in the pre-search phase; and searching for several first brightness values based on the baseline brightness value.
[0015] Alternatively, each target decoding score is a barcode decoding score for multiple second light types. Determine several first brightness values within the brightness range of the optimal light type, including: using the number of decoded second barcode images corresponding to the maximum decoding score as the first decoding quantity; determining the maximum barcode decoding score among all barcode decoding scores of each third barcode image in the pre-search phase, and using the number of decoded third barcode images corresponding to the maximum barcode decoding score as the second decoding quantity; using the image brightness corresponding to the larger of the first and second decoding quantities as a reference brightness value; and searching for several first brightness values based on the reference brightness value.
[0016] Optionally, based on the reference brightness value, several first brightness values are searched to obtain them, including: using the second target decoding score of the barcode image corresponding to the reference brightness to determine the number of second brightness values; wherein the number of second brightness values is negatively correlated with the second target decoding score; and performing brightness search with a third search step size based on the reference brightness value to obtain the first brightness values of the number of second brightness values, which are used as several first brightness values.
[0017] Optionally, before selecting the optimal light type from several first light types, a pre-search stage is included. The steps of the pre-search stage include: sequentially decoding the third barcode images under different parameter combinations to obtain the third decoding result of each third barcode image; wherein each parameter combination includes one of several third light types, one of several third brightness values, and one of several first preprocessing types; taking the first preprocessing type corresponding to the first successfully decoded third barcode image as the reference preprocessing type; determining whether the reference preprocessing type is a preset type; wherein the preset type indicates that no preprocessing is performed on the barcode image; if the reference preprocessing type is a preset type, determining whether the preprocessing shutdown condition is met; if the preprocessing shutdown condition is met, disabling the preprocessing function.
[0018] Optionally, the plurality of first preprocessing types include a plurality of erosion types and a plurality of dilation types, each erosion type corresponding to a different number of erosion processes, and each dilation type corresponding to a different number of dilation processes; determining whether the preprocessing closure condition is met includes: acquiring a first number of erosion types and a first number of dilation types; wherein the number of erosion processes corresponding to the first number of erosion types is equal to the number of dilation processes corresponding to the first number of dilation types; acquiring a fourth barcode image after processing by each target preprocessing type at a preset brightness value; wherein the target preprocessing type is one of the first number of erosion types and the first number of dilation types; decoding each fourth barcode image to obtain a fourth decoding result corresponding to each fourth barcode image; wherein the fourth decoding result of the fourth barcode image includes the number of decodings of the fourth barcode image; using the fourth decoding result of each fourth barcode image, calculating the second total number of decodings corresponding to the first number of erosion types and the third total number of decodings corresponding to the first number of dilation types; if the second total number of decodings is equal to the third total number of decodings, then it is determined that the preprocessing closure condition is met; if the second total number of decodings is not equal to the third total number of decodings, then it is determined that the preprocessing closure condition is not met.
[0019] Optionally, after determining that the preprocessing shutdown condition is not met, the method further includes: if the second total number of decodes is greater than the third total number of decodes, then selecting a preset type and each first preprocessing type similar to the erosion type from a plurality of first preprocessing types as a plurality of second preprocessing types; if the second total number of decodes is less than the third total number of decodes, then selecting a preset type and each first preprocessing type similar to the expansion type from a plurality of first preprocessing types as a plurality of second preprocessing types.
[0020] Optionally, after determining whether the reference preprocessing type is a preset type, the method further includes: if the reference preprocessing type is not a preset type, then selecting from a plurality of first preprocessing types each of the preset types and the reference preprocessing type as a plurality of second preprocessing types.
[0021] Optionally, the first decoding result of the first barcode image includes the image decoding score of the first barcode image. Obtaining the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition includes: determining whether the preprocessing function is enabled; in response to the preprocessing function not being enabled, taking the imaging parameter value corresponding to the first barcode image whose first image decoding score is greater than the first score threshold as the optimal imaging parameter value.
[0022] Optionally, the first decoding result of the first barcode image includes an image decoding score of the first barcode image. Obtaining the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition includes: selecting at least one first image decoding score from the image decoding scores of each first barcode image; in response to the total number of at least one first image decoding scores being less than or equal to a second quantity threshold, taking the imaging parameter value corresponding to the largest image decoding score among the at least one first image decoding scores as the optimal imaging parameter value; in response to the total number of at least one first image decoding scores being greater than the second quantity threshold, for each first image decoding score, combining the first image decoding score with the corresponding second quantity of reference image decoding scores to obtain a second image decoding score corresponding to the first image decoding score; and taking the imaging parameter value corresponding to the largest image decoding score among the second image decoding scores as the optimal imaging parameter value.
[0023] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide an electronic device, including a memory and a processor coupled to each other, wherein the memory stores program instructions; and the processor is used to execute the program instructions stored in the memory to implement the parameter adjustment method of the above-mentioned code reader.
[0024] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer-readable storage medium for storing program instructions that can be executed by a processor to implement the parameter adjustment method of the above-mentioned code reader.
[0025] The above scheme first selects the optimal light type from several first light types; then, it determines several first brightness values within the brightness range of the optimal light type; for each first brightness value, it adjusts the imaging parameters to obtain at least one first barcode image corresponding to the first brightness value; and then, it decodes each first barcode image to obtain a first decoding result for each first barcode image, wherein the imaging parameters include at least one of exposure time and gain; subsequently, it obtains the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition, and uses this as the optimal imaging parameter value for the barcode reader. In this method, by first determining the optimal light type and then adjusting the imaging parameters based on the optimal light type, it can reduce the repeated adjustment of imaging parameters under useless light types, thereby improving the parameter adjustment efficiency of the barcode reader. Attached Figure Description
[0026] Figure 1 This is a flowchart illustrating an embodiment of the parameter adjustment method for a barcode reader provided in this application; Figure 2 This is a flowchart illustrating the pre-search phase provided in this application; Figure 3 This is a flowchart illustrating another embodiment of the parameter adjustment method for the barcode reader provided in this application; Figure 4 This is a schematic diagram of the framework of an embodiment of the parameter adjustment device for the barcode reader provided in this application; Figure 5 This is a schematic diagram of the framework of an embodiment of the electronic device provided in this application; Figure 6 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation
[0027] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0028] It should be noted that the term "and / or" in this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The terms "first" and "second" in this application are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, features defined as "first" or "second" may explicitly or implicitly include at least one of those features. The term "multiple" in this application means at least two, such as two, three, etc. The term "multiple" in this application means at least two. The term "several" in this application means at least two. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0029] The parameter adjustment method for the barcode reader in this application can be performed by the barcode reader, a terminal device, or a server. The terminal device is connected to the barcode reader via communication; the terminal device can be a desktop computer, laptop, tablet, etc. The server is also connected to the barcode reader via communication.
[0030] A barcode reader is used to capture barcode images and decode them using a decoding algorithm to convert the barcodes in the image into readable numerical or textual information. A barcode image may include at least one barcode. The at least one barcode in the barcode image may consist only of a one-dimensional barcode, or only of a two-dimensional barcode, or both one-dimensional and two-dimensional barcodes.
[0031] In one example, the server analyzes the barcode image captured by the reader, or the server obtains the decoding result from the reader and analyzes it to determine the optimal parameters of the reader.
[0032] In another example, the reader has an embedded parameter adjustment program that allows it to automatically adjust its parameters and output the optimal parameters.
[0033] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the parameter adjustment method for a barcode reader provided in this application. It should be noted that if substantially the same result is achieved, the method of this application is not necessarily identical. Figure 1 The illustrated process sequence is limited. For example... Figure 1 As shown, the method includes the following steps: S11: Select the light type that meets the requirements from several first light types as the best light type.
[0034] The light source configured in the barcode reader is used to provide supplementary lighting when the reader acquires barcode images. Light type refers to the type of light emitted by the light source. Light type is one of the key factors affecting the quality of barcode images acquired by the reader. For example, several first light types include polarized light, unpolarized light, diffused light, natural light, etc.
[0035] In step S11, the optimal light type is first determined from several first light types. It is understood that the quality of the barcode image acquired under the optimal light type is better than the quality of the barcode image acquired under other first light types. Furthermore, after determining the optimal light type, the barcode reader can be configured to provide supplementary lighting for the acquired barcode image with the optimal light type, eliminating the need to iterate through other light types thereafter.
[0036] S12: Determine several first brightness values within the brightness range of the optimal lighting type.
[0037] The brightness ranges corresponding to different first light types may vary, and these brightness ranges can be pre-defined. After obtaining the optimal light type, the brightness range of the optimal light type is determined based on the mapping relationship between light type and brightness range. Brightness values are then selected within the brightness range of the optimal light type to obtain several first brightness values.
[0038] S13: For each first brightness value, adjust the imaging parameters to obtain at least one first barcode image corresponding to the first brightness value, and decode each first barcode image to obtain a first decoding result of each first barcode image.
[0039] The imaging parameters include at least one of exposure time and gain. That is, the imaging parameters may include only exposure time, or only gain, or both exposure time and gain may be included. It is understood that both exposure time and gain are related to image brightness, and adjusting the exposure time and gain can change the image brightness value of the acquired barcode image.
[0040] In step S13, each of the several first brightness values is sequentially acquired. For each first brightness value: if the preprocessing function is not enabled, the imaging parameters are adjusted and a first barcode image with a brightness value reaching the first brightness value is acquired. The first barcode image is then decoded to obtain the first decoding result of the first barcode image. If the preprocessing function is enabled, the imaging parameters are first adjusted and a barcode image with a brightness value reaching the first brightness value is acquired. Then, each preprocessing type in the preprocessing set is sequentially acquired and the acquired barcode image is preprocessed accordingly. Therefore, multiple first barcode images after different preprocessing can be obtained. Each first barcode image is then decoded sequentially to obtain the first decoding result of each first barcode image.
[0041] It should be noted that the difference between the image brightness value of each first barcode image and the corresponding first brightness value is less than the brightness difference threshold. The brightness difference threshold is a small value, and the specific value can be set according to actual needs.
[0042] S14: Obtain the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition, and use it as the optimal imaging parameter value for the barcode reader.
[0043] In some implementations, the first decoding result of the first barcode image includes the image decoding score of the first barcode image. The image decoding scores of each first barcode image are sequentially obtained, and the imaging parameter value corresponding to the first barcode image whose image decoding score is greater than a first score threshold is taken as the optimal imaging parameter value. The first score threshold is a relatively large value, and its specific setting can be determined according to actual needs, such as 90 points, 88 points, etc. Alternatively, the image decoding scores of all first barcode images can be obtained first, and the imaging parameter value corresponding to the highest image decoding score can be selected as the optimal imaging parameter value.
[0044] In one embodiment, the step of obtaining the image decoding score of the first barcode image includes: if the number of decoded bars in the first barcode image is equal to the number of barcodes in the first barcode image, that is, the first barcode image is fully decoded, then the image decoding score of the first barcode image is obtained by combining the decoding scores of each barcode in the first barcode image; if the number of decoded bars in the first barcode image is less than the number of barcodes in the first barcode image, that is, the first barcode image is partially decoded or not decoded, then the image decoding score of the first barcode image is determined to be a preset score.
[0045] The number of decoded bars in the first barcode image refers to the number of barcodes obtained after decoding the first barcode image. Each decoded barcode in the first barcode image has a corresponding barcode decoding score, which can be evaluated based on parameters such as the brightness, uniformity, and contrast of the corresponding decoded barcode.
[0046] When the number of decoded codes in the first barcode image is equal to the number of barcodes in the first barcode image, the average of the decoding scores of each barcode in the first barcode image can be obtained as the image decoding score of the first barcode image.
[0047] When the number of decoded codes for the first barcode image is less than the number of barcodes in the first barcode image, the image decoding score for the first barcode image can be set to a smaller score value, for example, the preset score is 0.
[0048] In this embodiment, the optimal light type is first selected from several first light types. Then, several first brightness values within the brightness range of the optimal light type are determined. For each first brightness value, the imaging parameters are adjusted to obtain at least one first barcode image corresponding to the first brightness value. Each first barcode image is then decoded to obtain a first decoding result, where the imaging parameters include at least one of exposure time and gain. Finally, the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition is obtained as the optimal imaging parameter value for the barcode reader. This method, by first determining the optimal light type and then adjusting the imaging parameters based on the optimal light type, reduces the need for repeated adjustments to the imaging parameters under useless light types, thus improving the parameter adjustment efficiency of the barcode reader.
[0049] In this embodiment, before determining the optimal light type, a pre-search stage is also included. During the pre-search stage, it is determined whether to turn off the pre-processing function, and when it is determined to turn on the pre-processing function, multiple second pre-processing types are selected from several first pre-processing types and added to the pre-processing set.
[0050] Please see Figure 2 , Figure 2 This is a flowchart illustrating the pre-search phase provided in this application. It should be noted that if substantially the same result is obtained, the method of this application does not necessarily reflect the intended outcome. Figure 2 The illustrated process sequence is limited. For example... Figure 2 As shown, the method includes the following steps: S201: Decode the third barcode images under different parameter combinations in sequence to obtain the third decoding result of each third barcode image.
[0051] Each parameter combination includes one of several third light types, one of several third brightness values, and one of several first preprocessing types.
[0052] In some implementations, the third brightness values corresponding to different third light types may be the same. For example, the intersection of the brightness ranges of several third light types is determined, and brightness values are selected within this intersection to obtain several third brightness values. Alternatively, different third light types may each correspond to different third brightness values. For example, brightness values are selected within the brightness range of each third light type to obtain several third brightness values corresponding to each third light type.
[0053] In one embodiment, the first preprocessing types include a preset type, an opening operation, a closing operation, several erosion types, and several dilation types. The preset type indicates that no preprocessing is performed on the barcode image; that is, the original barcode image is used. Each erosion type corresponds to a different number of erosion processes, and each dilation type corresponds to a different number of dilation processes. The opening operation involves erosion followed by dilation, which is similar to the erosion type. The closing operation involves dilation followed by erosion, which is similar to the dilation type.
[0054] For example, the number of the first preprocessing types is 13. The 13 first preprocessing types include: preset type, dilation 1, erosion 1, closing operation, opening operation, dilation 2, erosion 2, dilation 3, erosion 3, dilation 4, erosion 4, dilation 5, and erosion 5.
[0055] S202: Use the first preprocessing type corresponding to the first successfully decoded third barcode image as the reference preprocessing type.
[0056] In one embodiment, obtaining the reference preprocessing type in steps S201 and S202 may further include the following steps: Step 1: Select one third light type from several third light types as the current light type.
[0057] Step 2: Select one third brightness value from several third brightness values of the current light type as the current brightness value.
[0058] Step 3: Adjust the exposure time and gain so that the brightness of the acquired barcode image reaches the current brightness value.
[0059] Step 4: Select one of the several first preprocessing types as the current preprocessing type, and use the current preprocessing type to decode the acquired barcode image to obtain the third barcode image.
[0060] Step 5: Decode the third barcode image to obtain the third decoding result of the third barcode image.
[0061] Step 6: Use the third decoding result of the third barcode image to determine whether the third barcode image has been successfully decoded.
[0062] If the third barcode image fails to be decoded, proceed to step seven.
[0063] If the third barcode image is successfully decoded, proceed to step ten.
[0064] Step 7: Determine whether all of the first preprocessing types have been traversed.
[0065] If several first preprocessing types have not been fully traversed, step four is re-executed to obtain a new current preprocessing type and proceed with subsequent steps.
[0066] Once several first preprocessed types have been fully traversed, proceed to step eight.
[0067] Step 8: Determine whether all the third brightness values of the current light type have been traversed.
[0068] If several third brightness values of the current light type have not been completely traversed, repeat step two to obtain new current brightness values and proceed with subsequent steps.
[0069] If all the third brightness values for the current light type have been traversed, proceed to step nine.
[0070] Step nine: Determine whether all third light types have been completely traversed.
[0071] If several third light types have not been fully traversed, repeat step one to obtain the new current light type and proceed with subsequent steps.
[0072] When all third light types have been traversed, the third barcode image under all parameter combinations fails to decode, and step eleven is executed.
[0073] Step 10: Use the first preprocessing type corresponding to the third successfully decoded barcode image as the reference preprocessing type.
[0074] At this point, the third successfully decoded barcode image is the first successfully decoded third barcode image.
[0075] Step 11: The parameter adjustment failed.
[0076] In step eleven, after confirming that the parameter adjustment has failed, a prompt message can be output to indicate that the parameter adjustment has failed.
[0077] In one embodiment, the third decoding result of the third barcode image includes the number of times the third barcode image is decoded. If the number of times the third barcode image is decoded is equal to the number of barcodes in the third barcode image, that is, the third barcode image is fully decoded, then the third barcode image is considered to be successfully decoded; if the number of times the third barcode image is decoded is less than the number of barcodes in the third barcode image, that is, the third barcode image is partially decoded or not decoded, then the third barcode image is considered to have failed to decode.
[0078] In another embodiment, the third decoding result of the third barcode image includes the image decoding score of the third barcode image. If the image decoding score of the third barcode image is greater than or equal to a third score threshold, the third barcode image is considered to have been successfully decoded; if the image decoding score of the third barcode image is less than the third score threshold, the third barcode image is considered to have failed to decode. The third score threshold can be set according to actual needs. The process of determining the image decoding score of the third barcode image can refer to the process of determining the image decoding score of the first barcode image described above, and will not be repeated here.
[0079] Optionally, in this embodiment, if the image decoding score of the first successfully decoded third barcode image is greater than the fourth score threshold, the exposure time and gain corresponding to the third barcode image can be directly used as the optimal exposure time and optimal gain of the barcode reader, and the first preprocessing type corresponding to the third barcode image can be used as the optimal preprocessing type of the barcode reader, without the need for subsequent parameter adjustment. The fourth score threshold is a relatively high score threshold, which can be set according to actual needs.
[0080] S203: Determine whether the reference preprocessing type is a preset type.
[0081] If the reference preprocessing type is a preprocessing type, then steps S204 to S208 are executed to determine whether the preprocessing shutdown condition is met. Further, if the preprocessing shutdown condition is met, then step S209 is executed to disable the preprocessing function. If the preprocessing shutdown condition is not met, then the preprocessing function is enabled, and steps S210 to S212 are executed to select multiple second preprocessing types from a plurality of first preprocessing types.
[0082] If the reference preprocessing type is not a preprocessing type, then the preprocessing function is enabled, and step S213 is executed to select multiple second preprocessing types from a number of first preprocessing types.
[0083] S204: Obtain the first number of erosion types and the first number of expansion types.
[0084] The number of corrosion treatments corresponding to the first number of corrosion types is equal to the number of expansion treatments corresponding to the first number of expansion types. The first number can be set according to actual needs. For example, the first number can be 1, 2, or 3, etc.
[0085] In one embodiment, the first number of corrosion types obtained includes corrosion once and corrosion twice, and the first number of expansion types obtained includes expansion once and expansion twice.
[0086] In another embodiment, the first number of corrosion types obtained includes corrosion once, and the first number of expansion types obtained includes expansion once.
[0087] S205: Obtain the fourth barcode image after processing by each target preprocessing type at the preset brightness value.
[0088] The target preprocessing type is one of a first number of erosion types and a first number of dilation types. The preset brightness value can be any selected brightness value that results in good barcode image quality.
[0089] In one embodiment, the first number of erosion types acquired includes erosion 1 and erosion 2, and the first number of dilation types acquired includes dilation 1 and dilation 2. The exposure time and gain of the barcode reader are adjusted so that the image brightness value of the acquired barcode image reaches a preset brightness value, and the acquired barcode image is preprocessed with erosion 1, erosion 2, dilation 1, and dilation 2 respectively to obtain fourth barcode images corresponding to erosion 1, erosion 2, dilation 1, and dilation 2 respectively.
[0090] S206: Decode each fourth barcode image to obtain the fourth decoding result corresponding to each fourth barcode image.
[0091] The fourth decoding result of the fourth barcode image includes the number of times the fourth barcode image has been decoded.
[0092] S207: Using the fourth decoding results of each fourth barcode image, the second total decoding count corresponding to the first number of erosion types and the third total decoding count corresponding to the first number of dilation types are statistically obtained.
[0093] The second total number of decodes corresponding to the first number of erosion types can be understood as the total number of decodes in the erosion direction. The third total number of decodes corresponding to the first number of expansion types can be understood as the total number of decodes in the expansion direction.
[0094] S208: Determine whether the second total number of decodes is equal to the third total number of decodes.
[0095] If the second total number of decodes equals the third total number of decodes, then the preprocessing shutdown condition is met, and step S209 is executed.
[0096] If the second total number of decodes is not equal to the third total number of decodes, then it is determined that the preprocessing shutdown condition is not met, and steps S210 to S212 are further executed.
[0097] S209: Disable preprocessing function.
[0098] S210: Determine whether the second total number of decodes is greater than the third total number of decodes.
[0099] If the second total number of decodes is greater than the third total number of decodes, then proceed to step S211.
[0100] If the second total number of decodes is not greater than the third total number of decodes, that is, the second total number of decodes is less than the third total number of decodes, then proceed to step S212.
[0101] S211: Select a preset type and other first preprocessing types similar to the corrosion type from a number of first preprocessing types as multiple second preprocessing types.
[0102] In addition to the corrosion types, each of the first preprocessing types, similar to the corrosion types, may also include opening operations.
[0103] S212: Select a preset type and other first preprocessing types similar to the expansion type from a number of first preprocessing types as multiple second preprocessing types.
[0104] In addition to the expansion type, each of the first preprocessing types, similar to the expansion type, may also include the closing operation.
[0105] S213: Select from several first preprocessing types each first preprocessing type that is similar to the preset type and the reference preprocessing type as multiple second preprocessing types.
[0106] In one example, if the reference preprocessing type is erosion 1, then opening operation, erosion 2, erosion 3, erosion 4 and erosion 5 are selected from several first preprocessing types as first preprocessing types similar to erosion 1, and then a preset type is added to obtain multiple second preprocessing types.
[0107] In another example, if the reference preprocessing type is dilation 1, then opening, dilation 2, dilation 3, dilation 4, and dilation 5 are selected from several first preprocessing types as first preprocessing types similar to dilation 1, and then a preset type is added to obtain multiple second preprocessing types.
[0108] In another example, if the reference preprocessing type is the closing operation, then the expansion 1, expansion 2, expansion 3, expansion 4 and expansion 5 are selected from several first preprocessing types as first preprocessing types similar to the closing operation, and then a preset type is added to obtain multiple second preprocessing types.
[0109] In this embodiment, multiple second preprocessing types are obtained by filtering through the first successfully decoded reference preprocessing type. To facilitate the selection of multiple second preprocessing types from several first preprocessing types, the several first preprocessing types can be sorted and numbered. For example, they can be arranged in the order of the aforementioned 13 preprocessing types and numbered sequentially as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12.
[0110] When the total number of decoded values in the erosion direction is greater than the total number of decoded values in the dilation direction, or when the reference preprocessing type is a preprocessing type similar to the erosion type, the even-numbered first preprocessing type is selected as multiple second preprocessing types. In this case, the multiple second preprocessing types can be represented as follows: That is, corresponding to the preset type, 1st erosion, opening operation, 2nd erosion, 3rd erosion, 4th erosion and 5th erosion in sequence.
[0111] When the total number of decoded values in the erosion direction is less than the total number of decoded values in the dilation direction, or when the reference preprocessing type is a preprocessing type similar to the dilation type, the first preprocessing type with an odd number of bits is selected as multiple second preprocessing types. In this case, the multiple second preprocessing types can be represented as follows: That is, corresponding to the preset type, expansion 1 time, closing operation, expansion 2 times, expansion 3 times, expansion 4 times and expansion 5 times in sequence.
[0112] Furthermore, after obtaining multiple second preprocessing types, these types are added to the preprocessing set. During subsequent parameter adjustment, if the preprocessing function is enabled, each second preprocessing type in the preprocessing set can be iterated through.
[0113] In this embodiment, the first preprocessing type corresponding to the first successfully decoded third barcode image is obtained as a reference preprocessing type during the pre-search phase. When the reference preprocessing type is a preset type, it can be assumed that no preprocessing is performed on the barcode image, and a high-quality barcode image may be obtained. Considering that the first successful decoding may be accidental, and that the image quality of the preprocessed barcode image may be better than that of the unprocessed barcode image, the total number of decodes in the erosion direction and the total number of decodes in the dilation direction are further combined to accurately determine whether the preprocessing function can be disabled. If the preprocessing function is enabled, during parameter adjustment, it is not necessary to traverse the original large number of first preprocessing types; only a relatively small number of second preprocessing types in the preprocessing set need to be traversed, thereby improving the parameter adjustment efficiency of the barcode reader. If the preprocessing function is disabled, during parameter adjustment, it is not necessary to traverse each of the second preprocessing types in the preprocessing set, thereby further improving the parameter adjustment efficiency of the barcode reader.
[0114] Furthermore, in this embodiment, the image brightness value corresponding to the first successfully decoded third barcode image can also be used as the first reference brightness value.
[0115] Furthermore, after obtaining the first reference brightness value, the fourth brightness value for the first brightness count can be determined using the first reference brightness value and the image decoding score of the third barcode image corresponding to the first reference brightness value (i.e., the image decoding score corresponding to the first successfully decoded third barcode image). This process may include the following steps: Step 1: Determine the number of first brightness values by using the image decoding score of the third barcode image corresponding to the first reference brightness value.
[0116] The number of first brightness values is negatively correlated with the image decoding score of the third barcode image corresponding to the first reference brightness value. That is, the higher the image decoding score of the third barcode image corresponding to the first reference brightness value, the fewer first brightness values are selected. In this way, when adjusting the parameters of the fourth brightness value using the number of first brightness values, the time consumed by the barcode reader can be further reduced while ensuring the effect of the barcode reader parameter adjustment.
[0117] In one embodiment, if the image decoding score of the third barcode image corresponding to the first reference brightness value is greater than a fifth score threshold, then the number of first brightness values is determined to be a first preset number; if the image decoding score of the third barcode image corresponding to the first reference brightness value is less than or equal to the fifth score threshold, then the number of first brightness values is determined to be a second preset number. The first preset number is less than the second preset number. For example, the first preset number is 3, and the second preset number is 7. The fifth score threshold can be set according to actual needs.
[0118] Step 2: Based on the first reference brightness value, perform a brightness search with a second search step size to obtain the fourth brightness value of the first brightness count.
[0119] Each of the fourth brightness values lies at the intersection of the brightness ranges of several first light types. The second search step size can be preset according to actual needs.
[0120] For example, the fourth brightness value of the first number of brightness values found can be expressed as:
[0121] Please see Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of the parameter adjustment method for the barcode reader provided in this application. It should be noted that if substantially the same result is achieved, the method of this application is not necessarily identical. Figure 3 The illustrated process sequence is limited. For example... Figure 3 As shown, the method includes the following steps: S31: Determine multiple second brightness values corresponding to each of the several first light types.
[0122] Each of the second brightness values is within the brightness range of the corresponding first light type.
[0123] In one embodiment, several third light types in the aforementioned pre-search stage can be directly used as several first light types.
[0124] In another embodiment, at least one fourth light type is removed from a plurality of third light types to obtain a plurality of first light types. In this embodiment, all third barcode images under the fourth light type fail to be decoded. Since all third barcode images under each fourth light type fail to be decoded during the pre-search phase, these fourth light types are no longer considered as optimal light types. Therefore, these fourth light types directly removed from the plurality of third light types do not participate in subsequent traversal, further reducing the time spent adjusting the reader parameters.
[0125] For example, if the total number of third light types is allLightType, the first successfully decoded light type searchBestLT in the pre-search phase is used as the starting light type for traversal. When traversing and generating multiple second brightness values corresponding to each first light type, it can directly traverse from searchBestLT to (allLightType-1), without needing to traverse from 0 to (allLightType-1), i.e., it is not necessary to traverse all third light types. This is because the third light types from 0 to (searchBestLT-1) are all undecoded light types.
[0126] In one embodiment, for each first light type, determining multiple second brightness values corresponding to the first light type further includes: determining a first search step size for the first light type using the brightness range (or grayscale range) of the first light type and a preset number of step sizes; performing a brightness search based on a first reference brightness value using the first search step size to obtain multiple second brightness values located within the brightness range of the first light type. The first reference brightness value is the image brightness value corresponding to the first successfully decoded third barcode image in the pre-search phase. This process can be expressed by the following formula:
[0127] In this formula, step represents the first search step size; max and min represent the maximum and minimum values of the brightness range (or grayscale range) of the first light type, respectively; SEARCH_NUM_STEP is the preset number of steps; currentBright is the first reference brightness value; count varies from 0 to (SEARCH_NUM_STEP-1); This represents the second brightness value of the i-th light type of the first light type. For example, multiple representations of the second light type of the first light type can be expressed as follows: .
[0128] In one embodiment, considering that in the aforementioned embodiments, each second brightness value of the first light type is obtained by searching based on a first reference brightness value with a first search step size, the searched brightness values may exceed the brightness range of the first light type. Therefore, the number of multiple second brightness values of the first light type is actually less than or equal to the preset step size number. Further, if the number of searched second brightness values of the first light type is less than a first quantity threshold, it is considered that the number of searched second brightness values of the first light type is too small, or that no second brightness values of the first light type have been found. In this case, a fourth brightness value equal to the aforementioned determined first brightness number is used as the multiple second brightness values corresponding to the first light type. For example, the first quantity threshold can be set to 1, or the first quantity threshold can be set to 2.
[0129] S32: For each second brightness value of each first light type, adjust the imaging parameters to obtain at least one second barcode image corresponding to the second brightness value, and decode each second barcode image to obtain a second decoding result of each second barcode image.
[0130] In one embodiment, the imaging parameters include both exposure time and gain.
[0131] In one embodiment, for each second light type, the second brightness value of each second light type is acquired sequentially: when the preprocessing function is not enabled, the imaging parameters are adjusted and a second barcode image with an image brightness value reaching the second brightness value is acquired, and the second barcode image is decoded to obtain the second decoding result of the second barcode image; when the preprocessing function is enabled, the imaging parameters are first adjusted and a barcode image with a brightness value reaching the second brightness value is acquired, and then each second preprocessing type in the preprocessing set is acquired sequentially to perform corresponding preprocessing on the acquired barcode image. Therefore, multiple second barcode images after different preprocessing can be obtained, and each second barcode image is decoded sequentially to obtain the second decoding result of each second barcode image.
[0132] S33: Combine the second decoding results of each first light type to determine the optimal light type.
[0133] In step S33, the second decoding result of the second barcode image includes at least the number of decoded items of the second barcode image. The optimal light type is determined by combining the second decoding results of each first light type, including the following steps: Step 1: Using the second decoding results of each first light type, calculate the first total decoding count for each first light type.
[0134] In step one, for each first light type, the sum of the number of decoded second barcode images under the first light type is obtained as the first total number of decoded images for the first light type.
[0135] Step 2: Select at least one second light type from each first light type whose total number of decoded lights meets the preset requirement.
[0136] In one example, the preset quantity requirement is: the maximum total number of decodes.
[0137] In another example, the preset requirement is that the total number of decodes is greater than a third threshold. This third threshold can be set according to actual needs.
[0138] Step 3: Determine the optimal light type from at least one secondary light type.
[0139] In one embodiment, the number of second light types is one, and this second light type can be directly used as the optimal light type.
[0140] In another embodiment, there are multiple second light types. The second decoding result of the second barcode image also includes the image decoding score of the second barcode image and the barcode decoding score of each decoded barcode in the second barcode image. The optimal light type can be determined by further combining the image decoding scores or barcode decoding scores of the multiple second light types. Specifically, the maximum decoding score among the first target decoding scores of the multiple second light types is determined; the second light type corresponding to the maximum decoding score is taken as the optimal light type. Here, each first target decoding score is either the image decoding score of the multiple second light types or the barcode decoding score of the multiple second light types.
[0141] In the case of full decoding (all second barcode images are fully decoded), determine the maximum decoding score among the decoding scores of each image of multiple second light types; the second light type corresponding to the maximum decoding score is taken as the optimal light type.
[0142] In the case of partial decoding (each second barcode image is partially decoded), that is, the image decoding score of each second barcode image is a preset score, the maximum decoding score among the barcode decoding scores of multiple second light types is determined; the second light type corresponding to the maximum decoding score is taken as the optimal light type.
[0143] In one embodiment, for each second barcode image, the step of determining the image decoding score of the second barcode image includes: if the number of decoded bars in the second barcode image is equal to the number of barcodes in the second barcode image, i.e., the second barcode image is fully decoded, then the image decoding score of the second barcode image is obtained by combining the decoding scores of each barcode in the second barcode image; if the number of decoded bars in the second barcode image is less than the number of barcodes in the second barcode image, i.e., the second barcode image is partially decoded or not decoded, then the image decoding score of the second barcode image is determined to be a preset score. The process of determining the image decoding score of the second barcode image can refer to the process of determining the image decoding score of the first barcode image, and will not be repeated here.
[0144] S34: Determine the reference brightness value.
[0145] In the case of full decoding, the steps for determining the reference brightness value include: Step 1: Determine the image brightness of the second barcode image corresponding to the maximum decoding score, and use it as the second reference brightness value.
[0146] In this case, the maximum decoding score is the maximum score among the image decoding scores of the aforementioned multiple second light types.
[0147] Step 2: Determine the larger of the first and second reference brightness values as the base brightness value.
[0148] The first reference brightness value is the image brightness value corresponding to the third barcode image that is the first to be successfully decoded in the pre-search phase.
[0149] In the case of partial decoding, the steps for determining the reference brightness value include: Step 1: The number of times the second barcode image corresponding to the maximum decoding score is decoded is taken as the first decoding number.
[0150] In this case, the maximum decoding score is the highest score among the decoding scores of each of the aforementioned multiple second light types.
[0151] Step 2: Determine the maximum barcode decoding score among all barcode decoding scores of each third barcode image in the pre-search stage, and use the number of third barcode images corresponding to the maximum barcode decoding score as the second decoding number.
[0152] Step 3: Use the image brightness corresponding to the larger of the first and second decoding counts as the reference brightness value.
[0153] In step S34, the reference brightness value is determined in different ways for the full decoding case and the partial decoding case, which makes the determined reference brightness value more accurate and reasonable, thereby improving the accuracy and reasonableness of several first brightness values of the optimal light type determined in the subsequent process.
[0154] S35: Based on the reference brightness value, search for several first brightness values within the brightness range of the optimal light type.
[0155] In one embodiment, obtaining a plurality of first brightness values may include the following steps: Step 1: Determine the number of second brightness levels by using the second target decoding score of the barcode image corresponding to the reference brightness.
[0156] The second target decoding score is either the image decoding score of the barcode image corresponding to the reference brightness, or the maximum value among the decoding scores of each barcode in the barcode image corresponding to the reference brightness.
[0157] For example, if the baseline brightness is the first reference brightness value, then the second target decoding score is the image decoding score of the third barcode image that was successfully decoded first in the pre-search phase.
[0158] For example, if the reference brightness is the second reference brightness value, then the second target decoding score is the maximum decoding score among the image decoding scores of multiple second light types.
[0159] For example, if the baseline brightness is the image brightness corresponding to the first number of decodes mentioned above, then the second target decoding score is the maximum score among the decoding scores of each of the multiple second light types mentioned above.
[0160] For example, if the baseline brightness is the image brightness corresponding to the aforementioned second number of decodes, then the second target decoding score is the maximum barcode decoding score among all barcode decoding scores of each third barcode image in the pre-search stage.
[0161] In step one, the number of second brightness values is negatively correlated with the second target decoding score. That is, the higher the second target decoding score, the fewer second brightness values are selected. In this way, when adjusting the parameters of the first brightness value using the number of second brightness values, the time consumed by the reader parameter adjustment can be further reduced while ensuring the reader parameter adjustment effect.
[0162] In one example, if the second target decoding score is greater than the sixth scoring threshold, the second brightness count is determined to be the third preset count; if the second target decoding score is less than or equal to the sixth scoring threshold, the second brightness count is determined to be the fourth preset count. The third preset count is less than the fourth preset count. For example, the third preset count is 5, and the fourth preset count is 9. The sixth scoring threshold can be set according to actual needs.
[0163] Step 2: Based on the baseline brightness value, perform a brightness search with a third search step size to obtain the first brightness value of the second brightness number, which is used as several first brightness values.
[0164] In steps one and two, the process of obtaining several first brightness values can be represented by the following formula:
[0165] In this formula, step represents the third search step size; max and min represent the maximum and minimum values of the brightness range (or grayscale range) of the optimal light type, respectively; searchNum represents the number of searches in the direction of increasing brightness or decreasing brightness based on the reference brightness value, and the sum of the two numbers is the second brightness count; curBright is the reference brightness value. This represents the i-th first brightness value obtained by searching in the direction of increasing brightness, with curBright as the reference. This represents the j-th first brightness value obtained by searching in the direction of decreasing brightness from the base value of curBright. The obtained first brightness values can be represented as:
[0166] S36: For each first brightness value, adjust the imaging parameters to obtain at least one first barcode image corresponding to the first brightness value, and decode each first barcode image to obtain a first decoding result of each first barcode image.
[0167] Before proceeding to step S36, it also includes determining whether the preprocessing function is enabled.
[0168] In step S36, each of the several first brightness values is acquired sequentially. For each first brightness value: when the preprocessing function is turned off, the imaging parameters are adjusted and a first barcode image with a brightness value reaching the first brightness value is acquired. The first barcode image is then decoded to obtain the first decoding result of the first barcode image. When the preprocessing function is turned on, the imaging parameters are first adjusted and a barcode image with a brightness value reaching the first brightness value is acquired. Then, each of the second preprocessing types in the preprocessing set is acquired sequentially to perform corresponding preprocessing on the acquired barcode image. Therefore, multiple first barcode images can be obtained after preprocessing with different second preprocessing types. Each first barcode image is then decoded sequentially to obtain the first decoding result of each first barcode image.
[0169] S37: Obtain the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition, and use it as the optimal imaging parameter value for the barcode reader.
[0170] The first decoding result of the first barcode image includes the image decoding score of the first barcode image.
[0171] In one embodiment, when the preprocessing function is not enabled, if the first barcode image with a decoding score greater than a first score threshold is obtained during the traversal, the imaging parameter value corresponding to the first barcode image is taken as the optimal imaging parameter value. This allows for earlier exit from the traversal process of several first brightness values, further reducing the time spent adjusting the reader parameters.
[0172] In another embodiment, when the preprocessing function is enabled, or when the preprocessing function is disabled but no first barcode image with an image decoding score greater than the first score threshold is found, obtaining the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition may further include the following steps: Step 1: Select at least one first image decoding score from the image decoding scores of each first barcode image.
[0173] In one example, at least one image decoding score greater than a second score threshold is selected from the image decoding scores of each first barcode image as at least one first image decoding score.
[0174] The second scoring threshold can be a pre-set scoring threshold. Alternatively, the step of determining the second scoring threshold includes: determining the maximum image decoding score among the image decoding scores of each first barcode image; multiplying the maximum image decoding score by a preset coefficient to obtain the second scoring threshold. For example, the preset coefficient is 0.9.
[0175] When there are many image decoding scores for each first barcode image, filtering at least one first image decoding score through a second score threshold can reduce the amount of data processing and further reduce the time spent adjusting the barcode reader parameters.
[0176] Step 2: Determine whether the total number of first image decoding scores is greater than the second number threshold.
[0177] If the total number of first image decoding scores is less than or equal to the second number threshold, then proceed to step three.
[0178] If the total number of first image decoding scores is greater than the second number threshold, then proceed to steps four and five.
[0179] The second quantity threshold is set according to actual needs. For example, the second quantity threshold is 3.
[0180] Step 3: Take the imaging parameter value corresponding to the maximum image decoding score in at least one of the first image decoding scores as the optimal imaging parameter value.
[0181] Step four: For each first image decoding score, combine the first image decoding score with the corresponding second number of reference image decoding scores to obtain the second image decoding score corresponding to the first image decoding score.
[0182] The second number of parameter image decoding scores corresponding to the current first image decoding score are first image decoding scores that are different from the current first image decoding score selected from at least one of the aforementioned first image decoding scores. For example, the second number is 2.
[0183] In one example, the average score of the first image decoding score and the corresponding second number of reference image decoding scores is determined as the second image decoding score corresponding to the first image decoding score.
[0184] By combining the first image decoding score and the corresponding second number of reference image decoding scores, the second image decoding score corresponding to the first image decoding score is determined and used for subsequent parameter tuning and optimization, which can reduce the impact of abnormal first image decoding scores.
[0185] Step 5: The imaging parameter value corresponding to the highest image decoding score among the second image decoding scores is taken as the optimal imaging parameter value.
[0186] In this embodiment, the image decoding score of each first barcode image can be stored in the tuneResults array. First, the tuneResults array is traversed to calculate the maximum image decoding score, maxValue, and then... As a second scoring threshold, the first image decoding score result in the tuneResults array that is greater than the second scoring threshold is selected and stored in the tuneSelectResults array.
[0187] When the number of decoding scores for the first image in the tuneSelectResults array is less than or equal to 3, the imaging parameter value corresponding to the maximum decoding score in the array is directly determined as the optimal imaging parameter value.
[0188] When the number of first image decoding scores in the tuneSelectResults array is greater than 3, the second image decoding score corresponding to each first image decoding score can be determined according to the following formula:
[0189] in, This represents the decoding score of the i-th first image in the array. and This represents the decoding scores of the two reference images corresponding to the decoding score of the i-th first image.
[0190] After steps S31 to S37, the optimal imaging parameter values for the barcode reader, namely exposure time and gain, can be obtained. Simultaneously, the second preprocessing type corresponding to the first barcode image whose first decoding result meets the first decoding condition can also be used as the optimal preprocessing type for the barcode reader.
[0191] Optionally, in this embodiment, after obtaining the optimal imaging parameter values of the reader, at least one of the gamma value and the wide dynamic range type can be adjusted to obtain the optimal gamma value and the optimal wide dynamic range type.
[0192] In one embodiment, obtaining the optimal gamma value includes the following steps: Step 1: Adjust the imaging parameters of the barcode reader to the optimal imaging parameter values.
[0193] In step one, if the optimal wide dynamic range type is obtained before obtaining the optimal gamma value, the wide dynamic range can be adjusted to the optimal wide dynamic range type.
[0194] Step 2: Obtain the fifth barcode images corresponding to different gamma values, and decode each fifth barcode image to obtain the fifth decoding result of each fifth barcode image.
[0195] For example, the set of gamma values that needs to be traversed is .
[0196] Step 3: Obtain the gamma value corresponding to the fifth barcode image that meets the second decoding condition, and use it as the optimal gamma value.
[0197] For example, if the fifth decoding result of the fifth barcode image includes the image decoding score of the fifth barcode image, then the gamma value corresponding to the maximum image decoding score can be used as the optimal gamma value.
[0198] In one implementation, obtaining the optimal wide dynamic range type may include the following steps: Step 1: Adjust the imaging parameters of the barcode reader to the optimal imaging parameter values.
[0199] In step one, if the optimal gamma value is obtained before obtaining the optimal wide dynamic range type, the gamma value can be adjusted to the optimal gamma value.
[0200] Step 2: Obtain the sixth barcode images corresponding to different wide dynamic range types, and decode each sixth barcode image to obtain the sixth decoding result of each sixth barcode image.
[0201] For example, the wide dynamic range types that need to be traversed include standard type, HDR1, HDR2, and contrast enhancement.
[0202] Step 3: Obtain the wide dynamic range type corresponding to the sixth barcode image whose sixth decoding result meets the third decoding condition, and use it as the optimal wide dynamic range type.
[0203] For example, if the sixth decoding result of the sixth barcode image includes the image decoding score of the sixth barcode image, then the wide dynamic range type corresponding to the maximum image decoding score can be used as the optimal wide dynamic range type.
[0204] Optionally, the gamma value and the wide dynamic range type can also be adjusted simultaneously. In this embodiment, there is no specific limitation on whether the gamma value and the wide dynamic range type are adjusted at the same time, or the order of adjustment when they are not adjusted at the same time.
[0205] In this embodiment, while adjusting the exposure time and gain of the barcode reader, adjustments to the gamma value and HDR were added, improving the effect of barcode reader parameter tuning and enhancing the adaptability of the barcode reader in various complex industrial environments.
[0206] In this embodiment, after obtaining the optimal parameters of the barcode reader, including the optimal lighting type, optimal exposure time, optimal gain, optimal gamma value, optimal HDR type, and optimal preprocessing type, the parameters of the barcode reader are configured to their corresponding optimal values. Then, several frames of barcode images (e.g., 5 frames) are acquired by the barcode reader, and each frame is decoded to obtain the decoding result corresponding to each frame.
[0207] When the barcode image is a single-code image, the target number of successfully decoded barcode images out of several frames can be counted. If the target number of frames is less than a frame count threshold, the parameter adjustment is considered a failure. If the target number of frames is greater than or equal to the frame count threshold, the parameter adjustment is considered a success. For example, the frame count threshold is 2 frames.
[0208] When the barcode image is a multi-code image, the number of decoded barcode images in each frame can be obtained, and the decoded number parameter of the barcode reader can be set to the maximum number of decoded barcode images in the multi-frame barcode image.
[0209] In this embodiment, the optimal light type is first selected from several first light types. Then, several first brightness values within the brightness range of the optimal light type are determined. For each first brightness value, the imaging parameters are adjusted to obtain at least one first barcode image corresponding to the first brightness value. Each first barcode image is then decoded to obtain a first decoding result, where the imaging parameters include at least one of exposure time and gain. Finally, the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition is obtained as the optimal imaging parameter value for the barcode reader. This method, by first determining the optimal light type and then adjusting the imaging parameters based on the optimal light type, reduces the need for repeated adjustments to the imaging parameters under useless light types, thus improving the parameter adjustment efficiency of the barcode reader.
[0210] Please see Figure 4 , Figure 4 This is a schematic diagram of a framework of an embodiment of the parameter adjustment device for a barcode reader provided in this application. In this embodiment, the parameter adjustment device for the barcode reader includes: a light type determination module 41, a brightness determination module 42, a parameter adjustment module 43, a decoding module 44, and a parameter acquisition module 45.
[0211] The light type determination module 41 selects a suitable light type from a plurality of first light types as the optimal light type. The brightness determination module 42 determines a plurality of first brightness values within the brightness range of the optimal light type. For each first brightness value, the parameter adjustment module 43 adjusts the imaging parameters to obtain at least one first barcode image corresponding to the first brightness value, and the decoding module 44 decodes each first barcode image to obtain a first decoding result for each first barcode image; wherein the imaging parameters include at least one of exposure time and gain. The parameter acquisition module 45 acquires the imaging parameter values corresponding to the first barcode image whose first decoding result meets the first decoding conditions, as the optimal imaging parameter values for the barcode reader.
[0212] Optionally, the light type determination module 41 is used to determine multiple second brightness values corresponding to each first light type, wherein each second brightness value is within the brightness range of the corresponding first light type; for each second brightness value of each first light type, the imaging parameters are adjusted to obtain at least one second barcode image corresponding to the second brightness value, and each second barcode image is decoded to obtain a second decoding result of each second barcode image; wherein the second decoding result of the second barcode image includes at least the number of decoded second barcode images; and the optimal light type is determined by combining the second decoding results of each first light type.
[0213] Optionally, the light type determination module 41 is used to calculate the first total decoding quantity corresponding to each first light type by using the second decoding results of each first light type respectively; select at least one second light type from each first light type whose first total decoding quantity meets the preset quantity requirement; and determine the optimal light type from at least one second light type.
[0214] Optionally, there may be multiple second light types, and the second decoding result of the second barcode image may also include the image decoding score of the second barcode image and the barcode decoding score of each decoded barcode of the second barcode image. The light type determination module 41 is used to determine the maximum decoding score among the first target decoding scores of the multiple second light types; wherein, each first target decoding score is the image decoding score of the multiple second light types, or the barcode decoding score of the multiple second light types; the second light type corresponding to the maximum decoding score is taken as the optimal light type.
[0215] Optionally, for each second barcode image, the decoding module 44 is configured to, in response to the number of decoded second barcode images being equal to the number of barcodes in the second barcode image, combine the decoding scores of each barcode in the second barcode image to obtain the image decoding score of the second barcode image; and in response to the number of decoded second barcode images being less than the number of barcodes in the second barcode image, determine the image decoding score of the second barcode image as a preset score.
[0216] Optionally, for each first light type, the brightness determination module 42 is further configured to determine the first search step size of the first light type using the brightness range of the first light type and the number of preset step sizes; perform brightness search based on the first reference brightness value with the first search step size to obtain multiple second brightness values within the brightness range of the first light type; wherein, the first reference brightness value is the image brightness value corresponding to the first successfully decoded third barcode image in the pre-search stage, and the third barcode images under different parameter combinations are decoded sequentially in the pre-search stage, and each parameter combination includes one of several third light types, one of several third brightness values, and one of several first preprocessing types.
[0217] Optionally, the brightness determination module 42 is further configured to determine the first number of brightness values using the image decoding score of the third barcode image corresponding to the first reference brightness value; wherein the first number of brightness values is negatively correlated with the image decoding score of the third barcode image corresponding to the first reference brightness value; and to perform a brightness search with a second search step size based on the first reference brightness value to obtain a fourth brightness value of the first number of brightness values; wherein each fourth brightness value is located at the intersection of the brightness ranges of several first light types. The brightness determination module 42 is further configured to, in response to the number of second brightness values of the first light type being less than a first quantity threshold, use the fourth brightness value of the first number of brightness values as multiple second brightness values corresponding to the first light type.
[0218] And / or, the light type determination module 41 is further configured to remove at least one fourth light type from a plurality of third light types to obtain a plurality of first light types; wherein, all third barcode images under the fourth light type are not successfully decoded.
[0219] Optionally, each first target decoding score is a decoding score for each image of multiple second light types. The brightness determination module 42 is used to determine the image brightness of the second barcode image corresponding to the maximum decoding score, as a second reference brightness value; determine the larger brightness value between the first and second reference brightness values, as a reference brightness value; wherein the first reference brightness value is the image brightness value corresponding to the first successfully decoded third barcode image in the pre-search phase; based on the reference brightness value, several first brightness values are searched for; or, each target decoding score is a decoding score for each barcode of multiple second light types, and the brightness determination module 42 is used to take the number of decoded second barcode images corresponding to the maximum decoding score as the first decoding quantity; determine the maximum barcode decoding score among all barcode decoding scores of each third barcode image in the pre-search phase, and take the number of decoded third barcode images corresponding to the maximum barcode decoding score as the second decoding quantity; take the image brightness corresponding to the larger decoding quantity between the first and second decoding quantities as the reference brightness value; based on the reference brightness value, several first brightness values are searched for.
[0220] Optionally, the brightness determination module 42 is used to determine the number of second brightness values using the second target decoding score of the barcode image corresponding to the reference brightness; wherein the number of second brightness values is negatively correlated with the second target decoding score; and to perform brightness search with a third search step size based on the reference brightness value to obtain the first brightness value of the number of second brightness values, which is used as several first brightness values.
[0221] Optionally, the parameter adjustment device further includes a pre-search module 46, which is used to sequentially decode the third barcode images under different parameter combinations to obtain the third decoding result of each third barcode image; wherein each parameter combination includes one of several third light types, one of several third brightness values, and one of several first preprocessing types; the first preprocessing type corresponding to the first successfully decoded third barcode image is used as a reference preprocessing type; it is determined whether the reference preprocessing type is a preset type; wherein the preset type indicates that no preprocessing is performed on the barcode image; if the reference preprocessing type is a preset type, it is determined whether the preprocessing shutdown condition is met; if the preprocessing shutdown condition is met, the preprocessing function is turned off.
[0222] Optionally, the plurality of first preprocessing types include a plurality of erosion types and a plurality of dilation types, each erosion type corresponding to a different number of erosion processes, and each dilation type corresponding to a different number of dilation processes. The pre-search module 46 is used to acquire a first number of erosion types and a first number of dilation types; wherein the number of erosion processes corresponding to the first number of erosion types is equal to the number of dilation processes corresponding to the first number of dilation types; acquire fourth barcode images processed by each target preprocessing type at a preset brightness value; wherein the target preprocessing type is one of the first number of erosion types and the first number of dilation types; decode each fourth barcode image to obtain a fourth decoding result corresponding to each fourth barcode image; wherein the fourth decoding result of the fourth barcode image includes the number of decodings of the fourth barcode image; using the fourth decoding results of each fourth barcode image, calculate the second total decoding count corresponding to the first number of erosion types and the third total decoding count corresponding to the first number of dilation types; if the second total decoding count is equal to the third total decoding count, then the preprocessing closure condition is satisfied; if the second total decoding count is not equal to the third total decoding count, then the preprocessing closure condition is not satisfied.
[0223] Optionally, the pre-search module 46 is further configured to, after determining that the preprocessing shutdown condition is not met, if the second total number of decodes is greater than the third total number of decodes, select a preset type and each first preprocessing type similar to the erosion type from a plurality of first preprocessing types as a plurality of second preprocessing types; if the second total number of decodes is less than the third total number of decodes, select a preset type and each first preprocessing type similar to the expansion type from a plurality of first preprocessing types as a plurality of second preprocessing types.
[0224] Optionally, the pre-search module 46 is further configured to, after determining whether the reference preprocessing type is a preset type, if the reference preprocessing type is not a preset type, select from a plurality of first preprocessing types each first preprocessing type that is similar to the preset type and the reference preprocessing type as a plurality of second preprocessing types.
[0225] Optionally, the first decoding result of the first barcode image includes the image decoding score of the first barcode image. The parameter acquisition module 45 is used to determine whether the preprocessing function is enabled; in response to the preprocessing function not being enabled, the imaging parameter value corresponding to the first barcode image whose first image decoding score is greater than the first score threshold is taken as the optimal imaging parameter value.
[0226] Optionally, the first decoding result of the first barcode image includes the image decoding score of the first barcode image. The parameter acquisition module 45 is used to select at least one first image decoding score from the image decoding scores of each first barcode image; in response to the total number of at least one first image decoding scores being less than or equal to a second quantity threshold, the imaging parameter value corresponding to the largest image decoding score among the at least one first image decoding scores is taken as the optimal imaging parameter value; in response to the total number of at least one first image decoding scores being greater than the second quantity threshold, for each first image decoding score, the first image decoding score is combined with the corresponding second quantity of reference image decoding scores to obtain the second image decoding score corresponding to the first image decoding score; the imaging parameter value corresponding to the largest image decoding score among the second image decoding scores is taken as the optimal imaging parameter value.
[0227] It should be noted that the apparatus of this embodiment can perform the steps in the above method. For detailed descriptions of the relevant content, please refer to the method section above, which will not be repeated here.
[0228] Please see Figure 5 , Figure 5 This is a schematic diagram of a framework of an embodiment of the electronic device provided in this application. In this embodiment, the electronic device 50 includes a memory 51 and a processor 52.
[0229] Processor 52 can also be referred to as CPU (Central Processing Unit). Processor 52 may be an integrated circuit chip with signal processing capabilities. Processor 52 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. A general-purpose processor can be a microprocessor, or processor 52 can be any conventional processor 52, etc.
[0230] The memory 51 in the electronic device 50 is used to store the program instructions required for the processor 52 to run.
[0231] The processor 52 is used to execute program instructions to implement the parameter adjustment method of the code reader in this application.
[0232] Please see Figure 6 , Figure 6This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. The computer-readable storage medium 60 of this application embodiment stores program instructions 61, which, when executed, implement the parameter adjustment method for the code reader provided in this application. The program instructions 61 can be formed into a program file and stored in the aforementioned computer-readable storage medium 60 in the form of a software product, so that a computer device (which may be a personal computer, server, or network device, etc.) can execute all or part of the steps of the methods of various embodiments of this application. The aforementioned computer-readable storage medium 60 includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, or terminal devices such as computers, servers, mobile phones, and tablets.
[0233] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0234] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0235] In the several embodiments provided in this application, it should be understood that the disclosed methods, apparatuses, and systems can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or units may be electrical, mechanical, or other forms.
[0236] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0237] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0238] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0239] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for adjusting the parameters of a barcode reader, characterized in that, The method includes: Select a suitable light type from several first light types as the optimal light type; wherein, the quality of the barcode image acquired under the optimal light type is better than the quality of the barcode images acquired under other first light types; Determine several first brightness values that fall within the brightness range of the optimal light type; For each of the first brightness values, the imaging parameters are adjusted to obtain at least one first barcode image corresponding to the first brightness value, and each of the first barcode images is decoded to obtain a first decoding result for each of the first barcode images; wherein, the imaging parameters include at least one of exposure time and gain; The imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition is obtained and used as the optimal imaging parameter value of the barcode reader.
2. The method according to claim 1, characterized in that, The step of selecting a suitable light type from a plurality of first light types as the optimal light type includes: Determine multiple second brightness values corresponding to each of the first light types, wherein each second brightness value is within the brightness range of the corresponding first light type; For each second brightness value of each of the first light types, the imaging parameters are adjusted to obtain at least one second barcode image corresponding to the second brightness value, and each second barcode image is decoded to obtain a second decoding result of each second barcode image; wherein, the second decoding result of the second barcode image includes at least the number of decoded second barcode images; The optimal light type is determined by combining the second decoding results of each of the first light types.
3. The method according to claim 2, characterized in that, The step of determining the optimal light type by combining the second decoding results of each of the first light types includes: By using the second decoding results for each of the first light types, the first total decoding count for each of the first light types is obtained. Select at least one second light type from each of the first light types whose total decoding quantity meets the preset quantity requirement; The optimal light type is determined from the at least one second light type.
4. The method according to claim 3, characterized in that, The number of the second light types is multiple, and the second decoding result of the second barcode image also includes the image decoding score of the second barcode image and the barcode decoding score of each decoded barcode of the second barcode image; Determining the optimal light type from the at least one second light type includes: Determine the maximum decoding score among the decoding scores of each first target of the plurality of second light types; wherein each first target decoding score is an image decoding score of the plurality of second light types, or a barcode decoding score of the plurality of second light types; The second light type corresponding to the maximum decoding score is taken as the optimal light type.
5. The method according to claim 4, characterized in that, For each of the second barcode images, the steps for determining the image decoding score of the second barcode image include: In response to the fact that the number of decoded codes in the second barcode image is equal to the number of barcodes in the second barcode image, the image decoding score of the second barcode image is obtained by combining the decoding scores of each barcode in the second barcode image. In response to the fact that the number of decoded items in the second barcode image is less than the number of barcodes in the second barcode image, the image decoding score of the second barcode image is determined to be a preset score.
6. The method according to claim 2, characterized in that, For each of the first light types, determining the plurality of second brightness values corresponding to the first light type includes: The first search step size for the first light type is determined by using the brightness range of the first light type and the preset number of step sizes; Based on the first reference brightness value, a brightness search is performed with the first search step size to obtain the plurality of second brightness values within the brightness range of the first light type; Wherein, the first reference brightness value is the image brightness value corresponding to the first successfully decoded third barcode image in the pre-search stage. In the pre-search stage, the third barcode images under different parameter combinations are decoded sequentially. Each parameter combination includes one of several third light types, one of several third brightness values, and one of several first preprocessing types.
7. The method according to claim 6, characterized in that, After obtaining the first reference brightness value, the method further includes: The number of first brightness values is determined using the image decoding score of the third barcode image corresponding to the first reference brightness value; wherein the number of first brightness values is negatively correlated with the image decoding score of the third barcode image corresponding to the first reference brightness value. Based on the first reference brightness value, a brightness search is performed with a second search step size to obtain a fourth brightness value of the first number of brightness values; wherein, each of the fourth brightness values is located at the intersection of the brightness ranges of the plurality of first light types; In response to the fact that the number of second brightness values of the first light type found is less than a first quantity threshold, the fourth brightness value of the first brightness count is used as the plurality of second brightness values corresponding to the first light type; And / or, the step of determining the plurality of first light types includes: At least one fourth light type is removed from the plurality of third light types to obtain the plurality of first light types; In particular, all of the third barcode images under the fourth light type were not successfully decoded.
8. The method according to claim 4, characterized in that, Each of the first target decoding scores is a plurality of the image decoding scores for each of the second light types, and determining a plurality of first brightness values within the brightness range of the optimal light type includes: The image brightness of the second barcode image corresponding to the maximum decoding score is determined as the second reference brightness value; The larger of the first reference brightness value and the second reference brightness value is determined as the reference brightness value; wherein, the first reference brightness value is the image brightness value corresponding to the first successfully decoded third barcode image in the pre-search phase; Based on the reference brightness value, the plurality of first brightness values are obtained by searching. Alternatively, each of the target decoding scores can be a barcode decoding score for each of the multiple second light types, and determining a plurality of first brightness values within the brightness range of the optimal light type includes: The number of times the second barcode image corresponding to the maximum decoding score is decoded is taken as the first decoding number; Determine the maximum barcode decoding score among all barcode decoding scores of each third barcode image in the pre-search phase, and use the number of times the third barcode image corresponding to the maximum barcode decoding score is decoded as the second decoding number; The image brightness corresponding to the larger of the first decoding quantity and the second decoding quantity is used as the reference brightness value; Based on the reference brightness value, the several first brightness values are obtained by searching.
9. The method according to claim 8, characterized in that, The process of searching for and obtaining the plurality of first brightness values based on the reference brightness value includes: The number of second brightness levels is determined using the second target decoding score of the barcode image corresponding to the reference brightness; wherein the number of second brightness levels is negatively correlated with the second target decoding score. Based on the reference brightness value, a brightness search is performed with a third search step size to obtain the first brightness value of the second number of brightness values, which is used as the plurality of first brightness values.
10. The method according to claim 1, characterized in that, Before selecting the optimal light type from a plurality of first light types, a pre-search phase is included, the steps of which include: The third barcode images under different parameter combinations are decoded sequentially to obtain the third decoding result of each third barcode image; wherein each parameter combination includes one of several third light types, one of several third brightness values and one of several first preprocessing types; The first preprocessing type corresponding to the first successfully decoded third barcode image is used as the reference preprocessing type; Determine whether the reference preprocessing type is a preset type; wherein, the preset type indicates that no preprocessing is performed on the barcode image; If the reference preprocessing type is the preset type, then determine whether the preprocessing shutdown condition is met; If the preprocessing shutdown condition is met, then the preprocessing function is disabled.
11. The method according to claim 10, characterized in that, The plurality of first pretreatment types include a plurality of corrosion types and a plurality of expansion types, each corrosion type corresponding to a different corrosion treatment, and each expansion type corresponding to a different expansion treatment; the determination of whether the pretreatment shutdown condition is met includes: Obtain a first number of corrosion types and a first number of expansion types; wherein the number of corrosion processes corresponding to the first number of corrosion types is equal to the number of expansion processes corresponding to the first number of expansion types; Obtain a fourth barcode image after processing by each target preprocessing type at a preset brightness value; wherein, the target preprocessing type is one of the first number of erosion types and the first number of dilation types; Each of the fourth barcode images is decoded to obtain a fourth decoding result corresponding to each of the fourth barcode images; wherein, the fourth decoding result of the fourth barcode image includes the number of times the fourth barcode image has been decoded; Using the fourth decoding results of each of the fourth barcode images, the second total decoding count corresponding to the first number of erosion types and the third total decoding count corresponding to the first number of dilation types are statistically obtained; If the second total number of decodes is equal to the third total number of decodes, then the preprocessing shutdown condition is satisfied. If the second total number of decodes is not equal to the third total number of decodes, then the preprocessing shutdown condition is not met.
12. The method according to claim 11, characterized in that, After determining that the preprocessing shutdown condition is not met, the method further includes: If the second total number of decodes is greater than the third total number of decodes, then the preset type and each of the first preprocessing types similar to the erosion type are selected from the plurality of first preprocessing types as a plurality of second preprocessing types; If the second total number of decodes is less than the third total number of decodes, then the preset type and each of the first preprocessing types similar to the expansion type are selected from the plurality of first preprocessing types as the plurality of second preprocessing types.
13. The method according to claim 10, characterized in that, After determining whether the reference preprocessing type is a preset type, the method further includes: If the reference preprocessing type is not the preset type, then each of the first preprocessing types that is similar to the preset type and the reference preprocessing type is selected from the plurality of first preprocessing types as a plurality of second preprocessing types.
14. The method according to claim 1, characterized in that, The first decoding result of the first barcode image includes the image decoding score of the first barcode image. Obtaining the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition includes: Determine whether the preprocessing function is enabled; In response to the preprocessing function not being enabled, the imaging parameter value corresponding to the first barcode image whose first image decoding score is greater than the first score threshold is taken as the optimal imaging parameter value.
15. The method according to claim 1, characterized in that, The first decoding result of the first barcode image includes the image decoding score of the first barcode image. Obtaining the imaging parameter value corresponding to the first barcode image whose first decoding result meets the first decoding condition includes: Select at least one first image decoding score from the image decoding scores of each of the first barcode images; In response to the total number of the at least one first image decoding scores being less than or equal to a second quantity threshold, the imaging parameter value corresponding to the maximum image decoding score among the at least one first image decoding scores is taken as the optimal imaging parameter value; In response to the total number of the at least one first image decoding scores being greater than the second number threshold, for each first image decoding score, the first image decoding score is combined with the corresponding second number of reference image decoding scores to obtain the second image decoding score corresponding to the first image decoding score; The imaging parameter value corresponding to the maximum image decoding score among the second image decoding scores is taken as the optimal imaging parameter value.
16. An electronic device, characterized in that, Including interconnected memory and processor, The memory stores program instructions; The processor is used to execute program instructions stored in the memory to implement the method according to any one of claims 1-15.
17. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store program instructions that can be executed by a processor to implement the method of any one of claims 1-15.
Citation Information
Patent Citations
Reading device and method capable of identifying barcodes made of various materials and color barcodes
CN111460848A
Method and device for acquiring code scanning image, code scanning equipment and storage medium
CN113542617A