Table of Contents Author Guidelines Submit a Manuscript
Mobile Information Systems
Volume 2018, Article ID 5491706, 5 pages
https://doi.org/10.1155/2018/5491706
Research Article

Insect Identification and Counting in Stored Grain: Image Processing Approach and Application Embedded in Smartphones

1College of Information Science and Engineering, Henan University of Technology, Zhengzhou, China
2Institute of Industrial Technology, Zhengzhou University, Zhengzhou, China
3Department of Electronic Engineering, University of York, York, UK

Correspondence should be addressed to Chunhua Zhu; nc.ude.tuah@auhnuhcuhz

Received 3 July 2018; Revised 1 October 2018; Accepted 14 October 2018; Published 19 November 2018

Academic Editor: Raul Montoliu

Copyright © 2018 Chunhua Zhu et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract

Insects can cause a major loss in stored grain, and early identification and monitoring of insects become necessary for applying corrective action. Considering the effectiveness and practicability, an image processing approach and the corresponding application embedded in smartphones are proposed to identify and count the insects. For the insect images acquired by mobile phones, one sliding window-based binarization is adopted to release their nonuniform brightness, and then connected domain-based histogram statistics is presented to identify and count the insects in stored grain. Finally, the experiments are performed on the corresponding application based on Android, and it has shown that the proposed approach can be applicable for different random insect images from mobile phones with the counting accuracy of 95%, which is superior to the traditional approach.

1. Introduction

Detecting the insects in stored grain quickly and accurately is the basis of preventing and controlling storage grain insects and avoiding severe grain losses and unnecessary excessive treatment. Current standards of international trade are used as insect-free detection by standard method (ISO 6639-3,2001). Recently, several detection techniques have been developed for insect detection in stored grain such as electromagnetic spectrum-based methods [16], acoustic-based methods [7], conductance-based methods [8], and probes [9]. However, some of these techniques are time-consuming, expensive and less efficient to detect the dead insects. The image processing-based method is nondestructive and convenient in application design, which has been one of the hot topics in recent years [1012]. There have been some methods that use image processing to count insects, which mainly include counting the morphological features of the grain insects [13, 14], the binary sketch of the grayscale image [15, 16], and counting the insect pixels [17, 18]. However, these methods have lower accuracy in counting smaller grain pests, the hardware of image acquisition and monitoring system are expensive, and the higher cost in computation cannot ensure the real-time detection. Therefore, considering the accuracy and practicability of insect detection, the image processing approach and application embedded in smartphones are researched. The focus is to preprocess the acquired insect image with nonuniform brightness and dark background and to separate the different insect pixels for higher accuracy, especially for tiny storage grain insects. The main work and innovation is as follows:(i)Sliding window with changeable optimal threshold is used to binary processing the acquired original insect image with uneven brightness, which affects the insect identification accuracy based on pixels difference.(ii)The probable occupied connected-domain pixels area of one insect is analyzed, thereby identifying and counting the insects, which is applicable for the booklice and other tiny insects.(iii)The application based on Android is portable to install in cell phones, and less memory space is occupied.

To verify the effectiveness, the traditional insect detection based on image processing [15] is compared.

2. Algorithm Descriptions

The overall structure of the automatic identification and counting system of storage grain insects based on the smartphone image is shown in Figure 1. Modular design is adopted, including original photo collection module, image capture module, image preprocessing module, data statistics module, and so on. In the first two modules, the original photos are collected in mobile phones with the high-resolution camera which can be clipped into different size to be detected to obtain the detected area.

Figure 1: Insect identification and counting system.

The test environment is shown in Table 1.

Table 1: Test environment.

While the system is used in the barn, mobile phone photos are easily affected by external environmental factors, including insufficient illumination and noise interference; therefore, the quality of images cannot be guaranteed. In order to solve the aforementioned problem and increase the difference between the insects and the background, it is necessary to preprocess the acquired insect image.

2.1. Preprocessing Algorithm Based on Sliding Window

For the acquired insect image, the main preprocessing units include the color space transformation, binary processing, boundary tracing, and so on, which are adopted to extract the contour of grain insects in the white wall of barn, as shown in Figure 2.

Figure 2: Image preprocessing procedure.

Obtaining the optimal threshold for the following binarization is the key preprocessing unit. In existed references, the fixed threshold with standard weighted average was often used [11], which is helpless for distinguishing the insect pixels area with different brightness, further maximizing the difference between the insect areas and the background. Therefore, the optimal threshold should be changeable with the brightness of different insect areas. Thereby, the key difficulty is to select a series of segmentation thresholds corresponding to different insects’ areas.

Assume that the insect image is , where and are its row and column separately. One square window with a size of 3∗3 pixels is adopted as the basic template operation. In each area with a size of 3∗3 pixels, the optimal threshold is equal to the weighted average of the nine pixels; for the first 3∗3 pixel area, the optimal threshold is

