Research on Visual Positioning of Drones with Matlab Code

✅ Author Profile: A Matlab simulation developer passionate about scientific research, skilled in data processing, modeling simulation, program design, complete code acquisition, paper reproduction, and scientific simulation.

🍎 Previous reviews, follow the personal homepage:Matlab Research Studio

🍊 Personal motto: Investigate things to gain knowledge, complete Matlab code and simulation consultation content via private message.

🔥 Content Introduction

With the rapid development of drone technology, positioning accuracy directly determines its operational capabilities — from precise spraying in agricultural plant protection, equipment positioning in power inspections, to targeted delivery in logistics and target search in emergency rescue, all rely on a reliable positioning system. Traditional drone positioning often depends on Global Navigation Satellite Systems (GNSS, such as GPS, Beidou), but in scenarios where GNSS signals are weak or fail, such as indoors, urban high-rise occlusion areas, canyons, and underground mines, positioning accuracy can significantly decrease or even completely fail.Drone visual positioning technology obtains environmental image information by equipping cameras (monocular, binocular, RGB-D, etc.) and combines computer vision algorithms to estimate its own position and orientation (Pose), offering advantages oflow cost, no signal dependency, and high environmental adaptability, effectively compensating for the shortcomings of GNSS positioning and becoming a core supporting technology for drones operating in complex scenarios. Its core research value lies in solving the problem of “precise positioning in environments without satellite signals,” expanding the operational range of drones; reducing dependence on expensive navigation equipment (such as inertial navigation systems) to control hardware costs; and providing a positioning foundation for advanced functions such as multi-drone collaboration and autonomous obstacle avoidance.

II. Technical Principles and Classification of Drone Visual Positioning

The essence of drone visual positioning is to infer the spatial position of the drone by analyzing the “relationship between environmental features and the drone.” Based on differences in image input methods, feature extraction logic, and algorithm frameworks, mainstream technologies can be divided into three categories: monocular vision-based positioning, binocular/RGB-D vision-based positioning, and visual-inertial odometry (VIO) based positioning.

2.1 Monocular Vision-Based Positioning

Monocular vision positioning requires only one camera, achieving positioning through a sequence of continuously captured images, resulting in the lowest hardware cost, but it has an inherent problem of “scale uncertainty” (unable to directly obtain 3D distance information from 2D images), which needs to be resolved through additional constraints (such as known environmental scale or motion patterns).

2.1.1 Core Principles

Based on the idea of “Structure from Motion (SfM):”

  1. Feature extraction and matching: Extract key features (such as SIFT, ORB, SURF, etc.) from adjacent frame images and find corresponding environmental points between frames through feature matching;
  1. Essential matrix/fundamental matrix estimation: Using matched feature point pairs, calculate the essential matrix (considering camera intrinsic parameters) or fundamental matrix (not considering camera intrinsic parameters) between frames, and decompose to obtain the relative motion of the drone (rotation matrix R and translation vector t);
  1. Scale determination and position accumulation: Determine the scale of the translation vector through “known scene scale (such as preset marker size)” or “multi-frame motion constraints (such as constant speed motion assumption),” and then accumulate the inter-frame motion to obtain the absolute position of the drone.

2.1.2 Typical Algorithms and Applicable Scenarios

  • Monocular Visual Odometry (MVO): Only uses adjacent frame images to calculate relative motion, and the positioning result will drift over time due to error accumulation, suitable for “short time, small range” operations (such as indoor short-distance inspections);
  • Monocular SLAM (Simultaneous Localization and Mapping): Constructs a three-dimensional map of the environment while positioning, correcting accumulated errors through “loop closure detection,” improving positioning accuracy for long-duration operations, suitable for exploring unknown indoor environments (such as underground mine inspections).

2.2 Binocular/RGB-D Vision-Based Positioning

Binocular vision obtains disparity images through two cameras fixed at a distance (simulating human eyes), while RGB-D cameras (such as Kinect) directly obtain depth information (i.e., 3D coordinates) for each pixel in the image through infrared or structured light technology, both of which can directly solve the “scale uncertainty” problem, with positioning accuracy higher than monocular vision.

Research on Visual Positioning of Drones with Matlab CodeResearch on Visual Positioning of Drones with Matlab CodeResearch on Visual Positioning of Drones with Matlab Code

