Monocular vision measurement target displacement correction method and device and computer equipment

By binarizing the target area image and calculating the corner coordinates, the angle between the target and the camera plane is corrected, which solves the pixel error problem caused by the non-parallelism between the target and the camera and improves the visual measurement accuracy.

CN116007505BActive Publication Date: 2025-10-17杭州鲁尔物联科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211619877.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-15
Publication Date
2025-10-17
Estimated Expiration
2042-12-15

AI Technical Summary

Technical Problem

In deformation monitoring of bridges, slopes, dams, reservoirs, etc., the pixel error caused by the non-parallelism between the target and the camera imaging plane is large, affecting the accuracy of visual measurement. The existing installation method relies on human experience, and the error is particularly significant at long distances.

Method used

By acquiring the target area image, performing binarization processing, extracting the target outline, calculating the pixel coordinates of the four corner points of the target, and correcting them according to the angle, it ensures that the target is parallel to the camera plane and reduces errors.

Benefits of technology

It achieves precise correction of target displacement, improves the accuracy of visual measurement, and reduces monitoring errors caused by pixel errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116007505B_ABST
    Figure CN116007505B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose monocular vision measurement target displacement correction method, device and computer equipment. The method comprises: acquiring a target area image; binarizing the target area image to obtain a binary image; extracting a target contour from the binary image to obtain target contour coordinates; calculating pixel coordinates of four corner points of the target according to the target contour coordinates; calculating an angle between the target and a camera plane according to the pixel coordinates of the four corner points of the target; and correcting displacement of the target according to the angle between the target and the camera plane to obtain a correction result. The method can correct the displacement of the target and ensure the accuracy of the vision measurement.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to a visual displacement correction method, in particular to a monocular visual measurement target displacement correction method, device and computer equipment. BACKGROUND

[0002] The monocular camera displacement measurement based on a target is commonly used for deformation monitoring of bridges, slopes, dams and reservoirs. The distance between the target and the camera in the above-mentioned scene is generally far, the actual size corresponding to one pixel of the target is large, and the monitoring error of one pixel will lead to a large actual monitoring error. The imaging plane of the camera and the plane of the target are not parallel, and the displacement of the target in the vertical direction can cause a large error, so that the correction of the target in the vertical direction to be parallel to the imaging plane of the camera can effectively reduce the error in the monocular visual deformation monitoring process.

[0003] At present, the installation method of the target based on the monocular visual deformation monitoring mainly relies on human experience, and there is a certain angle between the target plane and the imaging plane of the target in the camera, which affects the monitoring accuracy, especially at a long distance, the actual size corresponding to one pixel is large, and the error caused thereby will be larger.

[0004] Therefore, it is necessary to design a new method to correct the displacement of the target and ensure the visual measurement accuracy. SUMMARY

[0005] The present application aims to overcome the defects of the prior art and provide a monocular visual measurement target displacement correction method, device and computer equipment.

[0006] To achieve the above-mentioned purpose, the present application adopts the following technical scheme: a monocular visual measurement target displacement correction method, comprising:

[0007] acquiring a target region image;

[0008] binaryzation of the target region image to obtain a binary image;

[0009] extracting a target contour from the binary image to obtain target contour coordinates;

[0010] calculating pixel coordinates of four corner points of the target according to the target contour coordinates;

[0011] calculating an included angle between the target and the camera plane according to the pixel coordinates of the four corner points of the target;

[0012] correcting the displacement of the target according to the included angle between the target and the camera plane to obtain a correction result.

[0013] The further technical scheme is that the extraction of the target contour from the binary image to obtain the target contour coordinates comprises:

[0014] The contour of the target is found by using opencv findContours on the binary image to obtain target contour coordinates.

[0015] A further technical solution is that the included angle between the target and the camera plane is calculated according to the pixel coordinates of the four corner points of the target, and the method comprises the following steps:

[0016] The pixel side length of the target is calculated according to the pixel coordinates of the four corner points of the target.

[0017] The included angle between the target and the vertical direction of the camera imaging plane is calculated according to the pixel side length of the target, so as to obtain the included angle between the target and the camera plane.