Here, is the weighted coefficients, typically take 1. In a similar operation, the second optimal threshold is

Similarly, can be obtained, where is the number of 3∗3 pixel areas in the whole insect image.

The pixels whose gray value is bigger than the optimal threshold will be assigned to “255” and the converse will be assigned to “0.” Generally, the lower gray pixels area represents the image background.

After image binarization, the gray difference between the insect pixel and the background is maximized to an extreme, which is helpful to increase the identifying and counting accuracy.

2.2. Histogram Statistics Counting Insects by Connected Domains

The commonly used grain pest counting algorithms mainly include template matching method [12, 13] and connected domain method [15]. The template matching method is used to identify insect body posture and body characteristics, and a matching benchmark must be established to complete the process of registration. The template matching method can obtain higher matching accuracy, but is less efficient for more similar insect body features and the complexity will increase with the insect body samples. In the connected domain method, one center pixel and its adjacent several pixels with the same gray value of “255” will be called as one connected domain, also called as black connected domain. One black connected domain represents one insect probably. The key difficulty is to decide the number of pixels in one black connected domain occupied by one kind of grain insect. For a given grain insect image, the number of black connected domains with different pixels numbers is shown in Figure 3. Here, N is the number of pixels in one black connected domain, and M is the number of homogeneous connected domains over the whole image. M is 6 when N is less than 18, M is 110 when N is from 18 to 24, and M is 2 when N is more than 24, as shown in Table 2.

Figure 3: Histogram statistics by connected domains.
Table 2: Histogram statistics of black connected domains in experimental tests.

From Table 2, it has shown that one grain insect occupies 18 to 24 pixels in one connected domain with most possibility. Therefore, the black connected domain with 18 to 24 pixels will be regarded as one insect.

3. Evaluations

3.1. Android-Based Mobile Application Development

Using the Windows system, Android Studio and SDK (software development kit) [19] are used to develop the application (APP), and the completed APK (Android package) is installed on the Android smartphone. The main functions are listed as follows:(i)Choosing one photo. One way to obtain the photo is from the camera of the cell phone, and the other way is from the albums.(ii)Clipping the photo. The photo is a square image with one side 10 cm to 15 cm, in which hundreds of grain insects are usually included. At this time, the sampled photo area can be chosen by clipping.(iii)Resizing the sampled photo. In order to increase the detection resolution, the detected image should keep certain size; usually, the clipped image is enlarged.(iv)Identifying and counting the insects. After binarization and connected domain statistics, the number of insects in stored grain is displayed.

3.2. Results

For the experiment, three original image samples with different brightness and insect density are selected as shown in Figures 4(a)4(c). To verify the effectiveness, the traditional insect detection based on image processing [10] is compared, in which the binarization under the fixed threshold is adopted, called as the fixed threshold method. The proposed binarization in this paper is called as the sliding threshold method. The preprocessed images under the fixed threshold and under the sliding threshold are shown in Figures 5(a)5(c) and Figures 6(a)6(c), respectively.

Figure 4: Original test images. (a) Test image 1, (b) test image 2, and (c) test image 3.
Figure 5: Binarization images under the fixed threshold. Test results of (a) image 1, (b) image 2, and (c) image 3.
Figure 6: Binarization images under the sliding threshold. Test results of (a) image 1, (b) image 2, and (c) image 3.

From Figures 46, it can be seen that the gray difference between the grain insect and the background is more obvious by the sliding window preprocess and that the side identification is enhanced. According to the histogram statistical algorithm proposed in this paper, the accuracy of identifying grain insects is shown in Table 3. Obviously, the sliding threshold method can provide the higher identification accuracy.

Table 3: Accuracy of identifying grain insects.

4. Conclusion

In this paper, one insect identifying and counting approach and Android-based APP are presented, in which the sliding window is used in the preprocess unit that can maximize the difference between the detected targets and the background and remove the uneven background brightness. By adapting the sliding window size, it is possible for tiny insects to be distinguished. Compared with the existing technology, the proposed scheme can provide the higher counting accuracy and is portable with online identifying and counting the insects. Besides, in the proposed connected domain method, the insects with one same shape and size will correspond to one same black connected domain, which can be applied to identify and count the other kinds of insects with different shapes and sizes. Thereby, the separation of the connected domain will be one of the key issues to improve identification accuracy in the future.

Data Availability

The [Android-Based Mobile Application] data used to support the findings of this study were supplied by [Chunhua Zhu] under license and so cannot be made freely available. Requests for access to these data should be made to [Chunhua Zhu, zhuchunhua@haut.edu.cn].

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

This research was financially supported by the National Science Foundation of China (61741107 and 61871176), Henan Provincial Department of Science and Technology Project (172102210230), and Key Scientific Research Projects in Henan Colleges and Universities (19A510011).