III. Key Technical Challenges and Solutions

Drone visual positioning faces three core challenges in practical applications: “poor environmental adaptability,” “insufficient real-time performance,” and “error accumulation,” which need to be overcome through algorithm optimization and engineering practice.

3.1 Environmental Adaptability: Addressing Feature Extraction Challenges in Complex Scenes

In “sparse feature scenes (such as snowy areas, plain color walls),” traditional feature points (such as ORB) are difficult to extract, leading to frame matching failures; in “dynamic scenes (such as busy streets, traffic),” moving target feature points may be misidentified as static environmental features, introducing positioning errors.

Solution Strategies:

  1. Multi-feature fusion extraction: Combine local feature points (ORB) with global features (such as SuperPoint, D2-Net) to enhance matching rates in sparse feature scenes through global features; introduce semantic segmentation (such as Mask R-CNN) to identify dynamic targets, filtering out dynamic feature points in the image and retaining only static environmental features for positioning;
  1. Adaptive feature threshold adjustment: Dynamically adjust feature extraction thresholds based on the texture complexity of the image (e.g., lowering the threshold to extract more weak features when the texture is sparse, raising the threshold to reduce redundant calculations when the texture is dense);
  1. Scene transfer learning: Train a “universal scene feature extraction model” (such as a vision feature network based on Transformer) through deep learning to enhance feature extraction capabilities in unfamiliar scenes (such as deserts, rainforests).

3.2 Real-time Performance: Balancing Accuracy and Computational Power

Visual positioning involves complex computations such as feature extraction, point cloud registration, and fusion filtering, while the embedded platforms of drones (such as NVIDIA Jetson Nano, Qualcomm Snapdragon Flight) have limited computational power. If the algorithm’s complexity is too high, it may lead to positioning delays (e.g., delays exceeding 100ms), affecting the control stability of the drone.

Solution Strategies:

  1. Algorithm lightweighting: Use lightweight feature extraction algorithms (such as FAST corner detection instead of SIFT, a lightweight version of ORB-SLAM3) to reduce computational load; reduce the number of points for matching and optimization through “feature point downsampling” (such as uniform sampling, adaptive sampling);
  1. Hardware acceleration: Utilize hardware acceleration modules of embedded platforms (such as GPU, FPGA) to handle highly parallel tasks like feature extraction and matrix operations. For example, on the Jetson platform, use CUDA to accelerate ORB feature matching, reducing single-frame processing time from 50ms to under 10ms;
  1. Priority-based computation: Divide positioning tasks into “real-time core tasks (such as inter-frame relative motion estimation, high priority)” and “offline optimization tasks (such as loop detection, map updates, low priority)” to ensure real-time output of core positioning results, with offline tasks executed during idle computational power.

3.3 Error Accumulation: Correcting Drift Issues in Long-duration Operations

Whether monocular, binocular, or VIO positioning, positioning results will drift over time due to factors such as “feature matching errors,” “IMU measurement noise,” and “computational approximations” (e.g., drift of several meters after one hour of operation), affecting the accuracy of long-duration operations (such as all-day power inspections).

Solution Strategies:

  1. Loop detection and global optimization: Add a loop detection module (such as based on bag-of-words model BoW, appearance consistency detection) in the SLAM framework. When the drone re-enters an explored area, discover loops through “feature matching between the current frame and historical frames” and use loop constraints to correct historical positioning errors, achieving globally consistent positioning;
  1. Environmental prior map fusion: If the operational area has a preset high-precision map (such as a point cloud map constructed by LiDAR, satellite image map), the visual positioning results can be matched with the prior map (such as based on image features and map point registration) to directly correct drift, suitable for fixed area operations (such as factory inspections, airport bird control);
  1. Multi-sensor collaboration: In addition to IMU, fuse other low-cost sensors such as LiDAR and ultrasonic sensors — LiDAR can provide high-precision point clouds to compensate for visual shortcomings in low-light scenes; ultrasonic sensors can be used for height positioning at close range (such as indoor wall-following flights), further enhancing error correction capabilities.

IV. Typical Application Scenarios and Practical Cases

Drone visual positioning technology has been applied in various fields, and its scenario design needs to comprehensively optimize based on “environmental features, accuracy requirements, and hardware costs.”

4.1 Indoor Logistics Delivery: Practice of RGB-D Vision Positioning

