In the process of target matching and localization using unmanned aerial vehicles (UAVs), challenges arise due to rotation variations, illumination changes and the limited size of images captured from the UAV perspective, leading to ineffective feature extraction. This paper presents a target image matching algorithm based on the HardNet network, which decomposes the matching problem into two stages. In the object block detection phase, the selective search algorithm is used to detect objects in the image effectively using color and contour information, especially for the extraction of small targets. In the matching phase, the HardNet network is used to extract features from the detected object blocks, effectively overcoming nonlinear variations in angle and size to improve object feature extraction. Finally, the algorithm uses similarity metrics for image matching. The experimental results show that the proposed algorithm achieves higher near-field matching accuracy when tested on image datasets, outperforming the traditional SURF and SIFT algorithms by 8–11.0%. In addition, the algorithm demonstrates increased match detection rates and robustness in scenarios involving changes in image angle, illumination and size. This research provides a viable and effective approach to UAV target localization, particularly in scenarios involving close proximity and varying environmental conditions.