[0018] A further technical solution is that the pixel side length of the target is calculated according to the pixel coordinates of the four corner points of the target, and the method comprises the following steps:

[0019] The side of the target close to the image coordinate system and the side far away from the image coordinate system are determined according to the size relationship of the pixel coordinates of the four corner points of the target.

[0020] The horizontal distance between the side of the target close to the image coordinate system and the side far away from the image coordinate system is calculated to obtain the pixel side length of the target.

[0021] A further technical solution is that the included angle between the target and the vertical direction of the camera imaging plane is calculated according to the pixel side length of the target, so as to obtain the included angle between the target and the camera plane, and the method comprises the following steps:

[0022] The vertical distance between the side of the target close to the image coordinate system and the side far away from the image coordinate system is calculated to obtain the vertical distance.

[0023] The included angle between the target and the vertical direction of the camera imaging plane is calculated according to the pixel side length of the target and the vertical distance, so as to obtain the included angle between the target and the camera plane.

[0024] The application also provides a monocular vision target displacement measurement correction device, which comprises:

[0025] An image acquisition unit is configured to acquire a target region image.

[0026] A binaryzation unit is configured to binaryzate the target region image to obtain a binary image.

[0027] An extraction unit is configured to extract a target contour from the binary image to obtain target contour coordinates.

[0028] A coordinate calculation unit is configured to calculate pixel coordinates of four corner points of the target according to the target contour coordinates.

[0029] An included angle calculation unit is configured to calculate an included angle between the target and a camera plane according to the pixel coordinates of the four corner points of the target.

[0030] The correction unit is used for correcting the displacement of the target according to the included angle between the target and the camera plane to obtain a correction result.

[0031] A further technical solution is that the extraction unit is used for finding the contour of the target by using opencvfindContours on the binary image to obtain target contour coordinates.

[0032] A further technical solution is that the included angle calculation unit comprises:

[0033] The pixel side length calculation subunit is used for calculating the pixel side length of the target according to the pixel coordinates of the four corner points of the target.

[0034] The included angle determination subunit is used for calculating the included angle between the target and the vertical direction of the camera imaging plane according to the pixel side length of the target to obtain the included angle between the target and the camera plane.

[0035] The application further provides a computer device comprising a memory and a processor, the memory has a computer program stored thereon, and the processor realizes the method described above when executing the computer program.

[0036] The application further provides a storage medium, which stores a computer program, and the computer program can realize the method described above when executed by a processor.

[0037] Compared with the prior art, the application has the beneficial effects that: the target region image is binarized, the target contour is extracted from the binary image, the pixel coordinates of the four corner points of the target are calculated, the included angle between the target and the camera plane is further calculated, the displacement of the target is corrected by using the included angle, the displacement of the target is corrected, and the visual measurement precision is ensured.

[0038] The application will be further described below in combination with the drawings and specific embodiments. BRIEF DESCRIPTION OF DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of the application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.

[0040] Figure 1 The application provides a monocular visual measurement target displacement correction method, and a scene diagram of an application scenario of the monocular visual measurement target displacement correction method is shown.

[0041] Figure 2 The application provides a monocular visual measurement target displacement correction method, and a flowchart of the monocular visual measurement target displacement correction method is shown.

[0042] Figure 3 A sub-process schematic diagram of the monocular vision measurement target displacement correction method provided by the embodiment of the present application is provided.

[0043] Figure 4 A sub-process schematic diagram of the monocular vision measurement target displacement correction method provided by the embodiment of the present application is provided.

[0044] Figure 5 A sub-process schematic diagram of the monocular vision measurement target displacement correction method provided by the embodiment of the present application is provided.

[0045] Figure 6 A schematic diagram of the binary image provided by the embodiment of the present application is provided.

[0046] Figure 7 A schematic block diagram of the monocular vision measurement target displacement correction device provided by the embodiment of the present application is provided.

[0047] Figure 8 A schematic block diagram of the included angle calculation unit of the monocular vision measurement target displacement correction device provided by the embodiment of the present application is provided.