In indoor scenes such as e-commerce warehouses and large shopping malls, GNSS signals are completely unavailable, and the environment contains many static features (such as shelves, wall signs), making RGB-D vision positioning suitable.

Case: JD Indoor Delivery Drone

  • Hardware Configuration: Equipped with Intel RealSense D435 RGB-D camera (depth range 0.1m~10m), low-cost IMU (MPU6050);
  • Positioning Scheme: Construct a three-dimensional point cloud map of the warehouse based on RGB-D SLAM, calculate the relative position of the drone through point cloud registration (ICP algorithm), and achieve VIO fusion positioning with IMU;
  • Accuracy and Effect: Positioning accuracy reaches ±5cm, enabling autonomous navigation from “shelf to sorting station,” improving delivery efficiency by 30% compared to manual operations, and eliminating the need for auxiliary positioning facilities such as tracks or QR codes, reducing renovation costs.

4.2 Underground Mine Inspection: Scene Adaptation of Monocular SLAM

The underground mine environment is dark, dusty, and narrow, with no GNSS signals, making traditional positioning difficult; fixed features such as tracks, supports, and equipment exist within the mine, allowing positioning through monocular SLAM combined with an illumination system.

Case: China Coal Group Mine Inspection Drone

  • Hardware Configuration: Monocular wide-angle camera (120° field of view, suitable for narrow spaces), explosion-proof casing, LED supplementary light;
  • Positioning Scheme: To address image blurriness caused by dust in the mine, use “image dehazing algorithms (such as dark channel prior)” to preprocess images; based on the ORB-SLAM2 framework, use track seams and support numbers in the mine as key features, correcting drift through loop detection;
  • Accuracy and Effect: Positioning accuracy reaches ±10cm, autonomously completing tasks such as “mine tunnel inspection, gas sensor positioning, and water accumulation point detection,” replacing manual inspections (original manual inspection of 1km tunnel takes 2 hours, while the drone only takes 15 minutes), reducing safety risks.

4.3 Urban Emergency Rescue: Anti-interference Design of Visual-Inertial Fusion

In urban emergency rescues (such as post-earthquake rubble search and high-rise fire rescue), drones need to position themselves in complex environments with “high-rise occlusion and building rubble,” and face interference factors such as smoke and shaking, relying on VIO fusion positioning.

Case: DJI M300 RTK Rescue Drone

  • Hardware Configuration: Binocular camera + IMU (tightly coupled VIO system), infrared thermal imaging camera;
  • Positioning Scheme: In GNSS failure areas, maintain positioning through the VIO system, using the disparity calculation of the binocular camera and the short-term stability of the IMU to resist visual feature loss caused by smoke; combine infrared image recognition of trapped individuals, integrating the visual positioning “drone position” with the “trapped individuals’ image coordinates” to infer their absolute position;
  • Accuracy and Effect: In GNSS failure scenarios, positioning accuracy reaches ±20cm, allowing precise hovering in rubble to provide rescue personnel with “individual location coordinates,” shortening search and rescue time.

V. Research Trends and Future Challenges

With the development of computer vision, artificial intelligence, and chip technology, drone visual positioning is evolving towards “higher accuracy, stronger robustness, and lower cost,” while also facing new challenges.

5.1 Core Research Trends

  1. End-to-end positioning based on deep learning: Traditional positioning relies on a step-by-step process of “feature extraction – matching – optimization,” while deep learning can directly output the drone’s pose from images through convolutional neural networks (CNN) and Transformers (such as PoseNet, DPT-Net), simplifying the process and enhancing robustness in complex scenes; future models will combine “multi-modal inputs (RGB + infrared + depth)” to further improve environmental adaptability.
  1. Multi-drone collaborative visual positioning: The positioning range of a single drone is limited; multiple drones can achieve larger-scale collaborative positioning through “shared visual maps and mutual observation” — for example, a local map constructed by drone A can be shared with drone B to help B quickly position in sparse feature areas; through “relative pose estimation between drones” (such as based on images captured by adjacent drones), achieve precise coordination in multi-drone formation flying.
  1. Low power consumption and edge computing integration: For consumer-grade drones (such as DJI Mini series) with low computational power requirements, future developments will achieve real-time operation of lightweight visual positioning algorithms through “edge computing chips (such as Ascend AI chips, TensorRT acceleration),” ensuring positioning accuracy while controlling power consumption and further reducing hardware costs.

