# Robust Backstepping Control Applied to UAVs for Pest Recognition in Maize Crops
## 6 Detection of Pest in Corn Leaves
### Image Processing  
In computer vision, segmentation processes are of vital importance when it comes to detecting objects in unstructured environments.  
The application process of the segmentation method starts with the images of the corn fields (Figure 15) where the dry leaves of the plants are detected, as this is a symptom that the plant could be ill. For this purpose, first, based on the photograph, the pixels of interest are selected to find the thresholds. Once the pixel values are obtained, a new image is loaded to search for dry leaves in the field.  
Figure 16 shows the processed image using different segmentation methods where the dry leaves of the plant are highlighted. It should be mentioned that in the processed image, the areas that are not of interest are colored in black. For the RGB segmentation method, the threshold values are as follows: R \(>\) 126, G \(>\) 104, B \(<\) 80. As for the HSV method, the ranges are as follows: 0.096 \(<\) H \(<\) 0.153, 0.243 \(<\) S \(<\) 0.944, 0.222 \(<\) V \(<\) 0.944. In the YCbCr method, the following values are obtained: 70 \(<\) Y \(<\) 225, 72 \(<\) Cb \(<\) 109, 136 \(<\) Cr \(<\) 163. Finally, from the application of the CIE-Lab segmentation, the values are as follows: 38.49 \(<\) L \(<\) 100, \(-\)10.353 \(<\) a \(<\) 19.622, 19.622 \(<\) b \(<\) 55.531.  
Figure 14: Scheme for the application of segmentation.  
With the obtained thresholds, from the segmentation methods, a MATLAB code runs to analyze the images obtained from the flights made over the corn fields. First, an image is selected and then subjected to the thresholds of each method to identify dry leaves in the field.  
Figure 17 displays the segmented images using the RGB, HSV, YCbCr and CIE-Lab methods. From the images obtained after applying the segmentation methods with the thresholds proposed in the previous section, it can be seen that using RGB segmentation to detect dry leaves is not very convenient as only some points were highlighted, while in the HSV segmentation method, a greater detection of dry leaves can be noted in the image of the crop; however, these highlighted points look like brush strokes, and the plant is not well distinguished. In the YCbCr segmentation, the dry leaves can be better identified in the plot; however, when it is compared with the original image, there are parts of the dry leaves of the plant that despite being dry, do not appear in the processed image. Finally, the  
Figure 16: Segmentation methods with thresholds.  
Figure 15: Image captured by the camera.  
best detection is obtained when the CIE-Lab segmentation method is applied to the image, although it also detects a little of the soil, which does not represent a relevant issue.  
The robustness provided to the proposed controller is necessary to improve the closed loop performance of the vehicle in outdoor environment. This improved performance is a crucial issue to the image capturing while the trajectory tracking task is executed by the UAV, allowing reduce distorted capture of the crops. In fact, when a PD controller is used to control the vehicle in order to capture the crop images, from ten experiments only six were satisfactory to stabilize the drone with the mounted camera. In contrast, for the robust backstepping control approach, all the tests were satisfactory, despite a gimbal or extra software not being used.  
Furthermore, each processed image has an \((x,y)\) coordinate, which is obtained with the real-time clock (Time stamp' function) of the Pixhawk autopilot. Then, when an image with affected leaves is detected, the user obtains the relative position \((x,y)\) of the chosen reference frame, and then the user can apply a corrective action, programming a trajectory whose final point corresponds to these coordinates.