[0048] Figure 9 A schematic block diagram of the pixel side length calculation sub-unit of the monocular vision measurement target displacement correction device provided by the embodiment of the present application is provided.

[0049] Figure 10 A schematic block diagram of the included angle determination sub-unit of the monocular vision measurement target displacement correction device provided by the embodiment of the present application is provided.

[0050] Figure 11 A schematic block diagram of the computer device provided by the embodiment of the present application is provided. DETAILED DESCRIPTION

[0051] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0052] It should be understood that when used in the specification and the appended claims, the terms “comprise” and “include” indicate the presence of described features, integers, steps, operations, elements, and / or components, but do not exclude one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0053] It is also to be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting. As used in this specification and the appended claims, the singular forms "a," "an" and "the" include plural referents unless the context clearly dictates otherwise.

[0054] It is further to be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items, and that the term "at least one of' encompasses any and all possible combinations of one or more of the associated listed items.

[0055] Reference is made to Figure 1 and Figure 2 , Figure 1 The application scenario schematic diagram of the monocular vision measurement target displacement correction method provided by the embodiment of the present application is shown in FIG. 1. Figure 2 The schematic flowchart of the monocular vision measurement target displacement correction method provided by the embodiment of the present application is shown in FIG. 2. The monocular vision measurement target displacement correction method is applied to a server. The server interacts with a camera, performs mean value binarization on a target region image obtained by the camera, extracts a target contour, calculates pixel coordinates of four corner points of a direction target, calculates an included angle between a target plane and a vertical direction of a target imaging plane in the camera according to coordinates of four top points of the square target, corrects a monitored displacement according to the calculated included angle, realizes correction of the target displacement, and ensures the accuracy of the vision measurement.

[0056] Figure 2 The flowchart of the monocular vision measurement target displacement correction method provided by the embodiment of the present application is shown in FIG. 3. As shown in FIG. 3, the method comprises the following steps S110 to S160. Figure 2

[0057] S110, a target region image is acquired.

[0058] In the embodiment, the target region image refers to an image formed by the camera shooting a position where the target is located.

[0059] Specifically, the target is a square target, and the size of the target can be appropriately selected according to the length of the distance.

[0060] S120, the target region image is binarized to obtain a binarized image.

[0061] In the embodiment, the binarized image refers to a result formed after the target region image is subjected to mean value binarization. The result after binarization is shown in FIG. 4. Figure 6

[0062] Specifically, the pixel mean value of the target region image is calculated, and the binarized image of the target is calculated according to the pixel mean value. ​​

[0063] S130, extracting a target contour from the binary image to obtain target contour coordinates.

[0064] In the embodiment, the target contour coordinates refer to boundary coordinates of the target.

[0065] In the embodiment, the opencv findContours is used to find the contour of the target from the binary image to obtain the target contour coordinates.

[0066] Specifically, the opencv findContours is used to find the contour of the target from the binary image according to the pixel area and other characteristics of the target area image.

[0067] S140, calculating pixel coordinates of four corner points of the target according to the target contour coordinates.

[0068] In the embodiment, the pixel coordinates of the four corner points of the target refer to pixel coordinates of the left upper, right upper, left lower and right lower four corner points of the target.

[0069] Specifically, the contour pixel points of the target image, i.e. the target contour coordinates, are denoted as X, which can be represented as [(x1, y1), (x2, y2), … (x n , y n )]; the pixel coordinates corresponding to the minimum value and the maximum value of [x1, x2, …, x n ] are denoted as (x i , y i ) and (x j , y j ) respectively; the pixel coordinates corresponding to the minimum value and the maximum value of [y1, y2, …, y n ] are denoted as (x k , y k ) and (x q , y q ) respectively; thus, (x i , y i ), (x j , y j ), (x k , y k ) and (x q , y q ) form the pixel coordinates of the four corner points of the target.

[0070] S150, calculating an included angle between the target and the camera plane according to the pixel coordinates of the four corner points of the target.

[0071] In the embodiment, the included angle between the target and the camera plane refers to the included angle between the target and the vertical direction of the camera imaging plane.

