Method and device for removing out-of-focus blurring of bar code image and bar code recognition equipment
By constructing a fuzzy parameter table and using a Gaussian point diffusion function, the problem of low recognition accuracy caused by out-of-focus blur in low-cost barcode recognition equipment is solved, and effective removal of fuzzy barcode images is achieved and recognition capabilities are improved.
Patent Information
- Application Number
- CN202411033407.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-26
AI Technical Summary
The prior art cannot accurately identify the barcode image when processing barcode images with high blur, especially in low-cost embedded barcode recognition devices. Due to the small effective depth of field, the problem of out-of-focus blur is difficult to solve.
By obtaining the target scanning distance of the barcode identification device, a fuzzy parameter table is constructed, the target out-of-focus fuzzy parameters corresponding to the target scanning distance is determined, and the Gaussian point diffusion function is used to perform the defocus fuzzy operation. The specific steps include using TOF technology or Positioning lights get the scanning distance, calculate the center point coordinates, fit the mapping function, and construct and use the inverse Gaussian point diffusion function to convolution to remove blur.
It improves the recognition ability of blurred barcode images, and can obtain clearer barcode images at different scanning distances, thereby improving the recognition accuracy.
Smart Images

Figure CN119026618A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of barcode recognition technology, for example, to a method and apparatus for removing out-of-focus blur from a barcode image, and a barcode recognition device. Background Art
[0002] Currently, barcode recognition plays a key role in many industries such as retail, logistics, and inventory management, and is used to quickly and accurately obtain product information. Due to the inherent characteristics of the lens itself, such as aperture size and focal length, it is impossible to guarantee that a clear barcode image can be captured at any distance. Low-cost embedded barcode recognition devices usually use cameras with limited performance, resulting in a small effective depth of field and prone to out-of-focus blur at non-ideal distances.
[0003] In the related art, a fuzzy barcode image can be recognized to a certain extent by setting a fuzzy recognition algorithm.
[0004] In the process of implementing the embodiments of the present disclosure, it is found that there are at least the following problems in the related art:
[0005] For barcode images with a high degree of blur, the fuzzy recognition algorithm is used for processing, but the barcode image cannot be accurately recognized.
[0006] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0007] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0008] The embodiments of the present disclosure provide a method and apparatus for removing out-of-focus blur from a barcode image, and a barcode recognition device, so as to improve the recognition capability of blurred barcode images.
[0009] In some embodiments, a method for removing out-of-focus blur of a barcode image is applied to a barcode recognition device, and the method includes: obtaining a target scanning distance of the barcode recognition device; determining a target defocus blur parameter corresponding to the target scanning distance according to a blur parameter table; wherein the blur parameter table reflects the correspondence between the scanning distance of the barcode recognition device and the defocus blur parameter; and performing a defocus blur operation on the defocused barcode image according to the target defocus blur parameter.
[0010] Optionally, obtaining the target scanning distance of the barcode recognition device includes: obtaining the target scanning distance based on TOF (Time of Flight) technology; or obtaining the target scanning distance based on a positioning light of the barcode recognition device.
[0011] Optionally, based on the positioning light of the barcode recognition device, the target scanning distance is obtained, including: turning on the positioning light to obtain a captured image, the captured image including the positioning light pattern; calculating the target center point coordinates of the positioning light pattern in the captured image; and calculating the target scanning distance according to the target center point coordinates based on a mapping function between the center point coordinates and the scanning distance.
[0012] Optionally, the mapping function between the center point coordinates and the scanning distance is determined as follows: turn on the positioning light, obtain images taken at different scanning distances, and the images taken include the positioning light pattern; calculate the center point coordinates of the positioning light pattern in the images taken at different scanning distances; and fit the mapping function between the center point coordinates and the scanning distance based on the center point coordinates at different scanning distances.
[0013] Optionally, a blur parameter table is constructed according to the following method: obtaining a target pattern; determining the defocus blur parameters of the barcode recognition device at each scanning distance based on the target pattern; and constructing a blur parameter table according to each scanning distance and the defocus blur parameters corresponding to each scanning distance.
[0014] Optionally, based on the target pattern, the defocus blur parameters of the barcode recognition device at each scanning distance are determined, including: photographing the target pattern at each scanning distance to obtain a target pattern image; determining the diffusion radius of each target pattern image; and determining the defocus blur parameters of the target pattern image at each scanning distance based on the diffusion radius.
[0015] Optionally, determining the diffusion radius of each target pattern image includes: determining a theoretical radius of the target pattern in the target pattern image based on a shooting angle of view and a physical size of the target pattern; binarizing the target pattern image to obtain a binarized radius of the target pattern in the binarized image; and determining the diffusion radius based on the theoretical radius and the binarized radius.
[0016] Optionally, a defocusing operation is performed on the defocused barcode image according to the target defocusing blur parameters, including: constructing a Gaussian point spread function according to the target defocusing blur parameters; determining an inverse Gaussian point spread function according to the Gaussian point spread function; and convolving the inverse Gaussian point spread function with the defocused barcode image to achieve defocusing of the defocused barcode image.
[0017] In some embodiments, the apparatus for removing out-of-focus blur from a barcode image includes a processor and a memory storing program instructions, and the processor is configured to execute the above-mentioned method for removing out-of-focus blur from a barcode image when running the program instructions.
[0018] In some embodiments, the barcode recognition device includes: a barcode recognition device body; and the above-mentioned device for removing out-of-focus blur from a barcode image, which is installed on the barcode recognition device body.
[0019] The method and apparatus for removing out-of-focus blur from a barcode image and the barcode recognition device provided by the embodiments of the present disclosure can achieve the following technical effects:
[0020] In the disclosed embodiment, different scanning distances will cause different degrees of defocus blurring to the barcode image acquired by the barcode recognition device. In the blur parameter table, the defocus blurring parameter is used to reflect the degree of defocus blurring of the barcode image, and the scanning distance and the defocus blurring parameter are formed into a corresponding relationship. By obtaining the target scanning distance of the barcode recognition device, and then determining the target defocus blurring parameter corresponding to the target scanning distance in the blur parameter table, and finally performing a defocus blurring operation on the defocused barcode image according to the target defocus blurring parameter, a clearer barcode image can be obtained, thereby improving the recognition ability of the blurred barcode image.
[0021] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
[0023] Figure 1 is a schematic diagram of a method for removing out-of-focus blur from a barcode image provided by an embodiment of the present disclosure;
[0024] Figure 2 is a schematic diagram of another method for removing out-of-focus blur from a barcode image provided by an embodiment of the present disclosure;
[0025] Figure 3 It is a schematic diagram of a method for constructing a blur parameter table in a method for removing out-of-focus blur from a barcode image provided by an embodiment of the present disclosure;
[0026] Figure 4 is a schematic diagram of a dot pattern and a shooting pattern in an embodiment of the present disclosure;
[0027] Figure 5 is a schematic diagram of another method for removing out-of-focus blur from a barcode image provided by an embodiment of the present disclosure;
[0028] Figure 6It is a schematic diagram of a device for removing out-of-focus blur of a barcode image provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0030] The terms "first", "second", etc. in the technical solutions described in this application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so as to describe the embodiments of the disclosed embodiments described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0031] Unless otherwise stated, the term "plurality" means two or more.
[0032] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0033] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0034] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0035] Combination Figure 1 As shown, the embodiment of the present disclosure provides a method for removing out-of-focus blur from a barcode image. The execution subject of the method may be a processor, and the method includes:
[0036] S001, the processor obtains the target scanning distance of the barcode recognition device.
[0037] S002, the processor determines the target out-of-focus blur parameters corresponding to the target scanning distance according to the blur parameter table.
[0038] S003, the processor performs a defocusing and blurring operation on the defocused barcode image according to the target defocusing and blurring parameters.
[0039] Among them, the blur parameter table reflects the corresponding relationship between the scanning distance of the barcode recognition device and the defocus blur parameter.
[0040] In the disclosed embodiment, different scanning distances will cause different degrees of defocus blurring to the barcode image acquired by the barcode recognition device. In the blur parameter table, the defocus blurring parameter is used to reflect the degree of defocus blurring of the barcode image, and the scanning distance and the defocus blurring parameter are formed into a corresponding relationship. By obtaining the target scanning distance of the barcode recognition device, and then determining the target defocus blurring parameter corresponding to the target scanning distance in the blur parameter table, and finally performing a defocus blurring operation on the defocused barcode image according to the target defocus blurring parameter, a clearer barcode image can be obtained, thereby improving the recognition ability of the blurred barcode image.
[0041] Optionally, obtaining the target scanning distance of the barcode recognition device includes: obtaining the target scanning distance based on TOF technology; or obtaining the target scanning distance based on a positioning light of the barcode recognition device.
[0042] The working principle of TOF technology is to emit a light pulse and then measure the time it takes for the light pulse to be reflected by the object and return to the sensor. Based on this time, the distance between the barcode recognition device and the scanned object can be calculated. In addition, a positioning light can be set on the barcode recognition device, and then the target scanning distance can be obtained based on the positioning light.
[0043] Optionally, based on the positioning light of the barcode recognition device, the target scanning distance is obtained, including: turning on the positioning light to obtain a captured image, the captured image including the positioning light pattern; calculating the target center point coordinates of the positioning light pattern in the captured image; and calculating the target scanning distance according to the target center point coordinates based on a mapping function between the center point coordinates and the scanning distance.
[0044] Combination Figure 2 As shown, the embodiment of the present disclosure provides another method for removing out-of-focus blur from a barcode image, comprising:
[0045] S101, the processor turns on the positioning light and obtains a captured image, where the captured image includes a positioning light pattern.
[0046] S102, the processor calculates the coordinates of the target center point of the positioning light pattern in the captured image.
[0047] S103, the processor calculates the target scanning distance of the barcode recognition device according to the target center point coordinates based on the mapping function between the center point coordinates and the scanning distance.
[0048] S104: The processor determines the target out-of-focus blur parameter corresponding to the target code scanning distance according to the blur parameter table.
[0049] S105: The processor performs a defocusing and blurring operation on the defocused barcode image according to the target defocusing and blurring parameters.
[0050] On the barcode recognition device, you can set a positioning light and a camera. After turning on the positioning light, obtain the captured image through the camera. In the captured image, the positioning light pattern will be displayed. By calculating the target center point coordinates of the positioning light pattern in the captured image, the target scanning distance corresponding to the target center point coordinates can be obtained according to the mapping function between the center point coordinates and the scanning distance. In addition, if the barcode recognition device is equipped with a fill light, you need to turn off the fill light first, then turn on the positioning light and obtain the captured image. This can improve the clarity of the positioning light pattern and obtain more accurate target center point coordinates.
[0051] Optionally, the mapping function between the center point coordinates and the scanning distance is determined as follows: turn on the positioning light, obtain images taken at different scanning distances, and the images taken include the positioning light pattern; calculate the center point coordinates of the positioning light pattern in the images taken at different scanning distances; and fit the mapping function between the center point coordinates and the scanning distance based on the center point coordinates at different scanning distances.
[0052] In this embodiment, to obtain the mapping function between the center point coordinates and the code scanning distance, it is necessary to obtain the center point coordinates at multiple code scanning distances, and then fit the code scanning distance and the center point coordinates to obtain the mapping function.
[0053] Optionally, the positioning light is not coaxial with the camera.
[0054] In this embodiment, the optical axes of the positioning light and the camera are not completely aligned, and there is a certain deviation or angle between the two optical axes. This can reduce the situation where the light of the positioning light directly enters the camera through reflection, thereby avoiding interference with the camera, causing image overexposure or halo, and affecting image quality. The non-coaxial design allows the barcode recognition device to scan barcodes at different angles, increasing the flexibility and accuracy of scanning. In addition, the relative position deviation between the positioning light and the camera can be calculated through a set algorithm, thereby more accurately determining the scanning distance of the barcode recognition device.
[0055] Optionally, the positioning light pattern is a specific pattern, including a square, a cross, a polygon, or other coded patterns.
[0056] In this embodiment, specific patterns such as squares, crosses, polygons, etc. can obtain more accurate center point coordinates after obtaining the captured image. In addition, the positioning light can have a higher brightness, which is convenient for positioning the positioning light in a strong light environment.
[0057] Optionally, a blur parameter table is constructed according to the following method: obtaining a target pattern; determining the defocus blur parameters of the barcode recognition device at each scanning distance based on the target pattern; and constructing a blur parameter table according to each scanning distance and the defocus blur parameters corresponding to each scanning distance.
[0058] In this embodiment, the target pattern can be a black clear dot pattern. According to the target pattern, the defocus blur parameters of the barcode recognition device at each scanning distance are obtained, and then a blur parameter table is constructed according to each scanning distance and the defocus blur parameters corresponding to each scanning distance. Among them, the defocus blur parameter table can be represented by a static table, or can be represented by a fitting function, or other static tables that can represent a one-to-one mapping relationship between the scanning distance and the defocus blur parameters.
[0059] Optionally, based on the target pattern, the defocus blur parameters of the barcode recognition device at each scanning distance are determined, including: photographing the target pattern at each scanning distance to obtain a target pattern image; determining the diffusion radius of each target pattern image; and determining the defocus blur parameters of the target pattern image at each scanning distance based on the diffusion radius.
[0060] Combination Figure 3 As shown, the embodiment of the present disclosure provides a method for constructing a fuzzy parameter table, comprising:
[0061] S201: The processor obtains a target pattern.
[0062] S202, the processor captures the target pattern at each scanning distance to obtain an image of the target pattern.
[0063] S203: The processor determines the diffusion radius of each target pattern image.
[0064] S204: The processor determines the defocus blur parameter of the target pattern image at each scanning distance according to the diffusion radius.
[0065] S205: The processor constructs a blur parameter table according to each scanning distance and the defocus blur parameters corresponding to each scanning distance.
[0066] In this embodiment, the out-of-focus blur parameter of the target pattern image at each scanning distance is determined by determining the diffusion radius of the target pattern image at each scanning distance. The diffusion radius is a measure of the size of the blurred spot formed after a point light source is imaged by an optical system. Figure 4 As shown, taking the target pattern as a dot pattern as an example, when the barcode recognition device is out of focus, a blurred out-of-focus pattern will be obtained after photographing the dot pattern. There will also be a difference between the theoretical size of the dot pattern and the size of the photographed pattern after defocusing. This difference can be defined as the diffusion radius of the dot pattern image.
[0067] Optionally, determining the diffusion radius of each target pattern image includes: determining a theoretical radius of the target pattern in the target pattern image based on a shooting angle of view and a physical size of the target pattern; binarizing the target pattern image to obtain a binarized radius of the target pattern in the binarized image; and determining the diffusion radius based on the theoretical radius and the binarized radius.
[0068] In this embodiment, the diffusion radius can be determined by measuring the binarization radius of the target pattern in the binarized image. According to the shooting angle of view and the physical size of the target pattern, the theoretical radius of the target pattern can be determined. By binarizing the target pattern image, the target pattern image is converted into a binarized image containing only black and white pixel values, thereby obtaining the binarization radius. Finally, the diffusion radius is determined according to the theoretical radius and the binarization radius.
[0069] Optionally, the diffusion radius is calculated according to the following formula:
[0070] r=r2-r1
[0071] Among them, r is the diffusion radius, r1 is the theoretical radius, and r2 is the binarization radius.
[0072] Optionally, after obtaining the diffusion radius, the out-of-focus blur parameter is calculated according to the following formula:
[0073] σ=r / a
[0074] Wherein, σ is the out-of-focus blur parameter, and a is a preset parameter. Wherein, a can be 3.
[0075] Optionally, a defocusing operation is performed on the defocused barcode image according to the target defocusing blur parameters, including: constructing a Gaussian point spread function according to the target defocusing blur parameters; determining an inverse Gaussian point spread function according to the Gaussian point spread function; and convolving the inverse Gaussian point spread function with the defocused barcode image to achieve defocusing of the defocused barcode image.
[0076] Combination Figure 5 As shown, the embodiment of the present disclosure provides another method for removing out-of-focus blur from a barcode image, comprising:
[0077] S301, the processor obtains the target scanning distance of the barcode recognition device.
[0078] S302: The processor determines the target out-of-focus blur parameter corresponding to the target code scanning distance according to the blur parameter table.
[0079] S303: The processor constructs a Gaussian point spread function according to the target out-of-focus blur parameters.
[0080] S304: The processor determines an inverse Gaussian point spread function according to the Gaussian point spread function.
[0081] S305: The processor convolves the inverse Gaussian point spread function with the defocused barcode image to remove defocus blur of the defocused barcode image.
[0082] In this embodiment, after the out-of-focus blur parameter is determined, the following Gaussian point spread function PSF (Point Spread Function) can be constructed:
[0083]
[0084] Among them, b is a constant, and (x, y) is the coordinate of the center point of the convolution template.
[0085] After obtaining the Gaussian point spread function PSF, the inverse operation of PSF can be performed to determine the inverse Gaussian point spread function PSF. -1 Then the inverse Gaussian point spread function PSF -1 By convolving with the out-of-focus barcode image, the out-of-focus barcode image can be defocused and blurred, thereby improving the clarity and contrast of the barcode image and making the barcode easier to recognize.
[0086] Combination Figure 6 As shown, the embodiment of the present disclosure provides a device 300 for removing out-of-focus blur from a barcode image, including a processor (processor) 400 and a memory (memory) 401. Optionally, the device may also include a communication interface (Communication Interface) 402 and a bus 403. Among them, the processor 400, the communication interface 402, and the memory 401 can communicate with each other through the bus 403. The communication interface 402 can be used for information transmission. The processor 400 can call the logic instructions in the memory 401 to execute the method for removing out-of-focus blur from a barcode image of the above embodiment.
[0087] In addition, the logic instructions in the memory 401 described above may be implemented in the form of software functional units and when sold or used as independent products, may be stored in a computer-readable storage medium.
[0088] The memory 401 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 400 executes the function application and data processing by running the program instructions / modules stored in the memory 401, that is, the method for removing out-of-focus blur from a barcode image in the above embodiment is implemented.
[0089] The memory 401 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 401 may include a high-speed random access memory and may also include a non-volatile memory.
[0090] The disclosed embodiments provide a barcode recognition device, including: a barcode recognition device body, and the above-mentioned device for removing out-of-focus blur from barcode images. The device for removing out-of-focus blur from barcode images is installed on the barcode recognition device body. The installation relationship described here is not limited to placement inside the barcode recognition device, but also includes installation connections with other components of the barcode recognition device, including but not limited to physical connections, electrical connections, or signal transmission connections. It can be understood by those skilled in the art that the device for removing out-of-focus blur from barcode images can be adapted to a feasible barcode recognition device body, thereby realizing other feasible embodiments.
[0091] An embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute the above-mentioned method for removing out-of-focus blur from a barcode image.
[0092] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0093] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. The parts and features of some embodiments may be included in or replace the parts and features of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the technical solutions recorded in this application. As used in the technical solutions recorded in this application, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0094] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that, for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above may refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0095] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0096] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A method for removing out-of-focus blur from a barcode image, characterized in that: Applied to a barcode recognition device, the method includes: Get the target scanning distance of the barcode recognition device; According to the fuzzy parameter table, a target defocus fuzzy parameter corresponding to the target code scanning distance is determined; wherein the fuzzy parameter table reflects the corresponding relationship between the code scanning distance of the barcode recognition device and the defocus fuzzy parameter; The defocused barcode image is defocused and blurred according to the target defocused blur parameters.
2. The method according to claim 1, characterized in that Get the target scanning distance of the barcode recognition device, including: Based on time-of-flight TOF technology, obtain the target scanning distance; or, Based on the positioning light of the barcode recognition device, the target scanning distance is obtained.
3. The method according to claim 2, characterized in that Based on the positioning light of the barcode recognition device, obtain the target scanning distance, including: Turn on the positioning light and obtain a captured image, wherein the captured image includes a positioning light pattern; Calculate the target center point coordinates of the positioning light pattern in the captured image; According to the mapping function between the center point coordinates and the code scanning distance, the target code scanning distance is calculated according to the target center point coordinates.
4. The method according to claim 3, characterized in that Determine the mapping function between the center point coordinates and the scanned code distance as follows: Turn on the positioning light and obtain images at different scanning distances. The images include the positioning light pattern. Calculate the coordinates of the center point of the positioning light pattern in the captured image at different scanning distances; According to the center point coordinates at different scanning distances, a mapping function between the center point coordinates and the scanning distance is fitted.
5. The method according to claim 1, characterized in that Construct the fuzzy parameter table as follows: Acquire a target pattern; According to the target pattern, the defocus blur parameters of the barcode recognition device at each scanning distance are determined; A blur parameter table is constructed according to each scanning distance and the defocus blur parameters corresponding to each scanning distance.
6. The method according to claim 5, characterized in that According to the target pattern, the defocus blur parameters of the barcode recognition device at each scanning distance are determined, including: Photograph the target pattern at various scanning distances to obtain an image of the target pattern; Determine the diffusion radius of each target pattern image; The defocus blur parameters of the target pattern image at each scanning distance are determined according to the diffusion radius.
7. The method according to claim 6, characterized in that Determine the diffusion radius of each target pattern image, including: Determine a theoretical radius of the target pattern in the target pattern image according to the shooting angle of view and the physical size of the target pattern; Binarizing the target pattern image to obtain a binarization radius of the target pattern in the binarized image; Determine the diffusion radius based on the theoretical radius and the binarization radius.
8. The method according to any one of claims 1 to 7, characterized in that: Defocus and blur the defocused barcode image according to the target defocus and blur parameters, including: Construct a Gaussian point spread function according to the target out-of-focus blur parameter; determining an inverse Gaussian point spread function based on the Gaussian point spread function; The inverse Gaussian point spread function is convolved with the defocused barcode image to achieve defocus blurring of the defocused barcode image.
9. A device for removing out-of-focus blur from a barcode image, comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to execute the method for removing out-of-focus blur from a barcode image as claimed in any one of claims 1 to 8 when running the program instructions.
10. A barcode recognition device, characterized in that: include: Barcode recognition device body; The device for removing out-of-focus blur of a barcode image as described in claim 9 is installed on the barcode recognition device body.
Citation Information
Cited By
Product information input method and system based on image recognition
CN120356066A