5.2 Future Challenges

  1. Extreme environmental adaptability: In extreme weather conditions (such as heavy rain, fog, strong light like direct sunlight at noon), image quality severely deteriorates, and existing visual algorithms may fail, necessitating research on “extreme weather image enhancement algorithms” and “robust feature extraction models”;
  1. Real-time response in dynamic environments: In rapidly moving scenes (such as drones tracking dynamic targets), the delay in traditional inter-frame matching may lead to positioning lag, requiring optimization of “dynamic feature exclusion” and “fast motion estimation” algorithms to enhance real-time performance;
  1. Deep coupling of positioning and control: Current visual positioning and drone control often follow a “positioning output → control input” unidirectional process; future designs need to achieve an integrated approach of “positioning – control – obstacle avoidance,” allowing positioning algorithms to directly provide optimization targets for control commands (such as dynamically adjusting flight speed based on positioning errors), enhancing overall operational efficiency.

VI. Conclusion

Drone visual positioning technology solves the positioning challenges in GNSS failure scenarios by “inferring spatial position from image information” and has become a key technological support for drones transitioning from “outdoor open scenes” to “indoor complex scenes.” From low-cost monocular adaptations, precise scaling of binoculars, to anti-interference fusion of VIO, different technical paths have been validated in logistics, mining, rescue, and other scenarios, demonstrating broad application prospects.

Future research needs to focus on breakthroughs in three major directions: “robustness in extreme environments, real-time performance in dynamic scenes, and multi-sensor collaboration,” while promoting the “integration of deep learning with traditional visual algorithms” and “integrated design of positioning and control,” enabling drones to achieve “autonomous, precise, and safe” operations in more complex environments, providing technical support for the intelligent upgrade of various industries.

⛳️ Operation Results

Research on Visual Positioning of Drones with Matlab CodeResearch on Visual Positioning of Drones with Matlab Code

🔗 References

[1] Rong Hui, Li Dong, Yin Tangchun. Research on the Simulation Analysis of UAV Mathematical Model Based on Matlab[J]. Science Technology and Engineering, 2008, 8(6):4. DOI:10.3969/j.issn.1671-1815.2008.06.029.

[2] Song Wei. Research on Hardware-in-the-Loop Simulation Technology of UAV Based on MATLAB[J]. Nanjing University of Aeronautics and Astronautics, 2008. DOI:10.7666/d.d053355.

[3] Wang Yicheng, Hu Yanlin, Chen Yongming. Design Research of Real-time Simulation System for Small UAV — Based on MATLAB Environment[J]. Modern Business Industry, 2010(1):1. DOI:10.3969/j.issn.1672-3198.2010.01.178.

📣 Partial Code

🎈 Some theoretical references are from online literature; if there is any infringement, please contact the author for deletion.

👇 Follow me to receive a wealth of Matlab e-books and mathematical modeling materials

🏆 The team specializes in guiding customized Matlab simulations in various research fields, helping to realize research dreams:

🌈 Various intelligent optimization algorithm improvements and applications

Production scheduling, economic scheduling, assembly line scheduling, charging optimization, workshop scheduling, departure optimization, reservoir scheduling, three-dimensional packing, logistics site selection, cargo position optimization, bus scheduling optimization, charging pile layout optimization, workshop layout optimization, container ship loading optimization, pump combination optimization, medical resource allocation optimization, facility layout optimization, visual domain base station and drone site selection optimization, knapsack problem, wind farm layout, time slot allocation optimization, optimal distribution of distributed generation units, multi-stage pipeline maintenance, factory-center-demand point three-level site selection problem, emergency life material distribution center site selection, base station site selection, road lamp post layout, hub node deployment, transmission line typhoon monitoring devices, container scheduling, unit optimization, investment optimization portfolio, cloud server combination optimization, antenna linear array distribution optimization, CVRP problem, VRPPD problem, multi-center VRP problem, multi-layer network VRP problem, multi-center multi-vehicle VRP problem, dynamic VRP problem, two-layer vehicle routing problem (2E-VRP), electric vehicle routing problem (EVRP), hybrid vehicle routing problem, mixed flow shop problem, order splitting scheduling problem, bus scheduling optimization problem, flight shuttle vehicle scheduling problem, site selection path planning problem, port scheduling, port bridge scheduling, parking space allocation, airport flight scheduling, leak source localization