[0072] In an embodiment, please refer toFigure 3 The step S150 can include steps S151-S152.

[0073] S151, calculate the pixel side length of the target according to the pixel coordinates of the four corner points of the target.

[0074] In the embodiment, the pixel side length of the target refers to the horizontal side length of the square target.

[0075] In an embodiment, referring to Figure 4 The step S151 can include steps S1511-S1512.

[0076] S1511, determine the side of the target close to the image coordinate system and the side of the target far away from the image coordinate system according to the size relationship of the pixel coordinates of the four corner points of the target.

[0077] In the embodiment, the side of the target close to the image coordinate system refers to the side of the target close to the whole image captured by the camera; and the side of the target far away from the image coordinate system refers to the side of the target far away from the whole image captured by the camera.

[0078] S1512, calculate the horizontal distance between the side of the target close to the image coordinate system and the side of the target far away from the image coordinate system to obtain the pixel side length of the target.

[0079] S152, calculate the angle between the target and the imaging plane of the camera in the vertical direction according to the pixel side length of the target to obtain the angle between the target and the imaging plane of the camera.

[0080] In an embodiment, referring to Figure 5 The step S152 can include steps S1521-S1522.

[0081] S1521, calculate the vertical distance between the side of the target close to the image coordinate system and the side of the target far away from the image coordinate system to obtain the vertical distance.

[0082] In the embodiment, the vertical distance refers to the vertical distance between the side of the target close to the image coordinate system and the side of the target far away from the image coordinate system.

[0083] S1522, calculate the angle between the target and the imaging plane of the camera in the vertical direction according to the pixel side length of the target and the vertical distance to obtain the angle between the target and the imaging plane of the camera.

[0084] According to the calculated four corner point coordinates, the horizontal side length of the square target is calculated, and the angle between the target and the imaging plane of the camera in the vertical direction is calculated according to the pixel side length of the target and the vertical distance. i i j j k k q q ​​​​​​​The size relationship of d1 and d2 determines the proximity of the target to the image coordinate system and the distance from the image coordinate system, and d is the vertical distance between d1 and d2. If y k << y i < y j << y q d1=x k -x i , d2=x j -x q , d=y q -y i If y k << y j < y i << y q d1=x j -x k , d2=x q -x i , d=y i -y k . The angle between the target and the camera imaging plane is

[0085] S160, according to the angle between the target and the camera plane, the displacement of the target is corrected to obtain the correction result.

[0086] Specifically, according to the angle between the target and the camera imaging plane, the monitoring displacement of the target is corrected, and the monitoring displacement is d m , the correction displacement is d c , then

[0087] The monocular vision measurement target displacement correction method described above, by binarizing the target region image, extracting the target contour from the binarized image, and calculating the pixel coordinates of the four corner points of the target, further calculating the angle between the target and the camera plane, and correcting the displacement of the target using the angle, realizes the correction of the target displacement, and ensures the accuracy of the vision measurement.

[0088] Figure 7 is a schematic block diagram of a monocular vision measurement target displacement correction device 300 provided by an embodiment of the application. As Figure 7 shown, corresponding to the above monocular vision measurement target displacement correction method, the application also provides a monocular vision measurement target displacement correction device 300. The monocular vision measurement target displacement correction device 300 includes units for executing the above monocular vision measurement target displacement correction method, and the device can be configured in a server. Specifically, please refer to Figure 7The monocular vision measurement target displacement correction device 300 comprises an image acquisition unit 301, a binarization unit 302, an extraction unit 303, a coordinate calculation unit 304, an included angle calculation unit 305, and a correction unit 306.

[0089] The image acquisition unit 301 is configured to acquire a target region image; the binarization unit 302 is configured to binarize the target region image to obtain a binarized image; the extraction unit 303 is configured to extract a target contour from the binarized image to obtain target contour coordinates; the coordinate calculation unit 304 is configured to calculate pixel coordinates of four corner points of the target according to the target contour coordinates; the included angle calculation unit 305 is configured to calculate an included angle between the target and a camera plane according to the pixel coordinates of the four corner points of the target; and the correction unit 306 is configured to correct a displacement of the target according to the included angle between the target and the camera plane to obtain a correction result.