References

  1. I. Y. Zayas and P. W. Flinn, “Detection of insects in bulk wheat samples with machine vision,” Transactions of the ASAE, vol. 41, pp. 883–888, 1998. View at Google Scholar
  2. C. Karunakaran, D. S. Jayas, and N. D. G. White, “Soft X-ray inspection of wheat kernels infested by Sitophilus oryzae,” Transactions of the ASAE, vol. 46, no. 3, pp. 739–745, 2003. View at Google Scholar
  3. C. Karunakaran, D. S. Jayas, and N. D. G. White, “X-ray image analysis to detect infestations caused by insects in grain,” Cereal Chemistry Journal, vol. 80, no. 5, pp. 553–557, 2003. View at Publisher · View at Google Scholar · View at Scopus
  4. N. A. Nanje Gowda and K. Alagusundaram, “Use of thermal imaging to improve the food grains quality during storage,” International Journal of Agricultural Research, vol. 1, no. 7, pp. 34–41, 2013. View at Google Scholar
  5. K. Sheetal Banga, N. Kotwaliwale, D. Mohapatra, and S. K. Giri, “Techniques for insect detection in stored food grains: an overview,” Food Control, vol. 94, pp. 167–176, 2018. View at Publisher · View at Google Scholar
  6. H. Liu, S. H. Lee, and J. S. Chahl, “A review of recent sensing technologies to detect invertebrates on crops,” Precision Agriculture, vol. 18, no. 4, pp. 635–666, 2017. View at Google Scholar
  7. P. A. Eliopoulos, I. Potamitis, D. C. Kontodimas, and E. G. Givropoulou, “Detection of adult beetles inside the stored wheat mass based on their acoustic emissions,” Journal of Economic Entomology, vol. 108, no. 6, pp. 2808–2814, 2015. View at Publisher · View at Google Scholar · View at Scopus
  8. D. Brabec, F. Dowell, J. Campbell, and M. West, “Detection of internally infested popcorn using electrically conductive roller mills,” Journal of Stored Products Research, vol. 70, pp. 37–43, 2017. View at Publisher · View at Google Scholar · View at Scopus
  9. D. Shuman and N. D. Epsky, “Commercialization of the electronic grain probe insect counter,” in Proceeding of an International Conference on Controlled Atmosphere and Fumigation in Stored Products, pp. 665–667, Fresno, CA, USA, 2001.
  10. J. Wang and L. Ji, “Methods of insect image segmentation and their application,” Acta Entomologica Sinica, vol. 54, no. 2, pp. 211–217, 2011. View at Google Scholar
  11. B. Yan, F. Chen, and J. Guo, “Automatic classification virtual system of grain pest based on image processing,” Cereal and Feed Industry, vol. 2014, no. 6, pp. 19–26, 2014. View at Google Scholar
  12. G. Lu, Q. Man, and R. Xu, “SVM-based multi-feature fusion longicorn image recognition,” Forest Engineering, vol. 28, no. 4, pp. 21–25, 2012. View at Google Scholar
  13. Z. Hu, Y. Zhao, Y. Bai, and F. Cao, “Fast Recognition of pests based on image processing technology,” Journal of Anhui Agricultural Science, vol. 42, no. 30, pp. 10784–10787, 2014. View at Google Scholar
  14. D. Xian, Q. Yao, B. Yang et al., “Automatic identification of rice light-trapped pests based on images,” Chinese Journal of Rice Science, vol. 29, no. 3, pp. 299–304, 2015. View at Google Scholar
  15. B. Yan, J. Zhao, B. Tang, and Z. Liu, “Research of stored grain pests monitoring system based on image processing and photoelectric technology,” Cereals and Oils, vol. 29, no. 10, pp. 70–74, 2016. View at Google Scholar
  16. M. Shi and R. Michael, “Modelling mortality of a stored grain insects pest with fumigation: probit, logistic or cauchy model?” Mathematical Biosciences, vol. 243, no. 2, pp. 137–146, 2013. View at Publisher · View at Google Scholar · View at Scopus
  17. L. O. Solis-Sánchez, R. C. Miranda, J. J. García-Escalante et al., “Scale invariant feature approach for insect monitoring,” Computers and Electronics in Agriculture, vol. 75, no. 1, pp. 92–99, 2011. View at Publisher · View at Google Scholar · View at Scopus
  18. Y. Yang, B. Peng, and J. Wang, “A system for detection and recognition of pests in stored-grain based on video analysis,” in Proceedings of Computer and Computing Technologies in Agriculture, pp. 119–1246, Nanchang, China, October 2010.
  19. R. Laganière, In-Depth Open CV Android Application Development, Electronic Industry Press, Beijing, China, 2016.