Lightweight segmentation of UAV images for early detection of maize leaf diseases. Arnaud S. R. M. Ahouandjinou2†, Ambroise D. K. Houedjissin1*†, Manhougbé Probus A. F. KIKI1†, François Xavier Amétépé2†, and Kokou M. Assogba1† 1 Doctoral School of Engineering Science, University of Abomey-Calavi, Abomey-Calavi, Benin 2 Institute of Training and Research in Computer Science, University of Abomey-Calavi, Abomey-Calavi, Benin Abstract Unmanned Aerial Vehicles (UAVs) equiped with RGB cameras have emerged as effective tools for monitoring agricultural crops. However, motion blur in UAV images can affect the accuracy of subsequent image analysis tasks, such as disease detection in plant leaves. This study proposes a real-time image segmentation approach for analyzing UAV-captured maize leaf images. The algorithm evaluates image blur using the Laplacian variance, applies an adaptive Wiener filter for deblurring, segments maize leaves from the background using color transformations, and identifies diseased regions through Canny edge and contour detection. Experimental results demonstrate the lightweight and effectiveness of proposed approach with less than 1s runtime, improving image quality and allowing accurate disease detection of maize crops for real-time purpose. Keywords UAV, RGB images, motion blur, maize diseases detection, segmentation. 1. Introduction Plant disease detection is a key application of UAVs and has been extensively researched [1]. One of the advantages of using UAVs is its ability to detect diseases early and prevent their spread, thereby reducing crop losses [2]. Decision-support systems that incorporate UAVs can lead to better decision- making, increased production, improved product quality, and labor savings [3]. UAVs are utilized across various crop types and for detecting multiple diseases. Some diseases present visible symptoms, while others require temperature measurements for detection [4]. Early detection of pests and crop diseases provides farmers and other stakeholders with enough time to prevent potential epidemics and minimize yield losses. However, motion blur in UAV images generally caused by the camera movement during image capture, the combined effects of atmospheric turbulence, the shaking of the UAV platforms, high altitude or operation errors can affect the accuracy of subsequent image analysis tasks, such as disease detection in crop plant leaves [5]. This represents a common issue in UAV imagery and various methods have been proposed to address motion blur. On the other hand, recent advancements in deep learning (DL) have produced various methods for detecting and classifying plant diseases using images of infected plants [6]. However, they require huge datasets for advanced approaches such as CNN to produce good results and large image datasets result in increased accuracy rates [7]. Procedings of the DAAfrica’2024 workshop *Ambroise HOUEDJISSIN † These authors contributed equally. arnaud.ahouandjinou@imsp-uac.org (A. S. R. M. Ahouandjinou); abhouedjissin@gmail.com(A. D. K. Houedjissin); kprobus2005@gmail.com (M. P. A. F. Kiki); adote007@gmail.com (F. X. Amétépé); mkokouassogba@gmail.com (K. M. Assogba) 0000-0001-7217-5588 (A. S. R. M. Ahouandjinou); 0009-0003-1880-7283 (A. D. K. Houedjissin); 0009-0009-0070-8707 (M. P. A. F. Kiki); 0000-0002-5275-8150 (F. X. Amétépé); 0009-0004-6328-0799 (K. M. Assogba) © 2025 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop ceur-ws.org ISSN 1613-0073 13 Proceedings This study presents a real-time algorithm for the segmentation of UAV images, specifically targeting the detection of maize plant leaf diseases. The proposed method leverages motion blur detection, adaptive Wiener filtering, color conversion combined with morphological operations, Canny edge detection, Otsu color thresholding and contour area detection so that to isolate infected regions. The results demonstrate the algorithm's efficacy in identifying unhealthy plant areas in less than 1 second runtime, thereby providing a robust tool for precision agriculture in real-time. The rest of the paper is organized as follows: in section 2, we present the related works, section 3 outlines the proposed approach, the experimentation is introduced in section 4 and results and discussion are presented in section 5. Finally, section 6 provides a conclusion. 2. Related works Successful disease estimation has been demonstrated in many UAV-based imagery applications such as [8], [9], [10]. These studies often used either the mean value of the vegetation index or the count of pixels below a certain threshold within a plot to estimate the disease score. Table 1 gives a synthetic comparative analysis of classical image classification techniques in plant leaves healthy and unhealthy area detection. Table 1 Comparison of classical image classification techniques Classification Techniques Description Advantages Limits References Color Compares the distribution of - Simple to implement - Limited discriminative [1] thresholding colors in an image using a - Fast computation power threshold. - Sensitive to changes in lighting conditions Texture Analyzing textural patterns in - Captures subtle - Parameter tuning [2] Analysis an image to characterize differences in texture required healthy and unhealthy areas. - Robust against - May be changes in lighting and computationally color intensive Machine Utilizing machine learning - High accuracy and - Requires large amounts [3] Learning algorithms (e.g., SVM, robustness of labeled data Models Random Forest, CNN) to learn - Can automatically - Training and inference features and classify healthy learn complex patterns can be computationally and unhealthy areas. costly According to Table 1 the choice of classification algorithm depends on various factors, including the desired level of accuracy, computational resources, and the availability of labeled data. Color thresholding is simple and efficient but may lack the discriminative power of more complex methods like texture analysis and machine learning models. Texture analysis can capture subtle differences in texture but may require more computational resources. Machine learning models offer high accuracy but come with higher complexity and resource requirements, especially during training. 3. Proposed Approach Figure 1 describes the proposed approach. 14 Figure 1: Scheme of the proposed method. The proposed algorithm involves several key steps and each step is based on specific mathematical operations and image processing techniques to ensure accurate segmentation and detection. 3.1. UAV Image Acquisition from field First, UAVs equipped with high-resolution RGB cameras capture images of maize fields. The UAV images were collected between 4:45 p.m. and 6:00 p.m., on July 14, 2024, whereas it was sunny and windless. The DJI Mini 3 Pro, a quadcopter UAV system, was used to collect aerial images of maize leaves from a field. This system carried an automated RGB sensor (Quad Bayer CMOS camera) which was developed for agricultural applications. 3.1.1. Image Preprocessing The second step in the algorithm involves preprocessing the UAV-captured images to enhance their quality and reduce noise. This is crucial for improving the accuracy of subsequent image analysis steps. 1. Motion Blur Detection and Assessing: the Laplacian variance [14] is used to detect motion blur. When detected, an adaptive Wiener filter is applied to deblur the images. To assess the degree of motion blur in the UAV images, we calculate the Laplacian variance of the grayscale image: 𝐿𝑎𝑝𝑙𝑎𝑐𝑖𝑎𝑛(𝐼) = ∑ , + (1) 𝑉𝑎𝑟𝑖𝑎𝑛𝑐𝑒 = ∑ , (𝐿𝑎𝑝𝑙𝑎𝑐𝑖𝑎𝑛(𝑖, 𝑗) − 𝜇) (2) where I is the grayscale image, μ is the mean of the Laplacian image, and N is the total number of pixels. The variance provides a measure of image sharpness, with lower values indicating higher blur levels. 2. Image Deblurring by Adaptive Wiener Filter: if the image is found to be blurred, an adaptive Wiener filter is applied to reduce noise and enhance details. The Wiener filter operates as follows:  Normalize grayscale image: 𝐼 = . (3) 15  Create averaging kernel: 𝐾= 1 × (4)  Compute local mean and variance: 𝜇 = 𝑐𝑜𝑛𝑣𝑜𝑙𝑣𝑒2𝑑(𝐼 , 𝐾, ’𝑠𝑎𝑚𝑒’) (5)  Compute overall variance: 𝜎 = 𝑐𝑜𝑛𝑣𝑜𝑙𝑣𝑒2𝑑(𝐼 , 𝐾, ’𝑠𝑎𝑚𝑒’) − 𝜇 (6)  Apply Wiener filter 𝐼 = (𝐼 −𝜇 )⋅( )+𝜇 (7)  Denormalize: 𝐼 =𝐼 ⋅ 255 (8) 3.1.2. Image Segmentation The third step in the algorithm relates to segmentation which plays a crucial role in identifying regions of interest within UAV images, such as healthy and infected areas of maize plant leaves, for further analysis. 1. HSV Color Segmentation: the deblurred image is then converted to the HSV (Hue, Saturation, Value) color space to facilitate segmentation based on color characteristics [15]. The green color range corresponding to healthy maize leaves is defined in the HSV space, and a binary mask is created to isolate these regions: 1 𝑖𝑓 𝑟𝑎𝑛𝑔𝑒1 ≤ 𝐻𝑆𝑉(𝑥, 𝑦) ≤ 𝑟𝑎𝑛𝑔𝑒2 𝑀𝑎𝑠𝑘 = (9) 0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 where 𝑟𝑎𝑛𝑔𝑒1 and 𝑟𝑎𝑛𝑔𝑒2 define the HSV range for green color. Morphological operations, including opening and closing, are applied to the binary mask to remove noise and smooth the segmented regions. 𝑀𝑜𝑟𝑝ℎ𝑜𝑙𝑜𝑔𝑦(𝐼) = (𝐼 ⊙ 𝐾) ⊕ 𝐾 (10) where ⊙ denotes morphological opening and ⊕ denotes closing, and 𝐾 is the structuring element. 2. Division into Patch: the preprocessed image is divided into a specified number of equal-sized patches for localized analysis of disease symptoms. The number of patches here is 10. Calculate patch dimensions: ℎ = (11) ; 𝑤 = (12) where 𝐻 is the height and 𝑊 is the width of the patch 16 3. Cany Edge Detection: each patch undergoes further analysis to detect and classify objects of interest. The edges of potential diseased regions are detected using the Canny edge detection algorithm [16], which identifies boundaries based on gradients in the image: 1 𝑖𝑓 𝐺(𝑥, 𝑦) > 𝑡ℎ𝑟𝑒𝑠ℎ𝑜𝑙𝑑 𝐸𝑑𝑔𝑒𝑠(𝑥, 𝑦) = (13) 0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 where G(x,y) is the gradient magnitude at pixel (x,y). 3.1.3. Image Classification The detected edges are used to identify contours, which are then classified as healthy or unhealthy based on their area. A threshold is applied to differentiate between large healthy regions and smaller unhealthy spots. Contours are then extracted and classified based on their area, with larger areas typically indicating healthy regions and smaller areas potentially indicating diseased regions. Following equations explain the classification process: 𝐴𝑟𝑒𝑎 = ∑ ∑ 𝐼 (14) where 𝐼 is the pixel value within a contour. 𝐻𝑒𝑎𝑙𝑡ℎ𝑦 𝑖𝑓 𝐴𝑟𝑒𝑎 > 𝐴 𝐶𝑙𝑎𝑠𝑠𝑖𝑓𝑖𝑐𝑎𝑡𝑖𝑜𝑛 = (15) 𝑈𝑛ℎ𝑒𝑎𝑙𝑡ℎ𝑦 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 where 𝐴 is fixed here to 500. Below is the detailed algorithm: Algorithm 1: Lightweight Segmentation for maize leave disease detection Input: x,y, I(x, y), ctg(), clv(), avf(), rhsv(), sgr(), mo(), dpp(), ced(), fdc() --image of leaves Begin 1: Initialize Image Processing Output: Result -- Segmented and classified plant regions 2: I(x, y) ← ctg(I(x, y))) -- Convert the UAV image to a grayscale image 3: σ² ← clv(I(x, y)) -- Calculate the Laplacian variance to assess image sharpness 4: if σ² < Threshold then 5: I(x, y) ← avf(I(x, y)) -- Apply the adaptive Wiener filter if Variance < threshold 6: end if 7: IHSV ← rhsv(I(x, y)) --Resize the image and convert it to the HSV color space 8: ILeaves ← sgr(IHSV) -- Segment green plant regions using predefined HSV ranges 9: Imo ←mo(IMorph--Apply morphological operations to enhance segmentation 10: Patch [ ] ← dpp(Imo) -- Divide the processed image into smaller patches 11: for each patch in Patch do 12: Edge [ ] ← ced(patch) -- Canny edge detection of each patch 13: Cntrs [ ] ← fdc(Edge [ ]) -- Classify detected edges based on health status 14: end For 4. Experimentation The characteristics of the UAV employed for the flight mission and the computer used for testing resulting aerial images are shown in Table 2 below. 4.1. Characteristics of UAV used for data acquisition The mini-sized, mega-capable DJI Mini 3 Pro is just as powerful as it is portable. Weighing less than 249 g and with upgraded safety features, it is not only regulation-friendly but also the safest in its series [17]. With a 1/1.3-inch sensor and top-tier features, it redefines what it means to fly Mini. Table 2 shows the specifications of the small UAV used for acquiring the images of the maize plants leaves used for constructing the dataset [18]. 17 Table 2 Characteristics of the DJI Mini 3 Pro used for experimentation Characteristics Specifications Model DJI Mini 3 Pro Weight Under 250g Camera 1/1.3" (0.77") 48MP f1.7 Quad Bayer CMOS Sensor Frame per second (fps) 4K 60 fps with HDR; 1080p 120fps Camera Orientation Horizontal and Fully Vertical camera orientations Sensors Obstacle Avoidance Sensors Flight Mode Intelligent Flight times Up to 47 minutes (with the optional larger batter) or 25- 30 minutes with the standard supplied batteries. Controller New Smart with 1080p 30fps Maximum flight speed 16 m/s Maximum flight height 4000m Maximum horizontal range 8KM 4.2. Experimentation site localization The images were accessed on 14 July 2024 and acquired on board the UAV, in the village of Dodji- Sèhè inside Sekou in the town of Allada, Benin Republic. Following Figure 2 and Figure 3 give additional details on the site of study. Figure 2 : Acquisition site localization, Figure 3 : Dodji-Sèhè village, Sékou District. Benin Republic Map. 4.3. Dataset The dataset consists of 266 images. When the images are captured in the state of stabilization of the device they are usually clear. On the other hand, the images captured during flight time are subject to motion blur. The selected images were in the JPG file format and 4032 x 3024 pixels (see Figure 4). (a) (b) (c) (d) (e) (f) (g) (h) Figure 4 : Example of UAV images of maize leaves from the dataset. Image from (a) to (d) appear to be sharp whereas those from (e) to (h) are motion-blurred. 18 5. Results and discussion 5.1. Preprocessing steps Below we present a sample of image from the dataset with preprocessing steps as follows: (a) (b) (c) Figure 5: (a) Original image, (b) Adaptive Wiener deblurred image of (a), (c) histogram of b Table 3 indicates the performances characteristics of the deblurred image. Table 3 Performances of the Adaptive Wiener Filter image deblurring step Image Quality Index Value Image Entropy 6.508706806116296 MSE 704.7281638886699 PSNR 19.65058732797596 SSIM 0.853058838351285 This deblurred image is characterized by an Entropy of 6,50; a Minimun Square Error of 704,72; a Peak Signal to Noise Ratio of 19,65 and a Structural Similarity Index Measure of 0,85, which indicates generation of an image of better quality. 5.2. HSV color segmentation We perform here plant leaves segmentation using color transformations based on HSV color space combined with morphological operations. Figure 7 shows the result of extracted maize leaves from background. Figure 6 : Original image of maize leaves. Figure 7 : Maize Leaves Extracted from background. We perform here plant leaves segmentation using color transformations based on HSV color space combined with morphological operations. Color transformations provides a reliable means to segment maize leaves from the background, a critical step for accurate disease detection. 5.3. Division into patches and Canny Edge Detection The preprocessed image is divided into a specified number of equal-sized patches for localized analysis of disease symptoms. The number of patches here is 10. Each patch undergoes Canny edge algorithm to detect objects of interest. Figure 8 shows the resulting image after this combined process. 19 (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) Figure 8 : Division into 10 patches and Canny Edge Detection. 5.4. Health classification Figure 9 below shows the health classification results generated for the 10 patches of the sample image used above. (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) Figure 9: Health classification results. For each pacth generated from a to j, note a = (Patch1and Res(Patch1)), j = (Patch10, Res(Patch10)) where Res(Patch1) is the result after Canny edge detetion and classification as healthy (green pixels) and unhealthy (red spots (non-green diseased areas) and double red contours for leaves damaged on edges. Table 4 below presents the runtime of the program for a previously clear image. Table 4 Performance Analysis of classification results of tested UAV maize leaves images. Performance criteria Value Runtime of the program 0.863659143447876 seconds According to Table 4, the classification results are otained in 0,86 second less than 1 second runtime, which ensures low computation performance of the proposed approach, crucial condition for real-time application and decision-making. The proposed approach addresses several key challenges in UAV-based crop monitoring. By evaluating and correcting image blur, we ensure that the subsequent segmentation and analysis steps are based on high-quality data. The use of adaptive Wiener filtering is particularly beneficial for real- time applications due to its efficiency and effectiveness in varying noise conditions. Color transformations provide a reliable means to segment maize leaves from the background, a critical step for accurate disease detection. The division of the image into patches allows for detailed localized analysis, making it possible to detect early signs of disease that might be missed in a full- 20 image analysis. Canny edge detection and color thresholding leverages both structural and color information, enhancing speed and robustness of disease detection in 0,86 second. 6. Conclusion This study presents a comprehensive real-time image processing algorithm for analyzing UAV- captured images of maize leaves. First, we leverage adaptive Wiener filtering to address image motion blur, then use color space transformation to segment maize leaves and finally patch-based analysis to detect diseased regions through a combination of edge detection and color analysis. The proposed method offers a promising solution for automated crop health monitoring, enabling timely interventions and improving agricultural productivity, forming a fast and effective tool for precision agriculture with less than 1 second. Future work will focus on optimizing the algorithm for different crop types and integrating it into a real-time UAV-based monitoring system. Acknowledgments This work was not supported by any funding. The first author would like to acknowledge individuals and groups that assisted in the research and the preparation of this work and is thankful to the Benin Ministry of Higher Education and Scientific Research. This Word template was created by Tiago Prince Sales (University of Twente, NL) in collaboration with Manfred Jeusfeld (University of Skövde, SE). It is derived from the template designed by Aleksandr Ometov (Tampere University of Applied Sciences, FI). The template is made available under a Creative Commons License Attribution-ShareAlike 4.0 International (CC BY-SA 4.0). Declaration on Generative AI The author(s) have not employed any Generative AI tools. References [1] F. Veroustraete, “The rise of the drones in agriculture,” EC agriculture, vol. 2, no. 2, pp. 325–327, 2015. [2] V. B. C. Calou, A. dos Santos Teixeira, L. C. J. Moreira, C. S. Lima, J. B. de Oliveira, and M. R. R. de Oliveira, “The use of UAVs in monitoring yellow sigatoka in banana,” biosystems engineering, vol. 193, pp. 115–125, 2020. [3] A. del-Campo-Sanchez et al., “Quantifying the effect of Jacobiasca lybica pest on vineyards with UAVs by combining geometric and computer vision techniques,” PLoS One, vol. 14, no. 4, p. e0215521, 2019. [4] C. H. W. de Souza, R. A. C. Lamparelli, J. V. Rocha, and P. S. G. Magalhães, “Mapping skips in sugarcane fields using object-based analysis of unmanned aerial vehicle (UAV) images,” Computers and Electronics in Agriculture, vol. 143, pp. 49–56, 2017. [5] Z. Zhan, X. Yang, Y. Li, and C. Pang, “Video deblurring via motion compensation and adaptive information fusion,” Neurocomputing, vol. 341, pp. 88–98, 2019. [6] S. V. Militante, B. D. Gerardo, and N. V. Dionisio, “Plant leaf detection and disease recognition using deep learning,” in 2019 IEEE Eurasia conference on IOT, communication and engineering (ECICE), IEEE, 2019, pp. 579–582. Accessed: Aug. 16, 2024. [Online]. Available: https://ieeexplore.ieee.org/abstract/document/8942686/ [7] S. Uchida, S. Ide, B. K. Iwana, and A. Zhu, “A further step to perfect accuracy by training CNN with larger data,” in 2016 15th International Conference on Frontiers in Handwriting Recognition (ICFHR), IEEE, 2016, pp. 405–410. Accessed: Aug. 16, 2024. [Online]. Available: https://ieeexplore.ieee.org/abstract/document/7814098/ 21 [8] S. Sarkar, A. F. Ramsey, A.-B. Cazenave, and M. Balota, “Peanut leaf wilting estimation from RGB color indices and logistic models,” Frontiers in plant science, vol. 12, p. 658621, 2021. [9] A. Guo et al., “Wheat yellow rust detection using UAV-based hyperspectral technology,” Remote Sensing, vol. 13, no. 1, p. 123, 2021. [10] A. Patrick, S. Pelham, A. Culbreath, C. C. Holbrook, I. J. De Godoy, and C. Li, “High throughput phenotyping of tomato spot wilt disease in peanuts using unmanned aerial systems and multispectral imaging,” IEEE Instrumentation & Measurement Magazine, vol. 20, no. 3, pp. 4– 12, 2017. [11] M. J. Swain and D. H. Ballard, “Color indexing,” Int J Comput Vision, vol. 7, no. 1, pp. 11–32, Nov. 1991, doi: 10.1007/BF00130487. [12] R. M. Haralick, K. Shanmugam, and I. H. Dinstein, “Textural features for image classification,” IEEE Transactions on systems, man, and cybernetics, no. 6, pp. 610–621, 1973. [13] A. Krizhevsky, I. Sutskever, and G. E. Hinton, “ImageNet classification with deep convolutional neural networks,” Commun. ACM, vol. 60, no. 6, pp. 84–90, May 2017, doi: 10.1145/3065386. [14] R. Bansal, G. Raj, and T. Choudhury, “Blur image detection using Laplacian operator and Open- CV,” in 2016 International Conference System Modeling & Advancement in Research Trends (SMART), IEEE, 2016, pp. 63–67. Accessed: Aug. 17, 2024. [Online]. Available: https://ieeexplore.ieee.org/abstract/document/7894491/ [15] I. Patel, S. Patel, and A. Patel, “Analysis of various image preprocessing techniques for denoising of flower images,” International Journal of Computer Sciences and Engineering, vol. 6, no. 5, pp. 1111–1117, 2018. [16] J. Canny, “A computational approach to edge detection,” IEEE Transactions on pattern analysis and machine intelligence, no. 6, pp. 679–698, 1986. [17] “https://www.dji.com/global/mini-3-pro - Recherche Google.” Accessed: Aug. 16, 2024. [Online]. Available: https://www.google.fr/search?q=https%3A%2F%2Fwww.dji.com%2Fglobal%2Fmini- 3- pro&sca_esv=6306a503b65c9e12&sca_upv=1&ei=uxq_ZsOcI_HXhbIPnveNyAM&ved=0ahUKE wiD5qKtmPmHAxXxa0EAHZ57AzkQ4dUDCA8&uact=5&oq=https%3A%2F%2Fwww.dji.com% 2Fglobal%2Fmini-3- pro&gs_lp=Egxnd3Mtd2l6LXNlcnAiJWh0dHBzOi8vd3d3LmRqaS5jb20vZ2xvYmFsL21pbmktM y1wcm9I_yNQAFgAcAB4AJABAJgB4QGgAeEBqgEDMi0xuAEDyAEA-AEC- AEBmAIAoAIAmAMAkgcAoAdZ&sclient=gws-wiz-serp [18] “https://dronegear.co.za/products/dji-mavic-mini-3-pro-with-smart-controller - Recherche Google.” Accessed: Aug. 16, 2024. [Online]. 22