[0090] In an embodiment, the extraction unit 303 is configured to use opencvfindContours to find the contour of the target from the binarized image to obtain the target contour coordinates.

[0091] In an embodiment, as shown in Figure 8 the included angle calculation unit 305 comprises a pixel edge length calculation subunit 3051 and an included angle determination subunit 3052.

[0092] The pixel edge length calculation subunit 3051 is configured to calculate a pixel edge length of the target according to the pixel coordinates of the four corner points of the target; and the included angle determination subunit 3052 is configured to calculate an included angle between the target and a vertical direction of a camera imaging plane according to the pixel edge length of the target to obtain the included angle between the target and the camera plane.

[0093] In an embodiment, as shown in Figure 9 the pixel edge length calculation subunit 3051 comprises an edge determination module 30511 and a transverse distance determination module 30512.

[0094] The edge determination module 30511 is configured to determine an edge of the target close to an image coordinate system and an edge of the target away from the image coordinate system according to a size relationship of the pixel coordinates of the four corner points of the target; and the transverse distance determination module 30512 is configured to calculate a transverse distance between the edge of the target close to the image coordinate system and the edge of the target away from the image coordinate system to obtain the pixel edge length of the target.

[0095] In an embodiment, as shown in Figure 10 the included angle determination subunit 3052 comprises a vertical distance determination module 30521 and an angle determination module 30522.

[0096] The vertical distance determination module 30521 is configured to calculate a vertical distance of the target from an edge close to the image coordinate system to an edge away from the image coordinate system to obtain a vertical distance.

[0097] The angle determination module 30522 is configured to calculate an angle between the target and the imaging plane of the camera in the vertical direction according to the pixel length of the target and the vertical distance to obtain an angle between the target and the imaging plane of the camera.

[0098] It should be noted that the specific implementation process of the monocular vision measurement target displacement correction device 300 and each unit can be clearly understood by those skilled in the art, and can refer to the corresponding description in the foregoing method embodiments. For the convenience and brevity of description, it will not be repeated here.

[0099] The monocular vision measurement target displacement correction device 300 can be implemented in the form of a computer program, which can run on a computer device as shown in the specification. Figure 11

[0100] Please refer to Figure 11 , Figure 11 is a schematic block diagram of a computer device provided by an embodiment of the present application. The computer device 500 can be a server, wherein the server can be a stand-alone server or a server cluster composed of multiple servers.

[0101] Please refer to Figure 11 , the computer device 500 includes a processor 502, a memory and a network interface 505 connected through a system bus 501, wherein the memory can include a non-volatile storage medium 503 and an internal memory 504.

[0102] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions which, when executed, can cause the processor 502 to perform a monocular vision measurement target displacement correction method.

[0103] The processor 502 is configured to provide computing and control capabilities to support the operation of the entire computer device 500.

[0104] The internal memory 504 provides an environment for the running of the computer program 5032 in the non-volatile storage medium 503, which, when executed by the processor 502, can cause the processor 502 to perform a monocular vision measurement target displacement correction method.

[0105] The network interface 505 is configured to perform network communication with other devices. Those skilled in the art can understand that Figure 11 ​The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device 500 to which the scheme of the present application is applied. Specifically, the computer device 500 can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0106] The processor 502 is configured to run the computer program 5032 stored in the memory to perform the following steps:

[0107] obtaining a target region image; binarizing the target region image to obtain a binary image; extracting a target contour from the binary image to obtain target contour coordinates; calculating pixel coordinates of four corner points of the target according to the target contour coordinates; calculating an angle between the target and a camera plane according to the pixel coordinates of the four corner points of the target; and correcting displacement of the target according to the angle between the target and the camera plane to obtain a correction result.

[0108] In an embodiment, when implementing the step of extracting a target contour from the binary image to obtain target contour coordinates, the processor 502 specifically implements the following steps:

[0109] finding the contour of the target from the binary image using opencv findContours to obtain the target contour coordinates.

