Object size determination method and device, equipment, storage medium and program product
By capturing images of target objects from different locations using a drone, and calculating disparity using the YOLOv5 detection algorithm and feature point matching, combined with camera parameters, the problem of low ranging accuracy of drones was solved, achieving high-precision ranging and size estimation in complex environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-03-27
AI Technical Summary
The ranging accuracy of UAVs is low and they are greatly affected by external interference. Existing visual ranging methods are easily affected by changes in viewing angle and lighting conditions, resulting in poor accuracy.
Two images of a target object are captured by a drone at different locations. The YOLOv5 target detection algorithm is used to identify the detection box region of the target object. The parallax is calculated by feature point matching. Combined with camera parameters, the distance and size between the drone and the target object are determined.
It improves the accuracy and precision of drone ranging, enabling accurate calculation of the distance and size between the drone and the target object in complex environments.
Smart Images

Figure CN121746451A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, storage medium, and program product for determining the size of an object. Background Technology
[0002] With the rapid development of UAV technology, UAVs are increasingly widely used in various fields, especially in monitoring, reconnaissance, and measurement. Accurate ranging and size estimation of target objects are among the key tasks in UAV applications. Traditional ranging methods, such as laser ranging, radar ranging, and ultrasonic ranging, while offering high accuracy, are often limited by equipment cost and environmental conditions. In recent years, vision-based ranging methods have attracted considerable attention due to their low cost and high flexibility. However, single-view vision-based ranging and size estimation methods are susceptible to changes in viewing angle and lighting conditions, resulting in relatively poor accuracy.
[0003] Currently, drone ranging is easily affected by external interference, resulting in low ranging accuracy. Summary of the Invention
[0004] This disclosure provides a method, apparatus, device, storage medium, and program product for determining the size of an object, to at least solve the problem of low ranging accuracy in existing UAVs.
[0005] The technical solution disclosed herein is as follows: This disclosure provides a method for determining the size of an object, including: Acquire a first image and a second image of the target object, wherein the first image is an image taken by the drone at a first position, and the second image is an image taken by the drone at a second position; Target detection is performed on the first image to obtain a first detection box region corresponding to the target object; and target detection is performed on the second image to obtain a second detection box region corresponding to the target object. Based on feature detection and matching of the first detection box region and the second detection box region, the disparity of the target object in the first image and the second image is determined. The distance between the UAV and the target object is determined based on the parallax and camera parameters. The size of the target object is determined based on the size of the target detection box and the camera parameters, wherein the target detection box is the detection box corresponding to the first detection box region or the detection box corresponding to the second detection box region.
[0006] Optionally, the step of performing target detection on the first image to obtain a first detection box region corresponding to the target object; and performing target detection on the second image to obtain a second detection box region corresponding to the target object includes: The first image is input into the target detection model to obtain the first detection bounding box region; and The second image is input into the target detection model to obtain the second detection box region.
[0007] Optionally, determining the disparity of the target object in the first image and the second image based on feature detection and matching of the first detection box region and the second detection box region includes: Perform feature detection on the first detection box region to obtain the first feature point; Within the second detection box area, feature matching is performed on the first feature point to obtain a second feature point that matches the first feature point; The disparity of the target object in the first image and the second image is calculated based on the x-coordinates of the first feature point and the second feature point.
[0008] Optionally, the camera parameters include: focal length and baseline distance, and determining the distance between the UAV and the target object based on the parallax and camera parameters includes: The distance between the UAV and the target object is calculated based on the parallax, the focal length, and the baseline distance.
[0009] Optionally, the camera parameters include: focal length and number of pixels, and determining the size of the target object based on the size of the target detection box and the camera parameters includes: Calculate the actual size of each pixel based on the size of the target detection box, the focal length, and the number of pixels; The size of the target object is calculated based on the size of the target detection box and the actual size corresponding to each pixel.
[0010] Optionally, acquiring the first image and the second image of the target object includes: Obtain the first initial image and the second initial image; Obtain the first camera parameters corresponding to the first initial image and the second camera parameters corresponding to the second initial image; Based on the first camera parameters and the second camera parameters, the first initial image and the second initial image are aligned to a common coordinate system to obtain the first image and the second image.
[0011] This disclosure also provides an object size determination device, including: The acquisition module is used to acquire a first image and a second image of the target object, wherein the first image is an image taken by the drone at a first position, and the second image is an image taken by the drone at a second position; The detection module is used to perform target detection on the first image to obtain a first detection box region corresponding to the target object; and to perform target detection on the second image to obtain a second detection box region corresponding to the target object. The first determining module is used to determine the disparity of the target object in the first image and the second image based on feature detection and matching of the first detection box region and the second detection box region; The second determining module is used to determine the distance between the UAV and the target object based on the parallax and camera parameters; The third determining module is used to determine the size of the target object based on the size of the target detection box and the camera parameters, wherein the target detection box is the detection box corresponding to the first detection box region or the detection box corresponding to the second detection box region.
[0012] This disclosure also provides an electronic device, including: processor; Memory used to store processor-executable instructions; The processor is configured to execute instructions to implement the steps in the above method.
[0013] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0014] This disclosure also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of the method described above.
[0015] The technical solutions provided by the embodiments of this disclosure bring at least the following beneficial effects: In some embodiments of this disclosure, a first image and a second image of a target object are acquired, wherein the first image is an image captured by a drone at a first position, and the second image is an image captured by the drone at a second position; target detection is performed on the first image to obtain a first detection box region corresponding to the target object; and target detection is performed on the second image to obtain a second detection box region corresponding to the target object; based on feature detection and matching of the first and second detection box regions, the disparity of the target object in the first and second images is determined; the distance between the drone and the target object is determined based on the disparity and camera parameters; and the size of the target object is determined based on the size of the target detection box and camera parameters, wherein the target detection box is the detection box corresponding to either the first or second detection box region. This disclosure utilizes two drone shots of the same scene, calculates the disparity through feature point matching, and combines camera parameters to accurately calculate the distance between the drone and the target object, as well as the size of the target object, thereby improving the ranging accuracy of the drone.
[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0018] Figure 1 A flowchart illustrating an object size determination method provided for an exemplary embodiment of this disclosure; Figure 2 A schematic diagram of the structure of an object size determination device provided for an exemplary embodiment of this disclosure; Figure 3 A schematic diagram of the structure of an electronic device provided for an exemplary embodiment of this disclosure. Detailed Implementation
[0019] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0020] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure.
[0021] It should be noted that the user information involved in this disclosure includes, but is not limited to, user device information and user personal information; the collection, storage, use, processing, transmission, provision and disclosure of user information in this disclosure all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0022] To address the aforementioned technical problems, in some embodiments of this disclosure, a first image and a second image of a target object are acquired, wherein the first image is an image captured by a drone at a first position, and the second image is an image captured by the drone at a second position; target detection is performed on the first image to obtain a first detection box region corresponding to the target object; and target detection is performed on the second image to obtain a second detection box region corresponding to the target object; based on feature detection and matching of the first and second detection box regions, the disparity of the target object in the first and second images is determined; the distance between the drone and the target object is determined based on the disparity and camera parameters; and the size of the target object is determined based on the size of the target detection box and camera parameters, wherein the target detection box is the detection box corresponding to either the first or second detection box region. This disclosure utilizes two drone shots of the same scene, calculates the disparity through feature point matching, and combines camera parameters to accurately calculate the distance between the drone and the target object, as well as the size of the target object, thereby improving the ranging accuracy of the drone.
[0023] The technical solutions provided by the embodiments of this disclosure are described in detail below with reference to the accompanying drawings.
[0024] Figure 1 This is a flowchart illustrating a method for determining the size of an object, provided as an exemplary embodiment of this disclosure. Figure 1 As shown, the method includes: S101: Acquire a first image and a second image including the target object, wherein the first image is an image taken by the drone at a first position, and the second image is an image taken by the drone at a second position; S102: Perform target detection on the first image to obtain a first detection box region corresponding to the target object; and perform target detection on the second image to obtain a second detection box region corresponding to the target object; S103: Based on feature detection and matching of the first and second detection box regions, determine the disparity of the target object in the first and second images; S104: Determine the distance between the drone and the target object based on parallax and camera parameters; S105: Determine the size of the target object based on the size of the target detection box and the camera parameters, wherein the target detection box is the detection box corresponding to the first detection box area or the detection box corresponding to the second detection box area.
[0025] In this embodiment, the subject executing the above method can be a drone, a terminal device, or a server.
[0026] The terminal device includes, but is not limited to, mobile stations (MS), mobile terminals, mobile phones, handsets, and portable equipment. This terminal device can communicate with one or more core networks via a radio access network (RAN). For example, the terminal device can be a mobile phone (or "cellular" phone), a computer with wireless communication capabilities, a computer with wireless transceiver capabilities, a virtual reality (VR) terminal device, an AR terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical care, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, etc. The operating systems installed on the terminal device include, but are not limited to, iOS, Android, Windows, Linux, and Mac OS. In different networks, terminals may be called by different names, such as: user equipment, mobile station, user unit, station, cellular phone, personal digital assistant, wireless modem, wireless communication device, handheld device, laptop, cordless phone, wireless local loop station, television, etc. For ease of description, this embodiment will simply refer to it as terminal device.
[0027] In this embodiment, the implementation form of the server is not limited. For example, the server can be a conventional server, a cloud server, a cloud host, a virtual center, or other server devices. The server mainly consists of a processor, hard disk, memory, system bus, and other common computer architecture types.
[0028] In this embodiment, a first image and a second image of a target object are acquired, wherein the first image is an image captured by a drone at a first position, and the second image is an image captured by the drone at a second position; target detection is performed on the first image to obtain a first detection box region corresponding to the target object; and target detection is performed on the second image to obtain a second detection box region corresponding to the target object; based on feature detection and matching of the first and second detection box regions, the disparity of the target object in the first and second images is determined; the distance between the drone and the target object is determined based on the disparity and camera parameters; and the size of the target object is determined based on the size of the target detection box and camera parameters, wherein the target detection box is the detection box corresponding to either the first or second detection box region. This disclosure utilizes two drone images of the same scene, calculates the disparity through feature point matching, and combines camera parameters to accurately calculate the distance between the drone and the target object, as well as the size of the target object, thereby improving the ranging accuracy of the drone.
[0029] It should be noted that binocular vision is an important technology in the field of computer vision. By simulating the human eye's binocular system, two cameras are used to capture the same scene. By matching feature points to calculate disparity and combining camera parameters, it is possible to achieve accurate measurement of the distance to objects.
[0030] Object detection is a core task in the field of computer vision. Its purpose is to simultaneously identify the category of an object of interest and determine its location in the image, given an image or video frame.
[0031] YOLO (You Only Look Once) is a deep learning-based object detection algorithm that can quickly and accurately identify target objects in real-time applications.
[0032] High-precision cameras are essential for drones. They must possess high resolution and stable imaging capabilities to capture clear images of target objects. The cameras should automatically adjust parameters such as focus and exposure to adapt to varying lighting and distance conditions. Simultaneously, they should generate camera parameters during recording, including focus, roll angle, yaw angle, and pitch angle. These parameters are crucial for subsequent binocular ranging and object size estimation.
[0033] RTK (Real-Time Kinematic) positioning and orientation technology is a high-precision navigation and positioning technology that drones must be equipped with, capable of achieving positioning accuracy at the centimeter or even millimeter level. This function ensures that the drone can accurately record the latitude, longitude, and absolute altitude of the shooting location during two shooting sessions. These parameters are crucial for subsequent binocular ranging.
[0034] In some embodiments of this disclosure, a first image and a second image including a target object are acquired. One possible approach is to acquire a first initial image and a second initial image; acquire first camera parameters corresponding to the first initial image and second camera parameters corresponding to the second initial image; and align the first initial image and the second initial image to a common coordinate system based on the first camera parameters and the second camera parameters to obtain the first image and the second image.
[0035] First, the two cameras need to be calibrated to obtain their intrinsic parameters (focal length, principal point, distortion coefficients, etc.) and extrinsic parameters (rotation and translation relative to the world coordinate system). Using the calibration results, stereo correction is performed on the images from both cameras. The purpose of stereo correction is to align the images from the two cameras to a common coordinate system, ensuring that corresponding points are on the same row (or as close to the same row as possible), thus simplifying subsequent calculations. Stereo correction may not completely eliminate differences on the Y-axis, but it can minimize them.
[0036] In the above embodiments, firstly, the drone takes an initial picture of the target object from an initial position to acquire a first initial image. During the picture capture, the drone must remain stable to ensure a clear, shake-free image. The camera and drone parameters are recorded at this time. After completing the first picture capture, the drone moves to a second position to take a second picture of the target object or scene, and the camera and drone parameters are recorded at this time. The two picture capture positions should have a certain parallax to facilitate subsequent distance measurement using binocular vision principles. It should be noted that the camera parameters in this embodiment include, but are not limited to: focal length, roll angle, yaw angle, pitch angle, number of pixels, and baseline distance. The drone parameters in this embodiment include, but are not limited to: the drone's latitude and longitude and absolute altitude. This disclosure utilizes a single ordinary camera equipped on a drone to take two pictures of the target from different positions, successfully achieving accurate distance measurement and effective estimation of the object's size.
[0037] It should be noted that the type of target object is not limited in the embodiments disclosed herein. The type of target object can be adjusted according to the actual situation. For example, the target object can be a 700M antenna in a wireless base station. Since antennas are mostly installed at high locations such as towers or rooftops, using drones for ranging has many practical significances. It not only improves measurement efficiency and accuracy and reduces measurement risks and costs, but also supports measurement and base station maintenance and optimization work in complex environments.
[0038] In some embodiments of this disclosure, target detection is performed on a first image to obtain a first detection box region corresponding to the target object; and target detection is performed on a second image to obtain a second detection box region corresponding to the target object. One possible implementation is to input the first image into a target detection model to obtain the first detection box region; and to input the second image into a target detection model to obtain the second detection box region. It should be noted that the target detection model in the embodiments of this disclosure can be the YOLOv5 target detection model. This disclosure utilizes the YOLOv5 target detection algorithm to accurately identify target object detection boxes in two images and performs image matching only on the regions within the detection boxes, effectively reducing the impact of background interference on image matching. By improving the accuracy and stability of image feature matching, the accuracy and reliability of the ranging method are further enhanced.
[0039] YOLOv5 is a high-efficiency and popular object detection algorithm based on CNNs in deep learning. Its core idea is to detect the category and location of multiple objects in an image through a single forward pass. YOLOv5 is fast, accurate, and offers various model sizes to meet different needs. It has been widely used in transportation, security, autonomous driving, and medical image analysis, facilitating automated control and intelligent monitoring. The object detection algorithm based on YOLOv5 mainly consists of the following steps: data preparation, model selection, and model training and testing. The training process is described below: Data Preparation. Before training the YOLOv5 model, the dataset needs to be prepared and preprocessed. This includes the following steps: 1. Data Collection: Collect relevant image data according to the actual application scenario. Here, approximately 1000 images of a 700M antenna taken by a drone can be collected as the dataset. 2. Data Labeling: Use labeling tools to label the targets in the images, generating a labeling file containing the target's category information and bounding box coordinates. 3. Data Splitting: Divide the dataset into training, validation, and test sets in an 8:1:1 ratio. The training set is used to train the model, the validation set is used to adjust model parameters and monitor the training process, and the test set is used to evaluate the model's final performance. 4. Data Preprocessing: Preprocess the image data, including scaling to the same size and normalizing image pixel values, to improve the model's generalization ability and reduce the risk of overfitting.
[0040] Model Structure Selection. The YOLOv5 model includes several variants, such as YOLOv5s, YOLOv5m, YOLOv5l, and YOLOv5x, which differ in architecture, number of parameters, and computational cost. Considering both detection accuracy and efficiency requirements, this disclosure selects YOLOv5s as the detection model. The YOLOv5s network structure mainly consists of a backbone network, a decoder, multi-scale feature fusion, and a prediction head.
[0041] Loss functions. YOLOv5 employs multi-task loss functions, including classification loss, localization loss, and confidence loss. These loss functions work together to enable the model to learn more accurate prediction results.
[0042] Model Training. Set training parameters, such as learning rate, batch size, and number of training epochs. Train the model using the training dataset. During training, the model continuously updates its network parameters to minimize the loss function. SGD optimization can be used for parameter updates. Evaluate the model's performance on the validation set. Calculate metrics such as accuracy and recall to assess the model's performance. Based on the evaluation results, the model can be adjusted and optimized. After training, the YOLOv5 model can be used to perform object detection on captured antenna images.
[0043] In some embodiments of this disclosure, the disparity of a target object in a first image and a second image is determined by performing feature detection and matching on a first detection box region and a second detection box region. One possible approach is to perform feature detection on the first detection box region to obtain a first feature point; perform feature matching on the first feature point in the second detection box region to obtain a second feature point that matches the first feature point; and calculate the disparity of the target object in the first image and the second image based on the abscissa of the first feature point and the abscissa of the second feature point.
[0044] In some embodiments of this disclosure, the distance between the UAV and the target object is determined based on parallax and camera parameters. One possible approach is to calculate the distance between the UAV and the target object based on parallax, focal length, and baseline distance. This disclosure achieves rapid estimation of the distance to the target object by incorporating binocular vision principles. This method does not rely on prior information about the target object, and therefore can be generalized to any object, offering a wider range of applications and greater versatility.
[0045] The first step is to match two images captured by the camera. Image matching refers to establishing a one-to-one correspondence between two images of the same scene or object from different perspectives. In the two images, the SIFT (Significant Indicator of Feature) keypoint detection algorithm is used to extract feature points of the target object. SIFT is invariant to image scaling and rotation, and has high tolerance to changes in lighting, noise, and micro-viewpoints, enabling it to stably detect feature points in various environments. This means that SIFT can support feature detection and matching for images captured from two positions by a single camera. These feature points are typically regions with significant gradient changes, such as corners, edges, or spots in the image. For each detected feature point, a descriptor is generated, containing image information surrounding that feature point. To improve matching accuracy and efficiency and reduce background noise interference, feature detection and matching are directly performed on the regions within the detection boxes generated by the YOLOv5 object detection model. Subsequently, a matching algorithm is used to find the feature points in the second image that correspond to the feature points in the first image.
[0046] After image matching is completed, based on the principle of binocular vision, the position of the target object in the two images can be determined, and then the disparity can be calculated. Disparity refers to the difference in position of the same object in two images; it reflects the distance information between the object and the camera. Given the baseline distance and viewing angle of the camera during the two shots, the three-dimensional coordinates or distance of the object can be calculated using the principle of triangulation. Since the camera positions for the two shots are not limited in this invention, they may not be on the same horizontal or vertical line and are not fixed. Although this configuration increases the complexity of the calculation, the basic principle of binocular ranging still applies, and the calculation steps are as follows: Stereo correction. First, the two cameras need to be calibrated to obtain their intrinsic parameters (focal length, principal point, distortion coefficients, etc.) and extrinsic parameters (rotation and translation relative to the world coordinate system). Using the calibration results, stereo correction is performed on the images from the two cameras. The purpose of stereo correction is to align the images from the two cameras into a common coordinate system, so that corresponding points are on the same row (or as close to the same row as possible), thereby simplifying subsequent calculations. Stereo correction may not completely eliminate differences on the Y-axis, but it can minimize them.
[0047] Obtain matching point pairs. Let the coordinates of a feature point in the left image be (X1, Y1), and the coordinates of the corresponding feature point in the right image be (X2, Y2). Since the stereo camera has been calibrated and corrected, Y1 and Y2 are considered to be approximately the same, i.e., Y1≈Y2.
[0048] Calculate parallax. Parallax is defined as the deviation of a point in the X direction between the left and right cameras, i.e., ΔX = X1 - X2. This value reflects the distance of the object from the camera; the larger the parallax, the closer the object is to the camera; the smaller the parallax, the farther the object is from the camera.
[0049] Depth is calculated using formulas. Given the focal length *f* and baseline distance *a*, disparity can be calculated using the formula ΔX = f*a / d, which reflects the horizontal displacement of the object in the left and right images. After solving for the disparity, the distance between the drone and the target object is calculated using triangulation formulas, combined with camera parameters such as the drone's focal length and baseline distance. For each matched feature point, a distance value can be calculated. To improve measurement accuracy, the distance values of multiple matched feature points can be averaged or weighted averaged.
[0050] In some embodiments of this disclosure, the size of the target object is determined based on the size of the target detection bounding box and camera parameters. One possible approach is to calculate the actual size corresponding to each pixel based on the size of the target detection bounding box, focal length, and number of pixels; and then calculate the size of the target object based on the size of the target detection bounding box and the actual size corresponding to each pixel. After calculating the distance to the target object using UAV dual-view image ranging, this disclosure combines the size information of the target object's YOLOv5 detection bounding box in the image with camera parameters to further estimate the actual width and height of the target object.
[0051] After obtaining the distance between the drone and the target object, and combining the size information of the target detection bounding box in the image with camera parameters (such as pixel size, focal length, etc.), the actual width and height of the target object can be further estimated. Specifically, assume the distance between the drone and the target object is d; the size information of the target detection bounding box in the image includes width w and height h; and the camera parameters, such as pixel size p and focal length f. Since the camera's pixel size is known, the actual size corresponding to each pixel can be calculated. Actual size corresponding to each pixel = focal length f / (image width w (or height h) × number of pixels p).
[0052] The size of the target object in the real world is calculated using the size information w and h of the object detection bounding box in the image, as well as the actual size of each pixel. The actual width of the target object = w × the actual size of each pixel; the actual height of the target object = h × the actual size of each pixel.
[0053] The above describes a method for UAV dual-view image ranging and object size estimation that combines target detection. In practical applications, multiple measurements and calibrations are required to improve measurement accuracy.
[0054] This embodiment of the disclosure uses a single camera mounted on a drone to capture images of a target object twice from different locations. The YOLOv5 target detection algorithm is used to accurately identify the target object, extract features from the YOLOv5 detection bounding box region, and perform image matching. Based on the principle of binocular vision, the distance between the drone and the target object is accurately measured. By combining this measured distance with the relationship between the YOLOv5 detection bounding box, the actual size of the target object is quickly estimated.
[0055] Figure 2 This is a schematic diagram of the structure of an object size determination device 20 provided for an exemplary embodiment of this disclosure. (See diagram below.) Figure 2 As shown, the object size determination device 20 includes: an acquisition module 21, a detection module 22, a first determination module 23, a second determination module 24, and a third determination module 25.
[0056] The acquisition module 21 is used to acquire a first image and a second image of the target object, wherein the first image is an image taken by the drone at a first position and the second image is an image taken by the drone at a second position. Detection module 22 is used to perform target detection on the first image to obtain a first detection box region corresponding to the target object; and to perform target detection on the second image to obtain a second detection box region corresponding to the target object; The first determining module 23 is used to determine the disparity of the target object in the first image and the second image based on feature detection and matching of the first detection box region and the second detection box region. The second determining module 24 is used to determine the distance between the UAV and the target object based on parallax and camera parameters; The third determining module 25 is used to determine the size of the target object based on the size of the target detection box and the camera parameters, wherein the target detection box is the detection box corresponding to the first detection box area or the detection box corresponding to the second detection box area.
[0057] Optionally, when the detection module 22 performs target detection on the first image to obtain a first detection box region corresponding to the target object, and performs target detection on the second image to obtain a second detection box region corresponding to the target object, it is used to: The first image is input into the target detection model to obtain the first detection bounding box region; and The second image is input into the target detection model to obtain the second detection box region.
[0058] Optionally, when the first determining module 23 determines the disparity of the target object in the first image and the second image based on feature detection and matching of the first detection box region and the second detection box region, it is used to: Perform feature detection on the first detection box region to obtain the first feature point; Within the second detection box area, feature matching is performed on the first feature point to obtain the second feature point that matches the first feature point; Based on the x-coordinates of the first feature point and the second feature point, calculate the disparity of the target object in the first image and the second image.
[0059] Optionally, the camera parameters include: focal length and baseline distance. The second determining module 24, when determining the distance between the UAV and the target object based on parallax and camera parameters, is used for: The distance between the drone and the target object is calculated based on parallax, focal length, and baseline distance.
[0060] Optionally, the camera parameters include: focal length and number of pixels. The third determining module 25, when determining the size of the target object based on the size of the target detection box and the camera parameters, is used for: Calculate the actual size of each pixel based on the size of the target detection bounding box, focal length, and number of pixels; The size of the target object is calculated based on the size of the target detection bounding box and the actual size of each pixel.
[0061] Optionally, when acquiring the first image and the second image including the target object, the acquisition module 21 is used to: Obtain the first initial image and the second initial image; Obtain the first camera parameters corresponding to the first initial image and the second camera parameters corresponding to the second initial image; Based on the parameters of the first camera and the second camera, the first initial image and the second initial image are aligned to a common coordinate system to obtain the first image and the second image.
[0062] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0063] Figure 3 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of the present disclosure. For example... Figure 3 As shown, the electronic device includes a memory 31 and a processor 32. Additionally, the electronic device also includes a power supply component 33 and a communication component 34.
[0064] Memory 31 is used to store computer programs and can be configured to store various other data to support operation on the electronic device. Examples of this data include instructions for any application or method used to operate on the electronic device.
[0065] The memory 31 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0066] Communication component 34 is used for data transmission with other devices.
[0067] The processor 32 is executable computer instructions stored in the memory 31 for: acquiring a first image and a second image including a target object, wherein the first image is an image captured by the drone at a first position and the second image is an image captured by the drone at a second position; performing target detection on the first image to obtain a first detection box region corresponding to the target object; and performing target detection on the second image to obtain a second detection box region corresponding to the target object; determining the disparity of the target object in the first image and the second image based on feature detection and matching of the first and second detection box regions; determining the distance between the drone and the target object based on the disparity and camera parameters; and determining the size of the target object based on the size of the target detection box and camera parameters, wherein the target detection box is the detection box corresponding to the first detection box region or the detection box corresponding to the second detection box region.
[0068] Accordingly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program. When the computer-readable storage medium stores a computer program, and the computer program is executed by one or more processors, it causes one or more processors to perform... Figure 1 Each step in the method embodiment.
[0069] Accordingly, embodiments of this disclosure also provide a computer program product, which includes a computer program / instructions that are executed by a processor. Figure 1 Each step in the method embodiment.
[0070] The above Figure 3The communication component is configured to facilitate wired or wireless communication between the device containing the communication component and other devices. The device containing the communication component can access wireless networks based on communication standards, such as WiFi, 2G, 3G, 4G / LTE, 5G, or combinations thereof. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component also includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID), Infrared Data Association (IrDA) technology, Ultra-Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0071] The above Figure 3 The power supply component provides power to the various components of the device in which it resides. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which it resides.
[0072] The aforementioned electronic devices also include a display screen and audio components.
[0073] The display includes a screen, which may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can sense not only the boundaries of touch or swipe actions, but also the duration and pressure associated with the touch or swipe operation.
[0074] An audio component may be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals may be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.
[0075] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0076] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0077] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0078] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0079] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0080] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0081] Computer-readable media include both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0082] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0083] The above are merely specific embodiments of this disclosure, enabling those skilled in the art to understand or implement this disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to these embodiments, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for determining the size of an object, characterized in that, include: Acquire a first image and a second image of the target object, wherein the first image is an image taken by the drone at a first position, and the second image is an image taken by the drone at a second position; Target detection is performed on the first image to obtain a first detection box region corresponding to the target object; and target detection is performed on the second image to obtain a second detection box region corresponding to the target object. Based on feature detection and matching of the first detection box region and the second detection box region, the disparity of the target object in the first image and the second image is determined. The distance between the drone and the target object is determined based on the parallax and camera parameters. The size of the target object is determined based on the size of the target detection box and the camera parameters, wherein the target detection box is the detection box corresponding to the first detection box region or the detection box corresponding to the second detection box region.
2. The method according to claim 1, characterized in that, The first image is subjected to target detection to obtain a first detection box region corresponding to the target object; And performing target detection on the second image to obtain a second detection box region corresponding to the target object, including: The first image is input into the target detection model to obtain the first detection box region; as well as The second image is input into the target detection model to obtain the second detection box region.
3. The method according to claim 1, characterized in that, The step of determining the disparity of the target object in the first image and the second image by performing feature detection and matching on the first detection box region and the second detection box region includes: Perform feature detection on the first detection box region to obtain the first feature point; Within the second detection box area, feature matching is performed on the first feature point to obtain a second feature point that matches the first feature point; The disparity of the target object in the first image and the second image is calculated based on the x-coordinates of the first feature point and the second feature point.
4. The method according to claim 1, characterized in that, The camera parameters include focal length and baseline distance. Determining the distance between the drone and the target object based on the parallax and camera parameters includes: The distance between the UAV and the target object is calculated based on the parallax, the focal length, and the baseline distance.
5. The method according to claim 1, characterized in that, The camera parameters include focal length and number of pixels. Determining the size of the target object based on the size of the target detection bounding box and the camera parameters includes: Calculate the actual size of each pixel based on the size of the target detection box, the focal length, and the number of pixels; The size of the target object is calculated based on the size of the target detection box and the actual size corresponding to each pixel.
6. The method according to claim 1, characterized in that, The acquisition of a first image and a second image of the target object includes: Obtain the first initial image and the second initial image; Obtain the first camera parameters corresponding to the first initial image and the second camera parameters corresponding to the second initial image; Based on the first camera parameters and the second camera parameters, the first initial image and the second initial image are aligned to a common coordinate system to obtain the first image and the second image.
7. A device for determining the size of an object, characterized in that, include: The acquisition module is used to acquire a first image and a second image of the target object, wherein the first image is an image taken by the drone at a first position, and the second image is an image taken by the drone at a second position; The detection module is used to perform target detection on the first image to obtain a first detection box region corresponding to the target object; and to perform target detection on the second image to obtain a second detection box region corresponding to the target object. The first determining module is used to determine the disparity of the target object in the first image and the second image based on feature detection and matching of the first detection box region and the second detection box region; The second determining module is used to determine the distance between the UAV and the target object based on the parallax and camera parameters; The third determining module is used to determine the size of the target object based on the size of the target detection box and the camera parameters, wherein the target detection box is the detection box corresponding to the first detection box region or the detection box corresponding to the second detection box region.
8. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to execute instructions to implement the steps of the method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-6.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1-6.