A visual positioning method, apparatus, and electronic device resistant to code band defects.
By calculating the sequence factor and sharpness factor of the coding block and assigning weights, the image is corrected and inter-frame correlation verification is established, which solves the problem of unstable positioning caused by code band defects and achieves accurate positioning and stable control in harsh environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUZHOU OPTICAL CODE FUTURE INTELLIGENT TECHNOLOGY CO LTD
- Filing Date
- 2026-02-05
- Publication Date
- 2026-06-02
AI Technical Summary
Existing code tape visual positioning technology has low tolerance for code tape defects, leading to positioning interruptions or a sharp drop in accuracy, which affects production efficiency.
By calculating the sequence factor and sharpness factor of each effective coding block and assigning weights, performing weighted summation, correcting the image to determine the position reference value, establishing an inter-frame correlation verification mechanism, distinguishing between stationary and moving states of the carrier, and optimizing the recognition area.
Even when the code tape is missing, obstructed, or dirty, it can still achieve accurate positioning, ensure data stability and recognition accuracy, reduce interference from irrelevant areas, and improve the stability of equipment control.
Smart Images

Figure CN122134792A_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification pertain to the field of defect localization, and in particular relate to a visual localization method, apparatus, and electronic device for resisting code tape defects. Background Technology
[0002] In fields such as industrial automation, intelligent warehousing, and logistics sorting, barcode-based visual positioning technology has become a core positioning solution for moving vehicles such as Automated Guided Vehicles (AGVs), mobile robots, and conveyor belts due to its advantages such as controllable cost, high positioning accuracy, and absence of electromagnetic interference. This technology involves laying barcodes containing coded information along the movement path. Cameras mounted on the vehicle capture images of the barcodes in real time, and algorithms analyze the coded data to determine the current position, supporting precise motion control of the equipment. However, with the increasing complexity of application scenarios, the working environment of the barcodes is becoming increasingly harsh. Oil and dust in industrial workshops, mechanical friction in logistics warehouses, and wind and rain erosion in outdoor environments can all lead to problems such as partial missing sections, surface dirt, or obstruction of the barcodes. Traditional positioning technologies have extremely low tolerance for these defects, easily causing positioning interruptions or a sharp drop in accuracy, severely impacting production efficiency. Summary of the Invention
[0003] Embodiments of this disclosure provide a visual positioning method, apparatus, and electronic device to combat code band defects, aiming to solve one or more of the above-mentioned problems and other potential problems.
[0004] According to a first aspect of this disclosure, a visual positioning method for resisting codeband defects is provided. The method includes acquiring a first image of a current frame, identifying each valid coding block in the first image to determine the position value of each valid coding block; calculating a sequence factor and a sharpness factor for each valid coding block respectively, calculating a first weight for each valid coding block based on the sequence factor and the sharpness factor, wherein the sequence factor decreases when the sequence number between the valid coding blocks and the adjacent valid coding blocks is discontinuous, and the sharpness factor decreases when the sharpness is lower than a sharpness threshold; and after weighted summing of each position value based on the first weight, determining a first position reference value for the current frame based on the ratio between the weighted value and the total weight corresponding to the first weight, so as to correct the first image based on the first position reference value.
[0005] According to a second aspect of this disclosure, a visual positioning device for resisting code band defects is provided. The device includes an image recognition module configured to acquire a target image of the current frame, identify each valid coding block in the target image, and determine the position value of each valid coding block; a weight determination module configured to calculate a sequence factor and a sharpness factor for each valid coding block, calculate a first weight for each valid coding block based on the sequence factor and the sharpness factor, wherein the sequence factor decreases when the sequence number between the valid coding blocks and the adjacent valid coding blocks is discontinuous, and the sharpness factor decreases when the sharpness is lower than a sharpness threshold; and an image correction module configured to perform a weighted summation of each position value based on the first weight, and determine an actual position reference value for the current frame based on the ratio between the weighted value and the total weight corresponding to the first weight, so as to correct the first image based on the actual position reference value.
[0006] According to a third aspect of this disclosure, an electronic device is provided, including one or more processors and a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform a method provided according to a first scheme.
[0007] According to a fourth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method provided according to the first aspect.
[0008] The scheme provided in the embodiments of this specification can assign a first weight through sequence factor and sharpness factor, and perform multi-code block weighted fusion on each effective code block according to the first weight, so as to correct the first image according to the first position reference value. This can break through the dependence on a single code block. When there are missing, occluded or dirty code bands, accurate positioning can still be achieved through other effective code blocks, ensuring the stability of the data. Attached Figure Description
[0009] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0010] Figure 1 A flowchart illustrating a visual localization method for resisting code band defects according to some embodiments of the present disclosure is shown.
[0011] Figure 2 A schematic diagram of the structure of a visual positioning device for resisting code band defects according to some embodiments of the present disclosure is shown;
[0012] Figure 3 A schematic block diagram of an electronic device according to some embodiments of the present disclosure is shown. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0014] The terms “comprising” and “having”, and any variations thereof, in this specification, claims, and the foregoing drawings are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus. Depending on the context, the word “if” as it applies herein may be interpreted as “when”, “in response to determination”, or “in response to detection”.
[0015] As mentioned earlier, the core logic of existing code-based visual positioning technology is "single-block code recognition + position mapping," which means directly matching preset position coordinates by recognizing the encoding information of a single complete code block in an image. This approach has three main problems: First, the position calculation dimension is singular, leading to fluctuating accuracy. Existing algorithms rely solely on single-block encoding for position calculation, failing to explore the information of multiple code blocks simultaneously present in the image. When a single code block is affected by defects and exhibits parsing errors, there is no other reference data for correction, resulting in drastic fluctuations in positioning accuracy. Second, the inter-frame data correlation is weak, leading to a high rate of false positives due to defects. Existing algorithms only independently parse single-frame images, without establishing a correlation and verification mechanism between the positions of code blocks in preceding and following frames. When the code band does not physically move but the local occlusion area changes, the difference in encoding parsing is easily misjudged as carrier movement, causing irregular jitter in the positioning results and affecting the stability of device control. Third, dynamic adaptability is poor, with significant scene limitations. Existing technology does not distinguish between the "stationary" and "moving" states of the carrier, consistently employing a full-area image recognition strategy. When the carrier is stationary, if there is a temporary occlusion in a part of the code band, the algorithm will still repeatedly analyze the changing image area, which will aggravate the positioning jitter. When the carrier is moving, the defect interference range will expand because the recognition area locking logic is not optimized.
[0016] Figure 1 A flowchart illustrating a visual localization method 100 for resisting code band defects according to some embodiments of this disclosure is shown. Method 100 can be executed by a terminal, which may include, but is not limited to, mobile phones, tablets, desktop computers, servers, etc. Figure 1As shown, in method 100, step 102 can acquire the first image of the current frame, identify each valid coding block in the first image, and determine the position value of each valid coding block.
[0017] In this embodiment, a pre-set camera can capture images of the location of the code band to obtain the first image corresponding to the current frame. Then, using an image recognition model (e.g., a convolutional neural network model, a Transformer-based visual model, etc.) trained with labeled coded block regions as training data, coded blocks can be identified in the first image. Furthermore, complete (i.e., matching degree with standard coded blocks in the database higher than a threshold) valid coded blocks are determined within each coded block, and the position value of each valid coded block is determined. A valid coded block corresponds to a region, and this position value can be, for example, the center point of that region, or the difference between the center point of the coded block region and the center point of the overall recognition region corresponding to all coded blocks in the first image.
[0018] In method 100, step 104 can calculate the sequence factor and sharpness factor for each valid coding block, and calculate the first weight of each valid coding block based on the sequence factor and sharpness factor. The sequence factor decreases when the sequence number between the valid coding blocks and the adjacent valid coding blocks is discontinuous, and the sharpness factor decreases when the sharpness is lower than the sharpness threshold.
[0019] In this embodiment, each coded block on the code band is generally binary encoded during production, so that when a valid coded block is identified, its corresponding sequence number can be determined. If the sequence number of a valid coded block is not consecutive with other adjacent valid coded blocks, it indicates that there are incomplete or unidentified coded blocks nearby, reducing the confidence of that coded block. Therefore, the identification position of that coded block should not be used as a primary reference for localization, and its corresponding sequence factor is reduced (the sequence factor can initially be, for example, 1; the reduction value can be a fixed value or different values can be set based on the continuity of the sequence numbers, i.e., whether only one adjacent valid coded block has a non-consecutive sequence number or whether two adjacent valid coded blocks have non-consecutive sequence numbers). Similarly, the sharpness factor of each valid coded block is calculated, specifically through methods such as calculating edge gradients using the Sobel operator, comparing black and white pixels using the Otsu threshold, and the decoder scoring the barcode's confidence. When the sharpness is lower than a preset sharpness threshold, the sharpness factor is also reduced; the reduction value can be a fixed value or proportionally reduced based on the difference from the sharpness threshold. In this way, based on the calculated sequence factor and sharpness factor, the first weight corresponding to each valid coding block can be calculated. The first weight can be determined by, for example, directly adding the sequence factor and sharpness factor, or by multiplying the two by a preset initial weight.
[0020] In method 100, step 106 can perform a weighted summation of each position value based on the first weight, and then determine the first position reference value of the current frame based on the ratio between the weighted value and the total weight corresponding to the first weight, so as to correct the first image based on the first position reference value.
[0021] In this embodiment, based on a determined first weight, each position value can be weighted, and then the first position reference value of the current frame is calculated based on the ratio of the weighted value to the total weight. The first position reference value can be regarded as the center point reference value of the region formed by all the identified valid coding blocks, and the position of each coding block in the first image can be corrected based on the first position reference value. As an example, if the first position reference value is different from the center point value directly formed by all valid coding blocks, the position of all coding blocks will be adjusted based on the difference between the two. As another example, the distance between the position value of each coding block and the center point value and the first position reference value can be calculated separately, and the position of each coding block can be adjusted individually based on the difference between the two distance values. In this way, even if a single code block has defects, accurate positioning can still be achieved through other valid coding blocks, ensuring the effectiveness and accuracy of the fusion calculation.
[0022] In one possible implementation, identifying each valid coded block in the first image includes:
[0023] Acquire a second image with a preset number of frames, and calculate the positional change of the effective coded block region in the second image;
[0024] Based on the comparison between the position change amount and the preset change amount threshold, the recognition area is determined in the first image, so as to identify each valid coding block within the recognition area.
[0025] In this embodiment, the recognition results of the second images acquired from the previous preset number of frames (e.g., the first 3 frames) are also obtained to determine the center point of the effective coding block region formed by all effective coding blocks in each second image, and then to determine the amount of position change within the preset number of frames. Different recognition regions are determined in the first image based on the different amounts of position change. As an example, if the comparison result shows that the amount of position change does not exceed the change threshold, the codeband is considered stationary and has not moved, and the effective coding block region identified in the previous frame can be directly used as the recognition region for the current frame. Conversely, if the codeband is in motion, its movement speed needs to be calculated based on the positions of the effective coding block regions in the previous 3 frames, and its position in the current frame needs to be predicted to set the recognition region accordingly. This effectively divides the recognition region in the first image, allowing for the recognition of coding blocks only within the recognition region, reducing interference from irrelevant areas, avoiding meaningless parsing fluctuations caused by the expansion of defective recognition regions, and improving recognition accuracy.
[0026] In one possible implementation, determining the recognition region in the first image based on the comparison result of the position change amount and a preset change amount threshold includes:
[0027] In response to the position change not being greater than the change threshold, the effective coding block region corresponding to the second image of the previous frame is determined as the recognition region.
[0028] In response to a position change exceeding a threshold, the motion velocity is calculated based on the position change, the predicted region of the effective coded block region in the next frame is calculated based on the motion velocity, and the recognition region is determined based on the predicted region.
[0029] In this embodiment, when the position change is no greater than a change threshold, the effective coded block region identified in the second image of the previous frame is used as the recognition region. When the position change is greater than the change threshold, the motion velocity and acceleration corresponding to the displacement change of the center point of the effective coded block region within a preset number of frames can be calculated, and then the predicted region corresponding to the effective coded block region in the next frame can be calculated, thereby determining the recognition region. In this case, the recognition region can be directly the predicted region, or it can be set to the area surrounding the predicted region to account for errors. Within the range, etc.
[0030] In one possible implementation, identifying each valid coded block within the identification area includes:
[0031] Identify the positioning edges within the identification area, and divide the coding block area according to the positioning edges to obtain each candidate coding block;
[0032] Calculate the completeness of each candidate coding block and remove candidate coding blocks whose completeness is lower than the preset completeness threshold to obtain each effective coding block.
[0033] In this embodiment, each coding block on the codeband is positioned by a corresponding positioning edge. Based on these edges, the boundaries between coding blocks can be determined, thus dividing the code into independent coding block regions. The image within each region is then used as a candidate coding block for identification. Next, binarization processing (e.g., Otsu adaptive thresholding) is used to calculate the completeness of each candidate coding block. Candidate coding blocks with a completeness threshold below a preset threshold are considered incomplete or missing and are therefore discarded, leaving only complete and valid coding blocks for subsequent processing.
[0034] In one possible implementation, calculating a first weight for each valid coded block based on a sequence factor and a sharpness factor includes:
[0035] The first weight of each valid coded block is calculated based on the product of the initial weight, sequence factor, and clarity factor.
[0036] In this embodiment, each valid coding block can be set with the same initial weight. After the sequence factor and sharpness factor are determined, the product of the initial weight, sequence factor and sharpness factor is used as the first weight of each valid coding block.
[0037] In one possible implementation, correcting the first image based on a first position reference value includes:
[0038] Determine the positional error of each valid coded block between the current frame and the previous frame;
[0039] In response to the existence of at least one valid coded block corresponding to a position error less than an error threshold, the first image is corrected according to the second position reference value corresponding to the previous frame;
[0040] In response to the fact that the position error corresponding to all valid coding blocks is not less than the error threshold, the third position reference value of the current frame is calculated based on the motion speed of the valid coding blocks, so as to correct the first image according to the first position reference value and the third position reference value.
[0041] In this embodiment, before correcting the first image, the position values of each valid coding block in the current frame and the previous frame can be determined individually to calculate the position error of each valid coding block between the current and previous frames. If the position error of at least one valid coding block is less than a preset error threshold (e.g., 0.1 mm), it is considered that the position of the current frame may fluctuate due to defects, and the codeband has not actually moved physically. In this case, the second position reference value, determined by the same process as the previous frame image, is used to correct the first image, thereby further improving the accuracy of the corrected first image through inter-frame correlation verification. If the position errors of all valid coding blocks are not less than the error threshold, it is considered that the codeband carrier is moving. In this case, the theoretical third position reference value is predicted based on the movement speed of the valid coding block region (which can be calculated using the displacement between the second images of the previous preset number of frames, consistent with the aforementioned process). The first image is then corrected by combining the theoretical third position reference value calculated based on the movement speed with the first position reference value determined by weighted fusion of multiple code blocks. As an example, the two position reference values can be weighted according to preset weights to obtain the final determined position, or the average of the two position reference values can be taken, etc.
[0042] In one possible implementation, correcting the first image based on a first position reference value and a third position reference value includes:
[0043] Based on the proportion of the number of valid coding blocks in the current frame relative to all coding blocks, a second weight is assigned to the first position reference value and the third position reference value. The second weight corresponding to the first position reference value is positively correlated with the proportion of the number.
[0044] Based on the second weight, the first position reference value and the third position reference value are weighted and calculated to obtain the target position reference value, so as to correct the first image according to the target position reference value.
[0045] In this embodiment, when assigning second weights to the first and third position reference values, the proportion of valid coded blocks within the current frame can be considered. A higher proportion indicates a higher reliability of the first position reference value obtained through weighted fusion based on valid coded blocks, thus assigning it a higher second weight. Conversely, a lower proportion assigns a higher second weight to the theoretical value calculated based on motion speed (i.e., the third position reference value). The specific mapping relationship between the proportion and the second weights can be adjusted and set according to actual needs. Thus, the target position reference value obtained by weighting the first and third position reference values according to the second weights will be used as the most accurate final position reference value, thereby correcting the first image.
[0046] Figure 2Schematic diagrams of a visual positioning device 200 for resisting code band defects according to some embodiments of this disclosure are shown. The various embodiments in this specification are described in a progressive manner, with reference to each other for similar or identical parts. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions of the method embodiments. Figure 2 As shown, the device 200 includes an image recognition module 201, configured to acquire a target image of the current frame, identify each valid coding block in the target image, and determine the position value of each valid coding block; a weight determination module 202, configured to calculate the sequence factor and sharpness factor of each valid coding block respectively, calculate a first weight of each valid coding block based on the sequence factor and sharpness factor, wherein the sequence factor decreases when the sequence number between the valid coding block and the adjacent valid coding block is discontinuous, and the sharpness factor decreases when the sharpness is lower than the sharpness threshold; and an image correction module 203, configured to perform a weighted summation of each position value based on the first weight, and determine the actual position reference value of the current frame based on the ratio between the weighted value and the total weight corresponding to the first weight, so as to correct the first image based on the actual position reference value.
[0047] In one possible implementation, the image recognition module 201 is further configured to acquire a second image with a preset number of frames, calculate the position change of the effective coding block region in the second image, and determine the recognition region in the first image based on the comparison result of the position change and a preset change threshold, so as to identify each effective coding block within the recognition region.
[0048] In one possible implementation, the image recognition module 201 is further configured to, in response to a position change amount not exceeding a change amount threshold, determine the effective coding block region corresponding to the second image of the previous frame as the recognition region; and in response to a position change amount exceeding the change amount threshold, calculate the motion speed based on the position change amount, calculate the predicted region of the effective coding block region in the next frame based on the motion speed, and determine the recognition region based on the predicted region.
[0049] In one possible implementation, the image recognition module 201 is further configured to identify positioning edges within the recognition area, so as to divide the coding block area according to the positioning edges to obtain each candidate coding block; calculate the integrity of each candidate coding block, and remove candidate coding blocks whose integrity is lower than a preset integrity threshold to obtain each effective coding block.
[0050] In one possible implementation, the weight determination module 202 is further configured to calculate a first weight for each valid coding block based on the product between the initial weight, the sequence factor, and the sharpness factor.
[0051] In one possible implementation, the image correction module 203 is further configured to determine the position error of each valid coding block between the current frame and the previous frame; in response to the existence of a position error less than an error threshold corresponding to at least one valid coding block, to correct the first image based on a second position reference value corresponding to the previous frame; and in response to the existence of position errors not less than the error threshold corresponding to all valid coding blocks, to calculate a third position reference value of the current frame based on the motion speed of the valid coding blocks, so as to correct the first image based on the first position reference value and the third position reference value.
[0052] In one possible implementation, the image correction module 203 is further configured to assign a second weight to the first position reference value and the third position reference value based on the proportion of the number of valid coding blocks in the current frame relative to all coding blocks, wherein the second weight corresponding to the first position reference value is positively correlated with the proportion of the number; based on the second weight, the first position reference value and the third position reference value are weighted and calculated to obtain the target position reference value, so as to correct the first image according to the target position reference value.
[0053] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this specification is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0054] Figure 3 A block diagram of an electronic device 300 that can implement various embodiments of the present disclosure is shown. For example... Figure 3As shown, the electronic device 300 includes a processor 310, a disk drive 320, an input / output interface 330, a network interface 340, and a memory 350. The processor 310, disk drive 320, input / output interface 330, network interface 340, and memory 350 can communicate with each other via a communication bus 360.
[0055] The processor 310 can be implemented using a general-purpose CPU, microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs in order to implement the technical solution provided in this application.
[0056] The memory 350 can be implemented in the form of ROM (Read Only Memory), RAM (Read Access Memory), static memory, dynamic storage devices, etc. The memory 350 can store the operating system 351 used to control the operation of the electronic device 300, and the basic input / output system (BIOS) 352 used to control the low-level operations of the electronic device 300. Additionally, it can store a web browser 353, a data storage management system 354, etc. In summary, when the technical solution provided in this application is implemented through software or firmware, the relevant program code is stored in the memory 350 and is called and executed by the processor 310.
[0057] Input / output interface 330 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, vibrators, indicator lights, etc.
[0058] Network interface 340 is used to connect a communication module (not shown in the figure) to enable communication and interaction between the device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0059] Bus 360 includes a pathway for transmitting information between various components of the device, such as processor 310, disk drive 320, input / output interface 330, network interface 340, and memory 350.
[0060] It should be noted that although the above-described device only shows the processor 310, disk drive 320, input / output interface 330, network interface 340, memory 350, bus 360, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the method of this application, and does not necessarily include all the components shown in the figures.
[0061] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0062] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. Furthermore, although operations are depicted in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the foregoing discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations.
[0063] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A visual positioning method for resisting code band defects, characterized in that, The method includes: Acquire the first image of the current frame, identify each valid coded block in the first image, and determine the position value of each valid coded block; Calculate the sequence factor and sharpness factor for each effective coding block, and calculate the first weight of each effective coding block based on the sequence factor and sharpness factor. The sequence factor decreases when the sequence number between the effective coding block and the adjacent effective coding block is discontinuous, and the sharpness factor decreases when the sharpness is lower than the sharpness threshold. After weighting and summing each position value based on the first weight, the first position reference value of the current frame is determined according to the ratio between the weighted value and the total weight corresponding to the first weight, so as to correct the first image based on the first position reference value.
2. The visual positioning method for resisting code band defects according to claim 1, characterized in that, The step of identifying each valid coded block in the first image includes: Acquire a second image with a preset number of frames, and calculate the positional change of the effective coded block region in the second image; Based on the comparison result between the position change amount and the preset change amount threshold, a recognition region is determined in the first image, so as to identify each valid coding block within the recognition region.
3. The visual positioning method for resisting code band defects according to claim 2, characterized in that, The determination of the recognition region in the first image based on the comparison result between the position change amount and a preset change amount threshold includes: In response to the fact that the position change is not greater than the change threshold, the effective coding block region corresponding to the second image of the previous frame is determined as the recognition region. In response to the position change being greater than a change threshold, the motion speed is calculated based on the position change, the predicted region of the effective coding block region in the next frame is calculated based on the motion speed, and the recognition region is determined based on the predicted region.
4. The visual positioning method for resisting code band defects according to claim 2, characterized in that, The step of identifying each valid coded block within the identification area includes: Within the identification area, positioning edges are identified to divide the coding block region according to the positioning edges, thereby obtaining each candidate coding block; Calculate the completeness of each candidate coding block and remove candidate coding blocks whose completeness is lower than the preset completeness threshold to obtain each effective coding block.
5. The visual positioning method for resisting code band defects according to claim 1, characterized in that, The step of calculating the first weight of each effective coding block based on the sequence factor and the sharpness factor includes: The first weight of each effective coding block is calculated based on the initial weight, the product of the sequence factor and the sharpness factor.
6. The visual positioning method for resisting code band defects according to claim 1, characterized in that, The step of correcting the first image based on the first position reference value includes: Determine the positional error of each valid coded block between the current frame and the previous frame; In response to the existence of at least one valid coded block corresponding to a position error less than an error threshold, the first image is corrected according to the second position reference value corresponding to the previous frame; In response to the fact that the position error corresponding to all valid coding blocks is not less than the error threshold, the third position reference value of the current frame is calculated based on the motion speed of the valid coding blocks, so as to correct the first image according to the first position reference value and the third position reference value.
7. The visual positioning method for resisting code band defects according to claim 6, characterized in that, The step of correcting the first image based on the first position reference value and the third position reference value includes: Based on the proportion of the number of valid coding blocks in the current frame relative to all coding blocks, a second weight is assigned to the first position reference value and the third position reference value. The second weight corresponding to the first position reference value is positively correlated with the proportion of the number. Based on the second weight, the first position reference value and the third position reference value are weighted and calculated to obtain the target position reference value, so as to correct the first image according to the target position reference value.
8. A visual positioning device resistant to code band defects, characterized in that, The device includes: The image recognition module is configured to acquire the target image of the current frame, identify each valid coding block in the target image, and determine the position value of each valid coding block; The weight determination module is configured to calculate the sequence factor and sharpness factor for each of the effective coding blocks, and calculate a first weight for each of the effective coding blocks based on the sequence factor and sharpness factor. The sequence factor decreases when the sequence number between the effective coding blocks and the adjacent effective coding blocks is discontinuous, and the sharpness factor decreases when the sharpness is lower than the sharpness threshold. The image correction module is configured to perform a weighted summation of each position value based on the first weight, and then determine the actual position reference value of the current frame according to the ratio between the weighted value and the total weight corresponding to the first weight, so as to correct the first image according to the actual position reference value.
9. An electronic device, characterized in that, include: One or more processors, and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of a visual localization method for resisting code band defects according to any one of claims 1-7.
10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements a visual positioning method for resisting code band defects according to any one of claims 1-7.