*Article* **3D Locating System for Pests' Laser Control Based on Multi-Constraint Stereo Matching**

**Yajun Li 1,2, Qingchun Feng 2,\*, Jiewen Lin 3, Zhengfang Hu 1, Xiangming Lei <sup>1</sup> and Yang Xiang 1,\***


**Abstract:** To achieve pest elimination on leaves with laser power, it is essential to locate the laser strike point on the pest accurately. In this paper, *Pieris rapae* (L.) (Lepidoptera: Pieridae), similar in color to the host plant, was taken as the object and the method for identifying and locating the target point was researched. A binocular camera unit with an optical filter of 850 nm wavelength was designed to capture the pest image. The segmentation of the pests' pixel area was performed based on Mask R-CNN. The laser strike points were located by extracting the skeleton through an improved ZS thinning algorithm. To obtain the 3D coordinates of the target point precisely, a multi-constrained matching method was adopted on the stereo rectification images and the subpixel target points in the images on the left and right were optimally matched through fitting the optimal parallax value. As the results of the field test showed, the average precision of the ResNet50-based Mask R-CNN was 94.24%. The maximum errors in the *X*-axis, the *Y*-axis, and the *Z*-axis were 0.98, 0.68, and 1.16 mm, respectively, when the working depth ranged between 400 and 600 mm. The research was supposed to provide technical support for robotic pest control in vegetables.

**Keywords:** robotic pest control; Mask R-CNN; skeleton extraction; binocular vision; stereo matching