🌈 Machine learning and deep learning time series, regression, classification, clustering, and dimensionality reduction

2.1 BP time series, regression prediction, and classification

2.2 ENS voice neural network time series, regression prediction, and classification

2.3 SVM/CNN-SVM/LSSVM/RVM support vector machine series time series, regression prediction, and classification

2.4 CNN|TCN|GCN convolutional neural network series time series, regression prediction, and classification

2.5 ELM/KELM/RELM/DELM extreme learning machine series time series, regression prediction, and classification
2.6 GRU/Bi-GRU/CNN-GRU/CNN-BiGRU gated neural network time series, regression prediction, and classification

2.7 Elman recurrent neural network time series, regression prediction, and classification

2.8 LSTM/BiLSTM/CNN-LSTM/CNN-BiLSTM long short-term memory neural network series time series, regression prediction, and classification

2.9 RBF radial basis function neural network time series, regression prediction, and classification

2.10 DBN deep belief network time series, regression prediction, and classification
2.11 FNN fuzzy neural network time series, regression prediction
2.12 RF random forest time series, regression prediction, and classification
2.13 BLS broad learning system time series, regression prediction, and classification
2.14 PNN pulse neural network classification
2.15 Fuzzy wavelet neural network prediction and classification
2.16 Time series, regression prediction, and classification
2.17 Time series, regression prediction, and classification
2.18 XGBOOST ensemble learning time series, regression prediction, and classification
2.19 Transform various combinations time series, regression prediction, and classification
Directions cover wind power prediction, photovoltaic prediction, battery life prediction, radiation source identification, traffic flow prediction, load forecasting, stock price prediction, PM2.5 concentration prediction, battery health status prediction, electricity consumption prediction, water body optical parameter inversion, NLOS signal identification, precise prediction of subway stops, transformer fault diagnosis

🌈 Image processing aspects

Image recognition, image segmentation, image detection, image hiding, image registration, image stitching, image fusion, image enhancement, image compressed sensing

🌈 Path planning aspects

Traveling salesman problem (TSP), vehicle routing problem (VRP, MVRP, CVRP, VRPTW, etc.), drone three-dimensional path planning, drone collaboration, drone formation, robot path planning, grid map path planning, multimodal transport problems, electric vehicle routing planning (EVRP), two-layer vehicle routing planning (2E-VRP), hybrid vehicle routing planning, ship trajectory planning, full path planning, warehouse patrol

🌈 Drone application aspects

Drone path planning, drone control, drone formation, drone collaboration, drone task allocation, drone secure communication trajectory online optimization, vehicle collaborative drone path planning

🌈 Communication aspects

Sensor deployment optimization, communication protocol optimization, routing optimization, target positioning optimization, Dv-Hop positioning optimization, Leach protocol optimization, WSN coverage optimization, multicast optimization, RSSI positioning optimization, underwater communication, communication upload and download allocation

🌈 Signal processing aspects

Signal recognition, signal encryption, signal denoising, signal enhancement, radar signal processing, signal watermark embedding and extraction, electromyography signals, electroencephalography signals, signal timing optimization, electrocardiogram signals, DOA estimation, encoding and decoding, variational mode decomposition, pipeline leakage, filters, digital signal processing + transmission + analysis + denoising, digital signal modulation, bit error rate, signal estimation, DTMF, signal detection

🌈 Power system aspects

Microgrid optimization, reactive power optimization, distribution network reconstruction, energy storage configuration, orderly charging, MPPT optimization, household electricity

🌈 Cellular automata aspects

Traffic flow, crowd evacuation, virus spread, crystal growth, metal corrosion

🌈 Radar aspects

Kalman filter tracking, trajectory association, trajectory fusion, SOC estimation, array optimization, NLOS identification

🌈 Workshop scheduling

Zero-wait flow shop scheduling problem NWFSP , Permutation flow shop scheduling problem PFSP , Hybrid flow shop scheduling problem HFSP , zero idle flow shop scheduling problem NIFSP, distributed permutation flow shop scheduling problem DPFSP, blocking flow shop scheduling problem BFSP

👇

Leave a Comment