[0110] In an embodiment, when implementing the step of calculating an angle between the target and a camera plane according to the pixel coordinates of the four corner points of the target, the processor 502 specifically implements the following steps:

[0111] calculating a pixel edge length of the target according to the pixel coordinates of the four corner points of the target; and calculating the angle between the target and the camera imaging plane in the vertical direction according to the pixel edge length of the target to obtain the angle between the target and the camera plane.

[0112] In an embodiment, when implementing the step of calculating a pixel edge length of the target according to the pixel coordinates of the four corner points of the target, the processor 502 specifically implements the following steps:

[0113] determining the edge of the target close to the image coordinate system and the edge of the target away from the image coordinate system according to the size relationship of the pixel coordinates of the four corner points of the target; and calculating the horizontal distance between the edge of the target close to the image coordinate system and the edge of the target away from the image coordinate system to obtain the pixel edge length of the target.

[0114] In an embodiment, when implementing the step of calculating the angle between the target and the camera imaging plane in the vertical direction according to the pixel edge length of the target to obtain the angle between the target and the camera plane, the processor 502 specifically implements the following steps:

[0115] The vertical distance of the target close to the image coordinate system and the vertical distance of the target away from the image coordinate system are calculated to obtain a vertical distance; and the angle between the target and the imaging plane of the camera in the vertical direction is calculated according to the pixel length of the target and the vertical distance, to obtain the angle between the target and the imaging plane of the camera.

[0116] It should be understood that, in the embodiments of the present application, the processor 502 can be a central processing unit (CPU), and the processor 502 can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0117] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the above-mentioned embodiments.

[0118] Therefore, the present application also provides a storage medium. The storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program is executed by a processor to make the processor execute the following steps:

[0119] An image of a target region is obtained; the image of the target region is binarized to obtain a binarized image; a target contour is extracted from the binarized image to obtain target contour coordinates; pixel coordinates of four corner points of the target are calculated according to the target contour coordinates; an angle between the target and the imaging plane of the camera is calculated according to the pixel coordinates of the four corner points of the target; and a displacement of the target is corrected according to the angle between the target and the imaging plane of the camera to obtain a correction result.

[0120] In an embodiment, when the processor executes the computer program to implement the step of extracting the target contour from the binarized image to obtain the target contour coordinates, the following steps are implemented:

[0121] The contour of the target is found from the binarized image by using opencv findContours to obtain the target contour coordinates.

[0122] In an embodiment, when the processor implements the step of calculating the angle between the target and the camera plane according to the pixel coordinates of the four corners of the target while executing the computer program, the processor implements the following steps:

[0123] calculating the pixel length of the target according to the pixel coordinates of the four corners of the target; and calculating the angle between the target and the camera plane according to the pixel length of the target and the vertical distance.

[0124] In an embodiment, when the processor implements the step of calculating the pixel length of the target according to the pixel coordinates of the four corners of the target while executing the computer program, the processor implements the following steps:

[0125] determining the side of the target close to the image coordinate system and the side of the target far from the image coordinate system according to the size relationship of the pixel coordinates of the four corners of the target; and calculating the horizontal distance between the side of the target close to the image coordinate system and the side of the target far from the image coordinate system to obtain the pixel length of the target.

[0126] In an embodiment, when the processor implements the step of calculating the angle between the target and the camera plane according to the pixel length of the target and the vertical distance while executing the computer program, the processor implements the following steps:

[0127] calculating the vertical distance between the side of the target close to the image coordinate system and the side of the target far from the image coordinate system to obtain the vertical distance; and calculating the angle between the target and the camera plane according to the pixel length of the target and the vertical distance.

[0128] The storage medium can be a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and various computer readable storage media that can store program codes.

[0129] Those skilled in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in general terms in the above description. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0130] In several embodiments provided by the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the embodiments of the apparatus described above are merely schematic. For example, the division of the units is merely a logical function division. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In this way, the inventive idea can be implemented.

