Ranging method, device, equipment and medium
Through the correspondence between the target recognition and the amplification ratio of the field of view angle of the image acquisition device, the distance between the target and the device is calculated, and the problems of low distance measurement accuracy of the ultra-wide-angle lens and narrow field of view of the TOF module are solved, and the accurate distance measurement and the Hardware simplification.
Patent Information
- Application Number
- CN202410970326.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-12-24
AI Technical Summary
When existing binocular gimbal cameras use ultra-wide-angle lenses in video conferencing, the distance measurement accuracy is low and the field of view of the TOF module is narrow cannot meet the distance measurement requirements of large field-angle scenes.
The acquired image is acquired through the image acquisition device, the target is recognized and the coordinates of the target image are determined. Combined with the correspondence between the field of view angle and the magnification ratio of the target, the distance between the target and the image acquisition device is calculated to achieve accurate distance measurement.
It realizes accurate ranging from a large field of view based on ultra-wide-angle lenses, avoids the narrow field of view of the TOF module, simplifies hardware design, and reduces the cost of the whole machine.
Smart Images

Figure CN119179068A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and in particular to a distance measurement method, device, equipment and medium. Background Art
[0002] Ultra-wide-angle lenses are widely used in surveillance imaging due to their large field of view, especially in the field of video conferencing imaging, and are widely used in binocular PTZ cameras. Conventional binocular PTZ cameras measure distance using a Time-of-Flight (ToF) module or other distance measurement modules, and feed the distance back to the system, which calculates the required zoom ratio of the zoom lens, thereby achieving rapid zooming of the zoom lens. Summary of the invention
[0003] The embodiments of the present application provide a distance measurement method, apparatus, device and medium for realizing accurate distance measurement between a target and an image acquisition device based on an image acquisition device and a target image acquired by the image acquisition device.
[0004] A distance measurement method provided in an embodiment of the present application includes:
[0005] Acquire a captured image through an image acquisition device, and determine a target image in the captured image by performing target recognition on the captured image;
[0006] Determine the coordinates of the target image, and based on the coordinates of the target image, determine the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device;
[0007] The distance between the target and the image acquisition device is determined according to the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target.
[0008] The method described in the embodiment of the present application acquires a captured image through an image acquisition device, and performs target recognition on the captured image, so as to determine the target image in the captured image, and further determine the coordinates of the target image, and then determine the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device based on the coordinates of the target image; thus, according to the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target, the distance between the target and the image acquisition device is determined, thereby realizing more accurate distance measurement between the target and the image acquisition device based on the image acquisition device and the target image acquired by the image acquisition device, especially accurate distance measurement in a large field of view can be performed through image acquisition devices such as ultra-wide-angle lenses, thereby avoiding the problem of narrow field of view of TOF camera ranging.
[0009] In some embodiments, according to the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target, determining the distance between the target and the image acquisition device includes:
[0010] The distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device is used as the imaging size of the preset position on the target image in the preset direction, and the field of view angle corresponding to the image size of the target image in the preset direction is determined according to the imaging size and the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in the preset direction;
[0011] Determine the magnification ratio of the target on the target image according to the field of view angle corresponding to the image size of the target image in a preset direction and the correspondence between the field of view angle and the magnification ratio of the target determined in advance for the image acquisition device;
[0012] The distance between the target and the image acquisition device is determined according to the magnification ratio of the target on the target image.
[0013] In some embodiments, determining the distance between the target and the image acquisition device according to the magnification ratio of the target on the target image includes:
[0014] The distance between the target and the image acquisition device is determined according to the magnification ratio of the target on the target image, the preset actual size of the target in the preset direction, the focal length of the lens of the image acquisition device, and the size of the target image in the preset direction.
[0015] In some embodiments, the size of the target image in the preset direction is determined based on the number of pixels of the circumscribed rectangular frame of the target image in the vertical direction and the size of each pixel.
[0016] In some embodiments, determining the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device based on the coordinates of the target image includes:
[0017] Based on the coordinates of the center point of the target image and the size of each pixel, the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device is determined.
[0018] In some embodiments, the correspondence between the field of view angle and the image size in the preset direction is predetermined in the following manner:
[0019] Controlling the rotating platform to drive the image acquisition device to rotate horizontally toward the left from an initial angle until the black block of the test card is completely removed from the imaging screen of the image acquisition device; wherein the image acquisition device is pre-set on the rotating platform, and the lens of the image acquisition device is located at the center of the rotating platform; during the rotation of the rotating platform, the distance between the lens center of the image acquisition device and the test card remains unchanged; and the center height of the black block on the test card is consistent with the height of the lens center of the image acquisition device;
[0020] Controlling the rotating platform to rotate from left to right until the black block of the test card is completely removed from the imaging picture of the image acquisition device;
[0021] Wherein, during the rotation of the rotating platform, multiple sets of data are recorded, each set of data including a rotation angle and a horizontal moving distance of the center of the black block in the imaging picture corresponding to the rotation angle;
[0022] Based on the multiple sets of data, the corresponding relationship between the field of view angle of the image acquisition device and the image size in the vertical direction is determined.
[0023] In some embodiments, the correspondence between the field of view angle and the magnification ratio of the target is predetermined in the following manner:
[0024] Controlling the rotating platform to drive the image acquisition device to rotate horizontally toward the left from an initial angle until the black block of the test card is completely removed from the imaging screen of the image acquisition device; wherein the image acquisition device is pre-set on the rotating platform, and the lens of the image acquisition device is located at the center of the rotating platform; during the rotation of the rotating platform, the distance between the lens center of the image acquisition device and the test card remains unchanged; and the center height of the black block on the test card is consistent with the height of the lens center of the image acquisition device;
[0025] Controlling the rotating platform to rotate from left to right until the black block of the test card is completely removed from the imaging picture of the image acquisition device;
[0026] Wherein, when the rotating platform is at an initial angle, the number of pixels occupied by the black block in the imaging picture corresponding to the initial angle is recorded; and during the rotation of the rotating platform, multiple groups of data are recorded, each group of data including the rotation angle and the number of pixels occupied by the black block in the imaging picture corresponding to the rotation angle;
[0027] Based on the multiple sets of data and the number of pixels occupied by the black block in the imaging picture corresponding to the initial angle, determine the magnification ratio of the black block by the image acquisition device at different field of view angles;
[0028] Based on the magnification ratio of the black block at different field angles of view of the image acquisition device, the corresponding relationship between the field angle of view of the image acquisition device and the magnification ratio of the target is determined.
[0029] An embodiment of the present application provides a distance measuring device, including:
[0030] The first unit is used to acquire a captured image through an image acquisition device, and determine a target image in the captured image by performing target recognition on the captured image;
[0031] The second unit is used to determine the coordinates of the target image, and based on the coordinates of the target image, determine the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device;
[0032] The third unit is used to determine the distance between the target and the image acquisition device based on the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target.
[0033] Another embodiment of the present application provides an electronic device, which includes a memory and a processor, wherein the memory is used to store program instructions, and the processor is used to call the program instructions stored in the memory and execute any of the above methods according to the obtained program.
[0034] Another embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable the computer to execute any of the above methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 A schematic diagram of the overall flow of a distance measurement method provided in an embodiment of the present application;
[0037] Figure 2 A schematic diagram of a tooling architecture for calibrating the correspondence between the field of view angle and the image height, and the correspondence between the field of view angle and the magnification ratio of the target provided in an embodiment of the present application;
[0038] Figure 3 A schematic diagram of a tooling architecture for calibrating the correspondence between the field of view angle and the image height, and the correspondence between the field of view angle and the magnification ratio of the target provided in an embodiment of the present application;
[0039] Figure 4 A schematic diagram of an imaging process in the process of calibrating the corresponding relationship between the field of view angle and the image height, and the corresponding relationship between the field of view angle and the magnification ratio of the target provided in an embodiment of the present application;
[0040] Figure 5 A schematic diagram of a curve showing the corresponding relationship between the field of view angle and the magnification ratio of the target provided in an embodiment of the present application;
[0041] Figure 6 A schematic diagram of a curve showing the corresponding relationship between the field of view angle and the image height provided in an embodiment of the present application;
[0042] Figure 7 A schematic diagram of the lens imaging principle provided in an embodiment of the present application;
[0043] Figure 8 Determine h provided in the embodiment of the present application 像中心像高 Schematic diagram of the principle;
[0044] Fig. 9 A schematic diagram of the coordinates of a human head frame provided in an embodiment of the present application;
[0045] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0046] Fig.11 A schematic diagram of the structure of a distance measuring device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] The embodiments of the present application provide a distance measurement method, apparatus, device and medium for realizing distance measurement between a target and an image acquisition device based on an image acquisition device and a target image acquired by the image acquisition device.
[0049] Among them, the method and the device, equipment, and medium are based on the same application concept. Since the principles of solving problems by the method and the device, equipment, and medium are similar, the implementation of the device, equipment, medium, and method can refer to each other, and the repeated parts will not be repeated.
[0050] The terms "first", "second", etc. (if any) in the specification and claims of the embodiments of the present application and the above-mentioned drawings 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 interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than the content illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0051] The following examples and embodiments are to be understood as illustrative examples only. Although this specification may refer to "one", "an" or "some" examples or embodiments in several places, this does not mean that each such reference relates to the same example or embodiment, nor does it mean that the feature applies only to a single example or embodiment. Individual features of different embodiments may also be combined to provide other embodiments. In addition, terms such as "including" and "comprising" should be understood as not limiting the described embodiments to only those features that have been mentioned; such examples and embodiments may also include features, structures, units, modules, etc. that are not specifically mentioned.
[0052] The following is a detailed description of each embodiment of the present application in conjunction with the accompanying drawings. It should be noted that the display order of the embodiments of the present application only represents the order of the embodiments, and does not represent the advantages and disadvantages of the technical solutions provided by the embodiments.
[0053] In binocular PTZ cameras, a combination of fixed focus + zoom + PTZ + TOF modules is usually used. Among them, the Time-of-Flight (ToF) module can analyze the distance between the camera and the subject by measuring the round-trip time of artificial light signals provided by lasers, etc. The zoom lens is used to see details, and the PTZ requires it to quickly turn to the target and quickly zoom to a certain magnification so that the target details can be clearly seen. In order to achieve its fast zoom effect, it is usually equipped with a ranging module, such as a Time-of-Flight (ToF) ranging module. However, ranging modules such as TOF have a narrow ranging angle and are relatively expensive. The fixed-focus imaging module is used for panoramic camera output. The first requirement is to see a wide range, so a wide-angle or ultra-wide-angle or even fisheye lens is usually used. However, when using this type of ultra-wide-angle lens, the magnification ratio of the lens to the target object will be different in different fields of view. Therefore, in actual applications, ultra-wide-angle lenses will only be used for large-scene monitoring to avoid blind spots, or to locate the monitoring target position, and cooperate with the zoom lens to quickly rotate to this position for monitoring, and ultra-wide-angle lenses will not be used for ranging.
[0054] In summary, ultra-wide-angle lenses are widely used in video conferencing cameras, but the lens distortion is large, resulting in low ranging accuracy. And ranging modules such as TOF have a narrow field of view and cannot meet the ranging needs of scenes with a large field of view.
[0055] Therefore, the technical solution provided in the embodiment of the present application measures the target magnification ratio of the imaging module of the image acquisition device at different field angles of view by measuring the lens distortion fixture, and then fits the corresponding relationship curve between the field angle and the target magnification ratio at different field angles based on this. In addition, by measuring the lens distortion fixture, the relationship between different image heights and field angles is tested, and then the corresponding relationship curve between the field angle and the image height is fitted based on this. Therefore, in practical applications, the distance between the target and the image acquisition device can be accurately measured by detecting the target of the captured image based on the pre-set corresponding relationship between the field angle and the target magnification ratio, and the corresponding relationship between the field angle and the image height.
[0056] See also Figure 1 , a ranging method provided in an embodiment of the present application includes:
[0057] S101, acquiring a captured image through an image acquisition device, and determining a target image in the captured image by performing target recognition on the captured image;
[0058] In some embodiments, the image acquisition device is, for example, a camera equipped with an ultra-wide-angle lens.
[0059] In some embodiments, the target may be, for example, a human face or other target objects, depending on actual needs.
[0060] S102, determining the coordinates of the target image, and based on the coordinates of the target image, determining the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device;
[0061] In some embodiments, the coordinates of the target image may be, for example, the center coordinates (Nx, Ny) of a rectangular frame circumscribing a human head (human head frame) in the captured image.
[0062] In some embodiments, the photoelectric conversion board of the image acquisition device may be, for example, a sensor board. The sensor board is used to receive the optical signal transmitted by the lens, convert the optical signal into an electrical signal, and then process it through the output encoding board to restore it to a real-time image on the computer. In some embodiments, the sensor is, for example, a charge coupled device (CCD).
[0063] S103, determining the distance between the target and the image acquisition device according to the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target.
[0064] In some embodiments, the preset direction is, for example, a vertical direction; the image size in the preset direction is, for example, an image height h.
[0065] In some embodiments, according to the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target, determining the distance between the target and the image acquisition device includes:
[0066] The distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device is used as the imaging size of a preset position (e.g., the center point position) on the target image in the preset direction (e.g., the vertical direction), and the field of view angle corresponding to the image size of the target image in the preset direction is determined according to the imaging size and the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in the preset direction;
[0067] Determine the magnification ratio of the target on the target image according to the field of view angle corresponding to the image size of the target image in a preset direction and the correspondence between the field of view angle and the magnification ratio of the target determined in advance for the image acquisition device;
[0068] The distance between the target and the image acquisition device is determined according to the magnification ratio of the target on the target image.
[0069] In some embodiments, the image size of the preset position on the target image in the preset direction, such as the image height h of the center point of the human head frame 像中心像高 .
[0070] In some embodiments, determining the distance between the target and the image acquisition device according to the magnification ratio of the target on the target image includes:
[0071] The distance between the target and the image acquisition device is determined according to the magnification ratio of the target on the target image, the preset actual size of the target in the preset direction, the focal length of the lens of the image acquisition device, and the size of the target image in the preset direction.
[0072] In some embodiments, the actual size of the target in the preset direction is preset, for example, the actual height of a person's head is preset to 20 cm.
[0073] In some embodiments, the size of the target image in the preset direction is, for example, the imaging height h of a person's head.
[0074] In some embodiments, the size of the target image in the preset direction is determined based on the number of pixels of the circumscribed rectangular frame of the target image in the vertical direction and the size of each pixel.
[0075] For example: Image height h = N 垂直 *D 像元 ;
[0076] Among them, N 垂直 Indicates the number of pixels in the vertical direction of the bounding rectangle of the target image, for example, the number of pixels in the vertical direction of the sensor image of a human head through the lens;
[0077] D 像元 Indicates the size of each pixel. The above pixel is also called sensor pixel, which is square in shape. The effective imaging photosensitive area of the sensor is composed of small square sensor pixels. For example, if the sensor is composed of 3840*2160=8294400 pixels, the sensor is also called an 8-megapixel sensor.
[0078] In some embodiments, determining the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device based on the coordinates of the target image includes:
[0079] Based on the coordinates of the center point of the target image and the size of each pixel, the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device is determined.
[0080] For example: For example, take the center point of the human head frame as the coordinate of the human head frame. Assume that the coordinate of the center point is (N x , N y ), then:
[0081]
[0082] Among them, h 像中心像高 Indicates the distance between the center point of the target image and the center point of the photoelectric conversion plate of the image acquisition device.
[0083] In some embodiments, the correspondence between the field of view angle and the image size in the preset direction is predetermined in the following manner:
[0084] Controlling the rotating platform to drive the image acquisition device to rotate horizontally toward the left from an initial angle until the black block of the test card is completely removed from the imaging screen of the image acquisition device; wherein the image acquisition device is pre-set on the rotating platform, and the lens of the image acquisition device is located at the center of the rotating platform; during the rotation of the rotating platform, the distance between the lens center of the image acquisition device and the test card remains unchanged; and the center height of the black block on the test card is consistent with the height of the lens center of the image acquisition device;
[0085] Controlling the rotating platform to rotate from left to right until the black block of the test card is completely removed from the imaging picture of the image acquisition device;
[0086] Wherein, during the rotation of the rotating platform, multiple sets of data are recorded, each set of data including a rotation angle and a horizontal moving distance of the center of the black block in the imaging picture corresponding to the rotation angle;
[0087] Based on the multiple sets of data, the corresponding relationship between the field of view angle of the image acquisition device and the image size in the vertical direction is determined.
[0088] Wherein, the recording of multiple sets of data, for example, every time the rotating platform rotates 1°, the current rotation angle θ of the rotating platform is recorded, and the number of pixels N that the center point of the black block on the image moves in the horizontal direction is read, and based on this, the moving distance of the center point of the black block on the image at this time is calculated as N*D 像元 Among them, N*D 像元 That is, image height h, and θ is the field angle.
[0089] The corresponding relationship between the field of view angle of the image acquisition device and the image size in the vertical direction is, for example:
[0090] θ (h) =0.6205h 3 -7.8144h 2 +39.009h-0.4429.
[0091] In some embodiments, the correspondence between the field of view angle and the magnification ratio of the target is predetermined in the following manner:
[0092] Controlling the rotating platform to drive the image acquisition device to rotate horizontally toward the left from an initial angle until the black block of the test card is completely removed from the imaging screen of the image acquisition device; wherein the image acquisition device is pre-set on the rotating platform, and the lens of the image acquisition device is located at the center of the rotating platform; during the rotation of the rotating platform, the distance between the lens center of the image acquisition device and the test card remains unchanged; and the center height of the black block on the test card is consistent with the height of the lens center of the image acquisition device;
[0093] Controlling the rotating platform to rotate from left to right until the black block of the test card is completely removed from the imaging picture of the image acquisition device;
[0094] Wherein, when the rotating platform is at an initial angle, the number of pixels occupied by the black block in the imaging picture corresponding to the initial angle is recorded; and during the rotation of the rotating platform, multiple groups of data are recorded, each group of data including the rotation angle and the number of pixels occupied by the black block in the imaging picture corresponding to the rotation angle;
[0095] Based on the multiple sets of data and the number of pixels occupied by the black block in the imaging picture corresponding to the initial angle, determine the magnification ratio of the black block by the image acquisition device at different field of view angles;
[0096] Based on the magnification ratio of the black block at different field angles of view of the image acquisition device, the corresponding relationship between the field angle of view of the image acquisition device and the magnification ratio of the target is determined.
[0097] For example:
[0098] The number of pixels occupied by the black block in the imaging picture corresponding to the rotation angle is expressed as: N (θ) ;
[0099] The number of pixels occupied by the black block in the imaging picture corresponding to the initial angle is expressed as: n;
[0100] Then the magnification ratio of the black block by the image acquisition device at different field angles is:
[0101] K (θ) =N (θ) / n;
[0102] The corresponding relationship between the field of view angle of the image acquisition device and the magnification ratio of the target is, for example:
[0103] K (θ) =0.0002θ 2 -0.0058θ+1.0871.
[0104] The following is a further detailed example.
[0105] In the embodiment of the present application, the steps of presetting the correspondence between the field of view of the image acquisition device and the magnification ratio of the target, and the correspondence between the field of view of the image acquisition device and the image size in the vertical direction are as follows:
[0106] Step 1: Calibrate the tooling.
[0107] The tooling hardware provided in the embodiment of the present application is composed of: Figure 2 As shown, it includes: wide-angle lens module (i.e. image acquisition device), rotating pan / tilt and test card. Of course, it also includes Figure 2 A computer device not shown in the figure is connected to the image acquisition device and the pan-tilt head to acquire data and send control signals.
[0108] The pan-tilt head can fix the wide-angle lens module, and the lens is fixed at the rotation center of the pan-tilt head, and can ensure that the distance between the lens center and the test card remains unchanged during the pan-tilt head rotation process. The rotation angle of the pan-tilt head can be precisely controlled, and the maximum rotation angle can reach 180°, for example.
[0109] In some embodiments, a square black block mark is set at the center of the test card as a target for image acquisition. Of course, the target on the test card can also be marks of other shapes, colors, etc.
[0110] In some embodiments, Figure 3 As shown, the test card is placed 2m away from the lens module. The center height of the black block on the test card is consistent with the center height of the lens.
[0111] Step 2: f-θ distortion relationship calibration, that is, determining the corresponding relationship curve between the different field of view angles of the lens and the magnification ratio.
[0112] During the calibration process, the pan / tilt head is at the initial position θ, where θ = 0°, and the lens faces the center of the black block on the test card.
[0113] Turn on the gimbal drive control, control the pan-tilt head to rotate at 1° / step (depending on the pan-tilt head rotation control accuracy), first rotate horizontally to the left, then rotate from left to right. During the entire rotation process of the pan-tilt head, the position of the black block image of the test card in the picture changes as follows: Figure 4 As shown in ①→⑩. Among them:
[0114] First, control the pan / tilt head to rotate horizontally to the left until the black block of the test card is completely removed from the image capture device. Figure 4 In the change process from ① to ④, the black rectangular frame is the imaging field of view, and the black block is the image of the black block on the test card on the lens module;
[0115] Then control the pan / tilt head to rotate from left to right until the black block of the test card is completely removed from the image acquisition device. Figure 4 The change process of ⑤→⑩ in .
[0116] Among them, the ultra-wide-angle lens and the sensor board are screwed together to form a wide-angle lens module, which is called the lens module to be tested, that is, the image acquisition device to be tested. After the image acquisition device is powered on, the real-time image of the lens to be tested can be seen on the computer, and the test card can be imaged in the picture. When the pan-tilt head is in the initial position θ=0, the computer can read the number of pixels occupied by the black block in the picture as n. During the rotation of the pan-tilt head, the rotation angle θ and the number of pixels occupied by the black block of the test card in the picture are recorded at the same time as N (θ) After the rotation is completed, the rotation angle θ and the number of pixels N occupied by the black block of the test card in the picture can be obtained. (θ) The corresponding data between .
[0117] The magnification ratio of the black block at different field angles in the lens is K (θ) =N (θ) / n. Then, according to the data fitting, the relationship between K and θ can be obtained, that is, the corresponding relationship curve between the field of view angle and the magnification ratio under different field of view angles can be fitted. Figure 5 As shown, Figure 5 The horizontal axis is the field of view angle, in degrees, and the vertical axis is the magnification ratio. Specifically, for example: K (θ) =0.0002θ 2 -0.0058θ+1.0871. Thus, the different field of view magnification ratios brought by the f-θ distortion of the lens are measured, and this step completes the calibration. Among them, the field of view refers to different positions in the imaging picture. The center of the picture is called the 0 field of view, and the edge field of view is defined as 1 field of view, also called the edge field of view. From the center to the edge, it is divided into 0.1 field of view, 0.2 field of view, 0.3 field of view...0.9 field of view according to different positions.
[0118] Step 3: Calibration of the relationship between field of view angle and image height, that is, determining the corresponding relationship curve between different field of view angles and image heights of the lens.
[0119] During the calibration process, the rotating platform is in the initial position θ, where θ = 0°, and the lens is facing the center of the black block on the test card. The center of the black block is in the center of the lens imaging screen (i.e. the center of the sensor board). Turn on the gimbal drive control and control the rotation of the gimbal at 1° / step (depending on the gimbal rotation control accuracy). First rotate horizontally to the left until the black block of the test card is completely removed from the imaging screen. Figure 4 Then rotate from left to right until the black block of the test card is completely removed from the imaging screen. Figure 4In the process of ⑤→⑩. During the rotation of the gimbal, every time it rotates 1°, the rotation angle θ is recorded, and the number of pixels N that the center of the black block moves horizontally is read. The moving distance is N*D 像元 , that is, the image height h is obtained. After the rotation is completed, the corresponding data between the rotation angle θ and the image height h can be obtained, where the image height refers to the actual physical size from the center point of the lens imaging to the center point of the black block. Since the sensor center point coincides with the lens imaging center point, the target image height on the sensor refers to the actual physical size from the center point of the sensor pixel arrangement (i.e. the sensor center point) to other positions of the sensor (i.e. the center point of the target image).
[0120] The corresponding relationship curve between the rotation angle θ and the image height h is as follows: Figure 6 As shown, Figure 6 The horizontal axis is the field angle (i.e., the rotation angle θ), unit / °, and the vertical axis is the image height h, unit / mm.
[0121] Specifically, for example:
[0122] θ (h) =0.6205h 3 -7.8144h 2 +39.009h-0.4429.
[0123] Then, according to the data fitting, the corresponding relationship between the image height h and the field angle θ can be obtained. At this point, the corresponding relationship curve between the field angle θ and the image height h of the lens is calibrated.
[0124] It should be noted that the execution order of the above step 2 and step 3 can be interchanged or performed simultaneously.
[0125] Then, after completing the above calibration, the actual ranging process, the ranging method provided in the embodiment of the present application is as follows:
[0126] See also Figure 7 , assuming:
[0127] The distance between the object to be measured and the lens is L;
[0128] The actual focal length of the lens is f;
[0129] The number of pixels that the target occupies in the vertical direction of the image formed by the lens sensor is N. 垂直 ;
[0130] The fixed-focus imaging module sensor pixel size is D 像元 ;
[0131] Fixed-focus imaging module lens magnification ratio coefficient K (θ) =f(θ);
[0132] The actual height of the target is H, for example, the height of a person's head is pre-marked as 20 cm;
[0133] The corresponding relationship between the field angle θ and the image height h of a fixed-focus lens is θ (h) =f(h).
[0134] Then, combined Figure 7 , we can get:
[0135]
[0136] L= K (θ) *H*f / h Formula (2)
[0137] L= K (θ) *H*f / (N 垂直 *D 像元 ) Formula (3)
[0138] In the actual measurement application process, in the wide-angle fixed-focus module imaging screen, the coordinate system is established with the center point of the screen (sensor center). When the portrait appears in the center of the screen, the head of the person can be automatically framed. The number of pixels occupied by the height of the head frame is N. 垂直。
[0139] For further details, see Figure 8 , take the center point of the head frame as the coordinate of the head frame, assuming that the coordinate of the center point is (N x , N y ), the center point is the same as the center point of the sensor board ( Figure 8 The distance from the center point O) is the image height h of the image center point 像中心像高 , specifically:
[0140]
[0141] h 像中心像高 Substitute the fitted fixed-focus lens field angle θ and image height h into the relationship θ (h) =f(h), we can calculate the position of the portrait in the field of view, that is, h 像中心像高 The corresponding field of view angle θ, then, continue to h 像中心像高 The corresponding field of view angle θ is brought into the fitting formula K of the magnification ratio under different fields of view in the lens (θ) =f(θ), we can get the magnification ratio K of the portrait at the position of the field of view. (θ) Finally, the magnification ratio K of the portrait at the position of the field of view is (θ) By substituting into the above formula (3), the distance L between the face and the imaging module can be calculated to achieve distance measurement.
[0142] A specific example is given below.
[0143] For example, the actual focal length of the wide-angle lens is f=1.64mm, the sensor pixel arrangement is 3840*2160, the total number of pixels is 8294400, and the size of each positive pixel is 1.45 microns.
[0144] The magnification ratio K value at a series of different angles θ measured by the tooling is obtained by data fitting, and the relationship K between K and θ is obtained. (θ) =f(θ) is as follows:
[0145] K (θ) = 0.0002θ 2 -0.00584θ + 1.0371 Formula (4)
[0146] The image height h values at a series of different angles θ are measured by the tooling, and the relationship θ between θ and h is obtained by data fitting. (h) =f(h) is as follows:
[0147] θ (h) = 0.6205h 3 - 7.8144h 2 + 39.009h - 0.4429 formula (5)
[0148] Wherein, h is in mm.
[0149] Then, in practical applications, the ranging process includes:
[0150] Step 1: When a person appears in the image, the target detection technology can be used to identify and frame the person's head, obtain the person's head frame (i.e., the circumscribed rectangular frame of the person's head), and directly read the coordinates of the center position of the person's head frame as (N x , N y ), assuming N x =1000,N y =400.
[0151] According to the coordinate system established by the sensor center, the interval between the horizontal and vertical coordinates in the coordinate system is 1 pixel. The actual physical size corresponding to each pixel is D 像元 =1.45 microns.
[0152] See also Fig. 9 , assuming that the coordinates of the upper center point of the head frame are (1000,600) and the coordinates of the lower center point are (1000,200), then the number of pixels occupied by the height of the head frame is N 垂直 It is 600-200=400.
[0153] The distance h between the center of the head frame and the center of the sensor (corresponding to the image height) is:
[0154]
[0155] Step 2: Substitute h=1.562 into the above formula (5) and calculate:
[0156] θ (h) =0.6205h 3 -7.8144h 2 +39.009h-0.4429=43.78°.
[0157] Step 3: Set θ (h) =43.78° is substituted into the above formula (4). Calculated:
[0158] K (θ) =K (43.78) =0.0002θ 2 -0.00584θ+1.0371=1.22.
[0159] Step 4: K (θ) =K (43.78) =1.22, and substitute it into the above formula 3. Calculate:
[0160] L=K (θ) *H*f / (N 垂直 *D 像元 )=1.22*0.2*0.00164 / (400*0.00000145)=0.69m;
[0161] Where, H = 20cm = 0.2m;
[0162] f = 1.64 mm = 0.00164 m;
[0163] N 垂直 =400;
[0164] D 像元 =1.45μm=0.00000145m.
[0165] At this point, it can be concluded that Fig. 9 The distance between the face and the camera lens is 0.69m. As the person moves, the face is in different positions in the picture, etc., the method provided in the above embodiment of the present application can accurately calculate the actual distance between the face and the camera lens. Subsequently, the gimbal camera can also magnify and track the details of the face based on the actual distance and angle between the face and the camera lens.
[0166] In summary, the embodiments of the present application can be applied to the distance measurement of binocular PTZ video conferencing cameras, and can accurately measure the distance in a large field of view through an ultra-wide-angle lens, solving the problem of narrow field of view of the TOF module. In addition, the use of ultra-wide-angle lenses for distance measurement can remove distance measurement modules such as TOF, simplify the structure and hardware design, and is beneficial to the ID design of the whole machine. The same ultra-wide-angle lens only needs to be calibrated and measured, and there is no need to calibrate each TOF distance measurement module during production.
[0167] The following is an introduction to the equipment or device provided in the embodiments of the present application, in which the explanations or examples of technical features that are the same or corresponding to those described in the above method will not be repeated later.
[0168] An electronic device provided in an embodiment of the present application may be, for example, any image acquisition device. Fig.10 , the electronic device includes, for example:
[0169] The processor 600 is used to read the program in the memory 620 and execute the following process:
[0170] Acquire a captured image through an image acquisition device, and determine a target image in the captured image by performing target recognition on the captured image;
[0171] Determine the coordinates of the target image, and based on the coordinates of the target image, determine the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device;
[0172] The distance between the target and the image acquisition device is determined according to the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target.
[0173] In some embodiments, according to the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target, determining the distance between the target and the image acquisition device includes:
[0174] The distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device is used as the imaging size of the preset position on the target image in the preset direction, and the field of view angle corresponding to the image size of the target image in the preset direction is determined according to the imaging size and the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in the preset direction;
[0175] Determine the magnification ratio of the target on the target image according to the field of view angle corresponding to the image size of the target image in a preset direction and the correspondence between the field of view angle and the magnification ratio of the target determined in advance for the image acquisition device;
[0176] The distance between the target and the image acquisition device is determined according to the magnification ratio of the target on the target image.
[0177] In some embodiments, determining the distance between the target and the image acquisition device according to the magnification ratio of the target on the target image includes:
[0178] The distance between the target and the image acquisition device is determined according to the magnification ratio of the target on the target image, the preset actual size of the target in the preset direction, the focal length of the lens of the image acquisition device, and the size of the target image in the preset direction.
[0179] In some embodiments, the size of the target image in the preset direction is determined based on the number of pixels of the circumscribed rectangular frame of the target image in the vertical direction and the size of each pixel.
[0180] In some embodiments, determining the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device based on the coordinates of the target image includes:
[0181] Based on the coordinates of the center point of the target image and the size of each pixel, the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device is determined.
[0182] In some embodiments, the correspondence between the field of view angle and the image size in the preset direction is predetermined in the following manner:
[0183] Controlling the rotating platform to drive the image acquisition device to rotate horizontally toward the left from an initial angle until the black block of the test card is completely removed from the imaging screen of the image acquisition device; wherein the image acquisition device is pre-set on the rotating platform, and the lens of the image acquisition device is located at the center of the rotating platform; during the rotation of the rotating platform, the distance between the lens center of the image acquisition device and the test card remains unchanged; and the center height of the black block on the test card is consistent with the height of the lens center of the image acquisition device;
[0184] Controlling the rotating platform to rotate from left to right until the black block of the test card is completely removed from the imaging picture of the image acquisition device;
[0185] Wherein, during the rotation of the rotating platform, multiple sets of data are recorded, each set of data including a rotation angle and a horizontal moving distance of the center of the black block in the imaging picture corresponding to the rotation angle;
[0186] Based on the multiple sets of data, the corresponding relationship between the field of view angle of the image acquisition device and the image size in the vertical direction is determined.
[0187] In some embodiments, the correspondence between the field of view angle and the magnification ratio of the target is predetermined in the following manner:
[0188] Controlling the rotating platform to drive the image acquisition device to rotate horizontally toward the left from an initial angle until the black block of the test card is completely removed from the imaging screen of the image acquisition device; wherein the image acquisition device is pre-set on the rotating platform, and the lens of the image acquisition device is located at the center of the rotating platform; during the rotation of the rotating platform, the distance between the lens center of the image acquisition device and the test card remains unchanged; and the center height of the black block on the test card is consistent with the height of the lens center of the image acquisition device;
[0189] Controlling the rotating platform to rotate from left to right until the black block of the test card is completely removed from the imaging picture of the image acquisition device;
[0190] Wherein, when the rotating platform is at an initial angle, the number of pixels occupied by the black block in the imaging picture corresponding to the initial angle is recorded; and during the rotation of the rotating platform, multiple groups of data are recorded, each group of data including the rotation angle and the number of pixels occupied by the black block in the imaging picture corresponding to the rotation angle;
[0191] Based on the multiple sets of data and the number of pixels occupied by the black block in the imaging picture corresponding to the initial angle, determine the magnification ratio of the black block by the image acquisition device at different field of view angles;
[0192] Based on the magnification ratio of the black block at different field angles of view of the image acquisition device, the corresponding relationship between the field angle of view of the image acquisition device and the magnification ratio of the target is determined.
[0193] The transceiver 610 is configured to receive and send data under the control of the processor 600 .
[0194] Among them, Fig.10 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by processor 600 and various circuits of memory represented by memory 620 are linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 610 may be a plurality of components, namely, a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium, including wireless channels, wired channels, optical cables, and other transmission media. For different user devices, the user interface 630 may also be an interface capable of externally and internally connecting required devices, and the connected devices include but are not limited to a keypad, a display, a speaker, a microphone, a joystick, and the like.
[0195] The processor 600 is responsible for managing the bus architecture and general processing, and the memory 620 can store data used by the processor 600 when performing operations.
[0196] In some embodiments, the processor 600 may be a CPU (central processing unit), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or a CPLD (Complex Programmable Logic Device), and the processor may also adopt a multi-core architecture.
[0197] The processor calls the computer program stored in the memory to execute any of the methods provided in the embodiments of the present application according to the obtained executable instructions. The processor and the memory can also be arranged physically separately.
[0198] It should be noted here that the above-mentioned device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as those in the method embodiment will not be described in detail here.
[0199] See also Fig.11 , a distance measuring device provided in an embodiment of the present application includes:
[0200] The first unit 11 is used to acquire a captured image through an image acquisition device, and determine a target image in the captured image by performing target recognition on the captured image;
[0201] The second unit 12 is used to determine the coordinates of the target image, and based on the coordinates of the target image, determine the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device;
[0202] The third unit 13 is used to determine the distance between the target and the image acquisition device based on the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target.
[0203] In some embodiments, according to the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target, determining the distance between the target and the image acquisition device includes:
[0204] The distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device is used as the imaging size of the preset position on the target image in the preset direction, and the field of view angle corresponding to the image size of the target image in the preset direction is determined according to the imaging size and the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in the preset direction;
[0205] Determine the magnification ratio of the target on the target image according to the field of view angle corresponding to the image size of the target image in a preset direction and the correspondence between the field of view angle and the magnification ratio of the target determined in advance for the image acquisition device;
[0206] The distance between the target and the image acquisition device is determined according to the magnification ratio of the target on the target image.
[0207] In some embodiments, determining the distance between the target and the image acquisition device according to the magnification ratio of the target on the target image includes:
[0208] The distance between the target and the image acquisition device is determined according to the magnification ratio of the target on the target image, the preset actual size of the target in the preset direction, the focal length of the lens of the image acquisition device, and the size of the target image in the preset direction.
[0209] In some embodiments, the size of the target image in the preset direction is determined based on the number of pixels of the circumscribed rectangular frame of the target image in the vertical direction and the size of each pixel.
[0210] In some embodiments, determining the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device based on the coordinates of the target image includes:
[0211] Based on the coordinates of the center point of the target image and the size of each pixel, the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device is determined.
[0212] In some embodiments, the correspondence between the field of view angle and the image size in the preset direction is predetermined in the following manner:
[0213] Controlling the rotating platform to drive the image acquisition device to rotate horizontally toward the left from an initial angle until the black block of the test card is completely removed from the imaging screen of the image acquisition device; wherein the image acquisition device is pre-set on the rotating platform, and the lens of the image acquisition device is located at the center of the rotating platform; during the rotation of the rotating platform, the distance between the lens center of the image acquisition device and the test card remains unchanged; and the center height of the black block on the test card is consistent with the height of the lens center of the image acquisition device;
[0214] Controlling the rotating platform to rotate from left to right until the black block of the test card is completely removed from the imaging picture of the image acquisition device;
[0215] Wherein, during the rotation of the rotating platform, multiple sets of data are recorded, each set of data including a rotation angle and a horizontal moving distance of the center of the black block in the imaging picture corresponding to the rotation angle;
[0216] Based on the multiple sets of data, the corresponding relationship between the field of view angle of the image acquisition device and the image size in the vertical direction is determined.
[0217] In some embodiments, the correspondence between the field of view angle and the magnification ratio of the target is predetermined in the following manner:
[0218] Controlling the rotating platform to drive the image acquisition device to rotate horizontally toward the left from an initial angle until the black block of the test card is completely removed from the imaging screen of the image acquisition device; wherein the image acquisition device is pre-set on the rotating platform, and the lens of the image acquisition device is located at the center of the rotating platform; during the rotation of the rotating platform, the distance between the lens center of the image acquisition device and the test card remains unchanged; and the center height of the black block on the test card is consistent with the height of the lens center of the image acquisition device;
[0219] Controlling the rotating platform to rotate from left to right until the black block of the test card is completely removed from the imaging picture of the image acquisition device;
[0220] Wherein, when the rotating platform is at an initial angle, the number of pixels occupied by the black block in the imaging picture corresponding to the initial angle is recorded; and during the rotation of the rotating platform, multiple groups of data are recorded, each group of data including the rotation angle and the number of pixels occupied by the black block in the imaging picture corresponding to the rotation angle;
[0221] Based on the multiple sets of data and the number of pixels occupied by the black block in the imaging picture corresponding to the initial angle, determine the magnification ratio of the black block by the image acquisition device at different field of view angles;
[0222] Based on the magnification ratio of the black block at different field angles of view of the image acquisition device, the corresponding relationship between the field angle of view of the image acquisition device and the magnification ratio of the target is determined.
[0223] It should be noted that the division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0224] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0225] Any of the devices or apparatuses provided in the embodiments of the present application may specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), etc. It may include a central processing unit (CPU), a memory, an input / output device, etc. The input device may include a keyboard, a mouse, a touch screen, etc. The output device may include a display device, such as a liquid crystal display (LCD), a cathode ray tube (CRT), etc.
[0226] The memory may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor with program instructions and data stored in the memory. In an embodiment of the present application, the memory may be used to store the program of any of the methods provided in the embodiments of the present application.
[0227] The processor calls the program instructions stored in the memory, and the processor is used to execute any of the methods provided in the embodiments of the present application according to the obtained program instructions.
[0228] The present application embodiment also provides a computer program product or computer program, which includes a computer instruction, which is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction so that the computer device executes any of the methods described in the above embodiments. The program product can use any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0229] The embodiment of the present application provides a computer-readable storage medium for storing computer program instructions used by the apparatus provided in the embodiment of the present application, which includes a program for executing any of the methods provided in the embodiment of the present application. The computer-readable storage medium may be a non-transitory computer-readable medium.
[0230] The computer-readable storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.
[0231] It should be understood that:
[0232] The access technology through which entities in the communication network transmit traffic can be any suitable current or future technology, such as WLAN (Wireless Local Access Network), WiMAX (Worldwide Interoperability for Microwave Access), LTE, LTE-A, 5G, Bluetooth, infrared, etc.; in addition, the embodiments can also apply wired technology, for example, IP-based access technology, such as a wired network or a fixed line.
[0233] Embodiments suitable for being implemented as software code or a portion thereof and running using a processor or processing functionality are independent of the software code and may be specified using any known or future developed programming language, such as a high-level programming language such as objective-C, C, C++, C#, Java, Python, Javascript, other scripting languages, etc., or a low-level programming language such as machine language or assembler.
[0234] The implementation of the embodiments is hardware independent and may be implemented using any known or future developed hardware technology or any mixture thereof, such as a microprocessor or CPU (central processing unit), MOS (metal oxide semiconductor), CMOS (complementary MOS), BiMOS (bipolar MOS), BiCMOS (bipolar CMOS), ECL (emitter coupled logic) and / or TTL (transistor-transistor logic).
[0235] Embodiments may be implemented as separate devices, apparatuses, units, components, or functions, or in a distributed manner, for example, one or more processors or processing functions may be used or shared in a process, or one or more processing segments or processing portions may be used and shared in a process, wherein one physical processor or more than one physical processor may be used to implement one or more processing portions dedicated to a specific process as described.
[0236] The device may be implemented by a semiconductor chip, a chipset, or a (hardware) module including such a chip or chipset.
[0237] The embodiments may also be implemented as any combination of hardware and software, such as ASIC (Application Specific IC (Integrated Circuit)) components, FPGA (Field Programmable Gate Array) or CPLD (Complex Programmable Logic Device) components or DSP (Digital Signal Processor) components.
[0238] The embodiments may also be implemented as a computer program product including a computer usable medium having computer readable program code embodied therein, the computer readable program code being adapted to perform the processes as described in the embodiments, wherein the computer usable medium may be a non-transitory medium.
[0239] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.
[0240] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0241] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0242] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0243] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A distance measurement method, characterized in that: The method comprises: Acquire a captured image through an image acquisition device, and determine a target image in the captured image by performing target recognition on the captured image; Determine the coordinates of the target image, and based on the coordinates of the target image, determine the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device; The distance between the target and the image acquisition device is determined according to the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target.
2. The method according to claim 1, characterized in that According to the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target, the distance between the target and the image acquisition device is determined, including: The distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device is used as the imaging size of the preset position on the target image in the preset direction, and the field of view angle corresponding to the image size of the target image in the preset direction is determined according to the imaging size and the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in the preset direction; Determine the magnification ratio of the target on the target image according to the field of view angle corresponding to the image size of the target image in a preset direction and the correspondence between the field of view angle and the target magnification ratio determined in advance for the image acquisition device; The distance between the target and the image acquisition device is determined according to the magnification ratio of the target on the target image.
3. The method according to claim 2, characterized in that Determining the distance between the target and the image acquisition device according to the magnification ratio of the target on the target image includes: The distance between the target and the image acquisition device is determined according to the magnification ratio of the target on the target image, the preset actual size of the target in the preset direction, the focal length of the lens of the image acquisition device, and the size of the target image in the preset direction.
4. The method according to claim 3, characterized in that The size of the target image in the preset direction is determined based on the number of pixels of the circumscribed rectangular frame of the target image in the vertical direction and the size of each pixel.
5. The method according to claim 1, characterized in that Determining the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device based on the coordinates of the target image includes: Based on the coordinates of the center point of the target image and the size of each pixel, the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device is determined.
6. The method according to claim 1, characterized in that The corresponding relationship between the field of view angle and the image size in the preset direction is predetermined in the following manner: Controlling the rotating platform to drive the image acquisition device to rotate horizontally toward the left from an initial angle until the black block of the test card is completely removed from the imaging screen of the image acquisition device; wherein the image acquisition device is pre-set on the rotating platform, and the lens of the image acquisition device is located at the center of the rotating platform; during the rotation of the rotating platform, the distance between the lens center of the image acquisition device and the test card remains unchanged; and the center height of the black block on the test card is consistent with the height of the lens center of the image acquisition device; Controlling the rotating platform to rotate from left to right until the black block of the test card is completely removed from the imaging picture of the image acquisition device; Wherein, during the rotation of the rotating platform, multiple sets of data are recorded, each set of data including a rotation angle and a horizontal moving distance of the center of the black block in the imaging picture corresponding to the rotation angle; Based on the multiple sets of data, the corresponding relationship between the field of view angle of the image acquisition device and the image size in the vertical direction is determined.
7. The method according to claim 1, characterized in that The corresponding relationship between the field of view angle and the magnification ratio of the target is predetermined in the following manner: Controlling the rotating platform to drive the image acquisition device to rotate horizontally toward the left from an initial angle until the black block of the test card is completely removed from the imaging screen of the image acquisition device; wherein the image acquisition device is pre-set on the rotating platform, and the lens of the image acquisition device is located at the center of the rotating platform; during the rotation of the rotating platform, the distance between the lens center of the image acquisition device and the test card remains unchanged; and the center height of the black block on the test card is consistent with the height of the lens center of the image acquisition device; Controlling the rotating platform to rotate from left to right until the black block of the test card is completely removed from the imaging picture of the image acquisition device; Wherein, when the rotating platform is at an initial angle, the number of pixels occupied by the black block in the imaging picture corresponding to the initial angle is recorded; and during the rotation of the rotating platform, multiple groups of data are recorded, each group of data including the rotation angle and the number of pixels occupied by the black block in the imaging picture corresponding to the rotation angle; Based on the multiple sets of data and the number of pixels occupied by the black block in the imaging picture corresponding to the initial angle, determine the magnification ratio of the black block by the image acquisition device at different field of view angles; Based on the magnification ratio of the black block at different field angles of view of the image acquisition device, the corresponding relationship between the field angle of view of the image acquisition device and the magnification ratio of the target is determined.
8. A distance measuring device, characterized in that: The device comprises: The first unit is used to acquire a captured image through an image acquisition device, and determine a target image in the captured image by performing target recognition on the captured image; The second unit is used to determine the coordinates of the target image, and based on the coordinates of the target image, determine the distance between the center point on the target image and the center point of the photoelectric conversion plate of the image acquisition device; The third unit is used to determine the distance between the target and the image acquisition device based on the distance between the center point on the target image and the center point of the photoelectric conversion panel of the image acquisition device, and based on the correspondence between the field of view angle determined in advance for the image acquisition device and the image size in a preset direction, and the correspondence between the field of view angle and the magnification ratio of the target.
9. An electronic device, characterized in that: include: A memory for storing program instructions; A processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 7 according to the obtained program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable the computer to execute the method according to any one of claims 1 to 7.