[0131] The steps in the method embodiments of the present application can be adjusted, combined and deleted in sequence according to actual needs. The units in the apparatus embodiments of the present application can be combined, divided and deleted according to actual needs. In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0132] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art, or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application.

[0133] The above describes only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed by the present application, and these modifications or replacements should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for correcting target displacement using monocular vision measurement, characterized in that: include: Acquiring an image of the target area; Binarizing the target area image to obtain a binary image; Extracting a target contour from the binary image to obtain target contour coordinates; Calculating the pixel coordinates of the four corner points of the target according to the target outline coordinates; Calculate the angle between the target and the camera plane based on the pixel coordinates of the four corner points of the target; Correcting the displacement of the target according to the angle between the target and the camera plane to obtain a correction result; The calculation of the angle between the target and the camera plane according to the pixel coordinates of the four corner points of the target includes: Calculate the pixel side length of the target based on the pixel coordinates of the four corner points of the target; The included angle between the target and the camera imaging plane in the vertical direction is calculated based on the pixel side length of the target to obtain the included angle between the target and the camera plane; Calculating the pixel side length of the target based on the pixel coordinates of the four corner points of the target includes: Determine the edge of the target close to the image coordinate system and the edge far away from the image coordinate system based on the size relationship of the pixel coordinates of the four corner points of the target; Calculate the lateral distance between the edge of the target close to the image coordinate system and the edge far from the image coordinate system to obtain the pixel side length of the target; Calculating the vertical angle between the target and the camera imaging plane according to the pixel side length of the target to obtain the angle between the target and the camera plane includes: Calculate the vertical distance between the edge of the target close to the image coordinate system and the edge far from the image coordinate system to obtain the vertical distance; The included angle between the target and the camera imaging plane in the vertical direction is calculated according to the pixel side length and the vertical distance of the target to obtain the included angle between the target and the camera plane.

2. The method for correcting target displacement by monocular vision measurement according to claim 1, characterized in that: Extracting the target contour from the binary image to obtain target contour coordinates includes: The target contour is found on the binary image using opencv findContours to obtain the target contour coordinates.

3. Monocular vision measurement target displacement correction device, characterized in that: include: An image acquisition unit, used for acquiring an image of a target area; A binarization unit, configured to binarize the target area image to obtain a binarized image; an extraction unit, configured to extract a target contour from the binary image to obtain target contour coordinates; A coordinate calculation unit, configured to calculate the pixel coordinates of the four corner points of the target based on the target outline coordinates; An angle calculation unit, used to calculate the angle between the target and the camera plane based on the pixel coordinates of the four corner points of the target; A correction unit, used to correct the displacement of the target according to the angle between the target and the camera plane to obtain a correction result; The angle calculation unit includes: A pixel side length calculation subunit, used to calculate the pixel side length of the target based on the pixel coordinates of the four corner points of the target; An angle determination subunit, used to calculate the vertical angle between the target and the camera imaging plane based on the pixel side length of the target, so as to obtain the angle between the target and the camera plane; The pixel side length calculation subunit includes: An edge determination module is used to determine the edge of the target close to the image coordinate system and the edge away from the image coordinate system based on the size relationship of the pixel coordinates of the four corner points of the target; A lateral distance determination module is used to calculate the lateral distance between the edge of the target close to the image coordinate system and the edge far from the image coordinate system to obtain the pixel side length of the target; The angle determination subunit includes: A vertical distance determination module is used to calculate the vertical distance between the edge of the target close to the image coordinate system and the edge far from the image coordinate system to obtain the vertical distance; The angle determination module is used to calculate the vertical angle between the target and the camera imaging plane according to the pixel side length and vertical distance of the target to obtain the angle between the target and the camera plane.

4. The monocular vision measurement target displacement correction device according to claim 3, characterized in that: The extraction unit is used to use opencv findContours to search for the target contour on the binary image to obtain the target contour coordinates.

5. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 2 when executing the computer program.

6. A storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 2 can be implemented.

Citation Information

Patent Citations

  • Target correction method and system

    CN102376089A

  • Calibration method for 3D structured light system, and electronic device and storage medium

    WO2022052313A1