APP下载

Computer vision-based method for monitoring grain quantity change in warehouses

2020-10-23LeiLiXunFeiZhuoliDongTiejunYng

Grain & Oil Science and Technology 2020年3期

Lei Li*,Xun Fei,Zhuoli Dong,Tiejun Yng,b

a Key Laboratory of Grain Information Processing and Control(Henan University of Technology),Ministry of Education,Zhengzhou 450001,China

b College of Information Science and Engineering,Henan University of Technology,Zhengzhou 450001,China

Keywords:

Image segmentation

Grain safety

SVM

Spatial constraints

Computer vision

ABSTRACT

Regularly checking the quantity of stored grain in warehouses is essential for the grain safety of a country.However,current manual inspection ways fail to get real-time measurement results and require spending a lot of manpower and resources.In this paper,we proposed a computer vision-based method to automatically monitor the change in grain quantity of a granary.The proposed method was motivated from the observation that warehouse managers can use a camera to remotely monitor the grain security of a granary,which determines whether grain quantity is reduced by checking the distance between the grain surface and the grain loading line at the outlet of a granary.To this end,images were first captured by a camera,and a two-level spatial constraints-based SVM classifier was learned to detect the grain surface and the grain loading line of the images.During the test phase,the detected result of a test image obtained by SVM was further refined by GrabCut with higher order potentials to get the more accurate segmentation result.Finally,the area between the grain surface and the grain loading line was calculated,and then compared with the previous measured one to determine whether the grain surface had dropped.The experiment results validate the effectiveness of the two-level spatial constraints SVM and the strategy for monitoring the change in grain quantity.

1.Introduction

The quantity of stored grain in warehouses has commercial and crucial importance for a country.It is therefore imperative to frequently check the grain quantity in granaries to ensure grain safety.There are still a large number of grain depots where manually inspection ways are used to check the quantity of grain,e.g.,measuring the volume of grain in a warehouse manually.However,the traditional ways have been proven to be more expensive and also cannot get the grain quantity in real time if need to check all warehouses.To solve the problems, some online automeasurement methods are proposed, including, but not limited to, pressure estimation-based approach, infrared laser scanner-based approach, radar-based approach and ultrasonic wave-based approach which can automatically obtain more accurate grain quantity.

Pressure estimation-based approach [1]can directly measure the grain weight according to the grain pressure obtained by sensors placed at the bottom of a granary.In this approach, a pressure-based grain weight mode is built using machine learning methods,which transforms the pressure of grain to its weight in real time.The main disadvantage of this approach is that the sensitivity and accuracy of these sensors will decrease under prolonged stress.Infrared laser scanner-based approach[2]first detects the height of points on the grain surface by laser scanning.Based on the height of these points, this approach calculates the grain volume of a granary and then obtains the grain weight according to the volume and the bulk density.Although this approach can achieve accurate grain volume, it is more time-consuming as it takes a long time to scan the whole granary each time(about 2,000 points need to be scanned for a large granary).Radar-based approach [3]and Ultrasonic-based approach [4]detect the amount of grain in silos by collecting 3D height information of grain surface with radar and ultrasonic devices, respectively.The two approaches can obtain accurate volumes of grain,but they are susceptible to dust,and moreover,they are only applied for the silos and there is no example for warehouses.

Recently,with the construction of intelligent granary,most of them are equipped with cameras.Warehouse staff can check the grain situation in granaries(e.g.,the height of the grain surface) through the cameras with Palt-Tilt-Zoom (PTZ).However,it is time-consuming to check all the granaries and harmful to people health.Inspired from the observation, we developed a computer vision-based monitoring method instead of the manual inspection.The key idea of our proposed method is to determine whether the grain quantity has changed according to how much grain surface dropped relative to grain loading line (or new marker line above grain loading line).Thus,the goal of our proposed method is to obtain grain loading line and grain surface.To this end, we firstly use the camera to take an image at the outlet of a granary,and then detect grain loading line and grain surface of the image with accurate boundaries.In order to utilize the existing hardware devices of warehouses without adding new equipment,we emploied Support Vector Machine(SVM)[5]to detect grain loading line and grain surface.Thereafter,GrubCut[6]with higher order potentials was utilized to refine the initial results,which could get more accurate grain loading line and grain surface.Finally, the area between the grain loading line and the grain surface was calculated and compared with the previous measured data to determine whether the grain surface had dropped(as shown in Fig.1).However,SVM has a limitation of obtaining compact and homogeneous segments due to it does not consider any information about spatial context.For example, we used standard SVM to detect initial grain surface which was fed into GrabCut as seeds to refine the initial result.Due to some of these seeds which might be located in background or grain loading line, we couldn't obtain accurate grain surface.To tackle the problem, two-level spatial constraints derived from two types of superpixels were integrated into SVM to obtain initial segmentation of an image.The main contributions of this paper were summarized as follows.We proposed a computer vision system with a camera instead of manual inspection ways to monitor the change of grain quantity in warehouses.Different from other methods which try to get the accurate grain quality,our method was used to monitor the change of grain quantity.Two-level spatial constraints were introduced into the SVM classification process to ameliorate the misclassification problem due to SVM inability to consider any information about spatial context.In addition,GrabCut with high order potentials was adopted to refine the results obtained by SVM, which can automatically draw boxes without interaction.Through incorporating the spatial constraints,our method strengthened the interactions between the low-level superpixels within a same high-level superpixel and prevented over smoothing across region boundaries.The experiment results demonstrate the practical usability of our proposed monitoring scheme.

Fig.1.Schematic diagram of our proposed method.

2.Related works

Computer vision technologies have been widely used in the fields of industry,medical and food engineering in recent years.Computer vision system captures images/videos of objects by a camera and performs predefined visual tasks by processing these images/videos.In contrast to conventional manual methods,computer vision methods can perform visual tasks automatically and accurately,e.g.,weed detection[7],strawberry powdery mildew disease detection[8],fall detection system[9],eggshell deformation detection [10], and grant quality detection [11].These methods replace traditional manual operations and hence eliminate errors and inconsistencies in results[12].The successful use of these methods also promotes the application of computer vision technology in grain storage and other fields.

The idea of our method is derived from the fact that we can judge whether the grain quantity reduction by using a camera to observe the changes to grain surface (i.e., the height of the grain surface relative to the grain loading line).Therefore,it is important for our proposed method to detect and segment the grain surface and grain loading line with accurate boundaries.A large number of segmentation methods have been proposed in the past decades,such as mean shift [13], graph cut [6,14,15], SLIC [16]and Ncut[17].Moreover,with the development of deep learning, a variety of object detection methods[18-21]and semantic segmentation methods[22-24]have been proposed.Due to using a large-scale image set to train deep neural network models,these methods can achieve even better performance.However, it is still hard to apply one method to obtain better segmentation results for different real scene images, since images consist of both the structured and unstructured objects.More importantly, it is difficult to update existing hardware devices of warehouses with GPU due to cost issues.Therefore, this study tries to design a method which is suitable for detection and segmentation of granary images.To automatically monitor change in the grain quantity,unsupervised and interactive segmentation methods cannot be adopted in our framework,so we choose a traditional classification method to detect grain loading line and grain surface of granary images,and then refine the detected results by graph-based methods.

In classification-based segmentation methods, image segmentation is formulated as a classification problem that can be solved by some classifiers.Due to good generalization ability and state-of-the-art performance,SVM has been successfully used in a wide variety of applications, ranging from pattern mining and computer vision to medical diagnosis and information retrieval [25-28].Because SVM can deal with problems with few samples and avoid over-fitting, there is still a lot of literature to apply it to solve practical problems [29-31].In some deep learning-based methods[32,33],SVM is integrated with deep convolutional neural networks to achieve better results.Although SVM obtains excellent performance in some applications, there are still some problems which potentially affect its performance, such as parameters setting, features extraction and model optimization.Some methods try to tackle these problems by combining some technologies, like genetic algorithm[34], particle swarm optimization [35]and Ensemble Kalman Filter [36].

However, the main obstacle for applying SVM to semantic segmentation or object detection is that the use of the function defined on a single pixel can lead to fragile and misclassification results.SVM fails to consider any information about the spatial context of pixels.In order to resolve the problem,some researchers tried to incorporate region-level local information (e.g.superpixels) into segmentation procedure.Using superpixels as the elementary units in the segmentation process can not only improve accuracy of results, but also suppress isolated noise [37].Fulkerson et al.[38]proposed a method to identify and localize object classes in images, which constructs an SVM classifier on the histogram of local features.To utilize the spatial constraints,this method constructed a classifier regularized by aggregating histograms in the neighborhood of each superpixel and refined the classification results by Graph cut [14]on the superpixel graph.Liu et al.[39]proposed a novel image segmentation method which combined FCM with hidden Markov random field(HMRF) model.This method constructed a spatial model with two levels of regional constraints,pixel-level immediate neighborhood and region-level spatial context, which were incorporated into the clustering procedure to improve the performance of FCM.Inspired by the method in [39], we proposed two-level spatial constraints which are derived from two levels of superpixels of an input image.The high-level superpixels provide spatial constraints for the low-level superpixels, and the low-level superpixels instead of pixels were used in an SVM-based classification procedure to detect the grain surface and the grain loading line of the image.Thus, we called the proposed spatial constraints two-level spatial constraints,which can make our proposed method strengthen the interactions between the low-level superpixels and the same high-level superpixel and prevent over smoothing across region boundaries.Superpixels are also used as higher order spatial constraints in CRFs [15,24].Kohli et al.[15]proposed a general framework for solving labeling problems,which had the ability to utilize higher order potentials defined on superpixels.Superpixel-based higher order potentials encourage label consistency over the superpixels,which can result in better image segmentation results.Recently, higher order potentials are also incorporated into deep learning frameworks to improve the performance of end-to-end deep network [40].

3.Proposed method

The framework of the proposed method is illustrated in Fig.2, which mainly consists of four stages,i.e., feature extraction with spatial constraints, SVM detection, segmentation refining and comparison of two consecutive measurements.The proposed method first extracted color and texture features of a granary image and generated two levels of superpixels of the image.High-level superpixels provided spatial constraints for low-level superpixels as extracting its features.Then SVM was fed with the features of the low-level superpixels for training.During the test phase, initial detection results of grain surface and grain loading line were obtained by the trained SVM, which were refined by GrabCut to get the more accurate segmentation results.After calculating the area between them,we could determine whether the grain surface had dropped based on the comparison between the current and previous measurements.If the area difference between the two measurements is greater than a specified threshold, our method will send an alert to the sever system.

Fig.2.The flowchart of our method.

The proposed computer vision system consisted of a camera with PTZ deployed in the center top or side wall of a granary.The camera was equipped with a focal length lens range of 4.7-94 mm, a resolution of 1,920× 1,080 pixels and a lighting device.For each granary,four presets were set for a camera to capture images,corresponding to four outlets or the areas near them in the granary.In addition to setting the presets of the camera,our method also saved the parameters that were not in parameter list of the presets.It is worthy of note that we can set multiple preset positions for the camera to take more images which can cover the whole granary.To ensure that the images taken at the same point have the same focal length,we used the saved parameters to adjust the camera's aperture,zoom size,etc.As shown in Fig.3(a) or (b), with and without light, these images were taken using presets and zoom steps.We could see that the effect of the physical coordinate error of the captured images at the same location could be ignored by this way combined with the presets.

3.1.Feature extraction

In this paper, we used CIE Lab (i.e., L, a, b) and RGB(i.e.,r,g,b)color spaces to represent the color features of an image fc,which was defined as

where q denotes a pixel of the image.The last two elements in Eq.(1) are constructed by the absolute difference between two RGB color components,which can improve the discriminating power of color features.

In addition to color features,texture information was also used to improve the performance of our method.In this work,multi-scale quaternion Gabor filters(MQGF)[41]were extracted as texture features,which could effectively handle not only the coupling between color channels but also the scale difference of quaternion Gabor filter features of color textured images.For an image,the result texture feature of pixel q can be represented by a 3-D vector

Fig.3.The images taken at different times in the same scene with presets and zoom step values.

where G is the magnitude response of MQGF on the image.For further details,we refer the interested reader to [41].The final composite feature vector at pixel q was generated by concatenatingandthat is

where λ = 0.9 is a parameter that controls the weighting between color and texture features.

3.2.Features with two-level spatial constraints

To address the problem of SVM for image segmentation,two levels of spatial constraints were incorporated into SVM-based classification procedure to detect grain surface and grain loading line as initial segmentation.We first generated the two levels of superpixels of an image by using mean shift [13]and SLIC [16], respectively.The high-level superpixelswere generated by mean shift with the number of the superpixels Nh,since mean shift can oversegment an image into homogeneous regions with different sizes.In contrast,SLIC can obtain small homogenous regions with similar sizes, and thus its segmentation result is treated as the low-level superpixels(Nlis the number of the low-level superpixels).Given a low-level superpixel∈Slwith its corresponding area A(i), a high-level superpixel∈Shand the overlapping region area Ao(ij)between them, we define a spatial relationship functionbetweenandas

where τ1denotes an area threshold, which is set to 0.6 in this paper.= j means thatis contained in.

From Eq.(4), we could see that the high-level superpixels provide spatial constraints for the low-level superpixels, that was the low-level superpixels in a high-level superpixel should tend to belong to one coherent region.

Similar to other methods which perform image segmentation in the superpixels domain rather than the pixels one, our method extracted the low-level superpixels featureswith spatial constraints from the high-level superpixels.The feature vector Fiof ith low-level superpixelis defined as

3.3.SVM detection

The key step in our method is to detect and segment the grain surface and the grain loading line with accurate boundaries.We adopt multi-class SVM to detect the grain surface and the grain loading line in a granary image.

Multi-class classification can be an extension of the binary SVM classification [42].Given training data(x1,…,xN)that are vectors in space F(xi∈F)and their labels(y1,…,yN)where yi∈Y={1,…,K},we used one-againstone method to implement the multi-class SVM.This method constructed K(K −1)/2 classifiers where each one was trained on data from two classes.For training data from the ith and the jth classes, the binary SVM optimization problem was defined as[42]

subject to

where w is a weight vector,b is a bias and C>0 is a penalty parameter of the error term.The training data xiare mapped to a higher dimensional space by the function φ.The resolved decision function between classes i and j based on a voting strategy called“Max Wins”[42,43].Finally,x was predicted to belong to the class with the largest vote.

In this paper, we divided the pixel set of input images into K = 3 categories:grain surface, grain loading line and background.In the training phase,we first generated the two levels of superpixels of training images and extracted the features of low-level superpixels F.The seed masks were obtained by scribbling some low-level superpixels of each image with three different colors,where each color represented one of the three categories.Based on these masks,we collected samples of all training images at the low-level superpixel level.Each sample was represented by the feature of low-level superpixel Fi,and all the samples with their corresponding labels were used to train SVM.In the testing phase,the low-level superpixels of a test image were fed to the trained SVM,hence obtaining the initial segmentation result of the test image.

3.4.Segmentation refining

Although we used the spatial constraints derived from the two-level superpixels of an image in the classification process with SVM, there are misclassified small noise regions in the initial result.In order to solve this problem,we utilized shape prior information of granary images to remove these noise regions,i.e.,the grain loading line and the grain surface in an image were long striped regions.Therefore,a region will be removed if the ratio of the width of the region to the width of the image is less than a given threshold τ2(e.g.<0.2).After the above processing,GrabCut[6]was employed to refine the initial segmentation result obtained by the above steps.

In order to use GrabCut, our method refined the grain loading line and the grain surface of the initial segmentation,respectively.Take the grain loading line as an example,we first get the minimum and maximum coordinates of the grain loading line on the y-axis:yminand ymax,and draw a box with a width of W and a height of (|ymax−ymin|+2d)from left top point(0,ymin−d),where W is the width of the input image, d = 20 is used to enlarge the box so that it can cover the grain loading line (As shown in Fig.4).Further, we built a weighted graph and model the binary image segmentation as an energy minimization problem,and the energy was defined by

where V corresponds to the set of image pixels,while ε is a set of all edges connecting the pixels i,j∈V.S refers to a set of high-level superpixels generated by mean shift and and a clique c is a set of random variables xc.ψi,ψi,jandrespectively represent unary,pairwise and higher order potentials which are weighted by λ1and λ2.Each pixel xiof the image takes a value from the label set ℒ={0,1}.Here,0 denotes background and 1 indicates foreground.Every possible assignment of the random variables x defines a segmentation[15].

Fig.4.Using GrabCut to refine the initial segmentation result.

The unary potential assumes that the penalties for assigning pixels to “foreground” or “background” are given.In the case of grain loading line refining,foreground represents the grain loading line and background denotes the rest of the image.The unary potential is defined as the negative log of the likelihood of a label being assigned to pixel i[44].

where Pr(⋅) denotes the intensity distributions of foreground and background,and Θ is a set of the parameters of Gaussian mixture models (GMM), which is used to model the distributions of foreground and background based on the initial segmentation result.The pairwise potential evaluates the penalty for assigning neighboring pixels i and j to different labeled regions,which is defined as follows using a generalized Potts model[45].

where δ stands for the Kronecker's delta function and‖i −j‖is usually calculated as the Euclidean distance between pixels i and j[44].In this work,the higher order potential(xc)is derived from the high-level superpixels,which is defined by[15].

where Ni(xc)denotes the number of variables in the clique c not taking the dominant label,γmaxrepresents a potential function parameter and Q is the truncation parameter which controls the rigidity of the higher order clique potential.For the solution of Eq.(8)and other details can refer to[6,15].The same process is performed on the detected grain surface.As shown in Fig.4, the grain loading line and the grain surface with accurate boundaries can be obtained.

3.5.Monitoring of changes in grain quantity

In order to reduce the effect of noise and handle some special images well,e.g.,the image captured at the corner of the granary (Fig.5 (a)) and the image in which the grain loading line was partially covered with grain(Fig.5(b)),we utilized the segmented least square method to linearly fit the pixels on the upper boundary of the grain loading line.Thus, the proposed method could handle these images correctly(as shown in Fig.5).After getting the parameters of the fitted line equation,the distances between pixels on the upper boundary of the grain surface to the fitted line were calculated.There are two ways to determine whether the grain surface had dropped.One was based on the average distance between the grain line and the grain surface,and the other was based on the area between the two.As shown in Fig.6,due to the area difference directly corresponding to how much the grain quantity changes(as shown in Fig.6(c)),it is used as a criterion.The area between the grain loading line and the grain surface is calculated as follows.

where dist(i)represents the distance between pixel i on the upper boundary of the grain surface to the fitted line.

Fig.5.Two images and their measurement results.

Fig.6.The comparison of measured areas.

If the difference between the current measured area Rcurand the previous one Rpreis greater than the predefined threshold:τ3, our proposed method will send an alert to the server system.Otherwise,the current measured data is saved to the database for future data analysis.

4.Experiment results

To evaluate the performance of the proposed method,we conducted experiments on real granary image set and simulated image set.We first tested the performance of our method on the real scene granary images and then verified its practical usability for monitoring the change in the quantity on the images from a small granary and a simulated one.We used F-measure as in[46]to measure the accuracy of the boundaries of the segmentation results.The F-measure is the evenly weighted harmonic mean of the precision and recall scores and takes values in the range[0,1]and the larger,the better.Precision and recall are referred as measures of the segmentation quality because they are sensitive to under-and over-segmentation.

Most parameters in our method can be set to default values.We used mean shift with hs=10,hr=10 and ar= 100 to provide the high-level superpixels for our proposed method,and used SLIC with compactness factor 10 and number of required superpixels 1,000 to generate the low-level superpixels.The parameters λ1and λ2in Eq.(8)were set to 50 and 1,respectively.For SVM,Radial basis function(RBF)was selected as the kernel function,and parameters C and gamma of SVM were determined by cross validation.To do it,the value range of penalty parameter C was set to[500,3,000]with step size 50 and the value range of gamma to[0,5]with step size 0.01.

4.1.Experiments on real granary image set

We performed the first set of tests on a real scene image set of 120 images from six granaries of different warehouses.Having considered that each warehouse used its own trained SVM,we split the images of a warehouse into training and test sets.Fig.7 showed some granary images.

Fig.7.Some real scene images.

Fig.8.Segmentation results and measured distances on some images(I).

Fig.9.Segmentation results and measured distances on some images(II).

For each image subset,we selected 1-3 of these images to train SVM with cross-validation,and the rest was used as test images.Figs.8 and 9 showed the segmentation results and the measured distance on these images.We could see that the two-level spatial constraints could help the trained SVM to obtain more accurate classification results.As shown in the second column of Figs.8 and 9,SVM could correctly classify grain loading line,grain surface and background.Although there are still some noise regions in the results, it can provide enough cues for our method to refine it and obtain accurate results by using the higher order GrabCut.Referring to the third column of Fig.8 and Fig.9, some misclassified superpixels were corrected in the refining process.Furthermore,according to the prior knowledge that the width of the grain loading line and the grain surface should be the same as the image and there is no grain above grain loading line,we removed regions with short widths and ones which were above grain load line but labeled as grain surface.From the fourth column of Figs.8 and 9, we could see that our proposed method could get more accurate distance between the upper boundary of the grain surface and the upper boundary of the grain loading line.

We further conducted experiments on some of these images with three methods,i.e.,(i)SVM combined with twolevel spatial constraints, our proposed method; (ii) SVM combined with neighboring superpixels-based spatial constraints as described in [39], called SVM + SC, and (iii)SVM combined with the aggregating histograms in the neighborhood of each superpixel[38],called SVM+HS.For a fair comparison,SIFT features in SVM+HS were replaced with the same features as our method,and the dictionary size K in SVM + HS was set to 10.In addition, we synthesized some new images by adding Gaussian noise with the standard derivation of 0.05 to some original images(as shown in last two rows of Fig.10).To perform a fair comparison, the low-level superpixels were used to train SVM for the three methods.In SVM+HS,the feature of each superpixel was the aggregating histograms in the neighborhood of the superpixel.To extract features of superpixels in SVM+SC,we considered the effects of immediately neighboring superpixels:where fjis the feature of jth low-level superpixel defined as Eq.(5)and Z is a normalized constant.

Fig.10.Segmentation results of three SVM-based methods on some example images.

Fig.10 showed the segmentation results of the three SVM-based methods on some test images,and the last two rows were segmentation results of the noise images.We could see that our method could obtain segmentation results with object integrity and accurate boundaries.However, SVM + SC extracted the features of superpixels from its immediate neighboring superpixels without considering the inhomogeneity between them,it can only get the very coarse segmentation results.Although SVM+HS can achieve similar performance with our method on the images without noise, SVM + HS misclassifies some superpixels belonged to the grain loading line as the grain surface, because the feature extraction in this method fails to take the inhomogeneity of the spatial adjacent superpixels into account.For the noise images,SVM + HS and SVM + SC can not achieve accurate grain surfaces (see last two rows in Fig.10).Although SVM+SC and SVM+HS also use the spatial constraints to remove most of the noise,it still has obvious misclassifications in its results because the spatial model in this method is not as accurate as expected.Benefiting from the two-level spatial constraints, our method achievedthe best results (as shown in the second column of Fig.10).Table 1 showed Precision,Recall and F-measure of three methods on 25 test images of a warehouse,and it can be seen that our method outperformed the other two methods.

Table 1 Precision,Recall and F-measure of three methods on 25 test images of a warehouse.

4.2.Experiment on quantity change monitoring

In order to verify the practical usability of our proposed method for monitoring the change in the quantity,we performed experiments on the images taken from a small granary and simulated images from the laboratory.Table 2 showed the measurement results of Fig.6.The granary images were captured from a small test granary.In the first column of Fig.6,the grain surface of the first image is flat,and in the last three images,there is a pit in each image with the lowest depths of 14 cm, 22 cm and 33 cm,respectively.The last two columns of Table 2 are areas between the grain surfaces and the grain loading lines and area differences.The difference in the areas between two consecutive measurements corresponds to the change in grain quantity.We set a threshold for the area difference according to the experience of the grain storage managers and the image width.For example,we set thethreshold τ3to 3,000 in this experiment.It is important to note that we can also fit the upper boundary of the grain surface with a quadratic curve and set a dynamic threshold based on it.

Table 2 Measured results of grain surface sunk in a small granary.

Fig.11.Experimental framework of the simulated granary.

We also carried out an experiment on the simulated granary images in the laboratory.To get the simulated images,we put wheat on a test platform that can be lifted and lowered and use a camera controlled by a PTZ to take images.The camera was fixed on the wall D meters away from the platform.We collected the images by dropping the platform by a height of h at a time.During the process of taking images with the camera, we set a preset of the camera and obtain the preset to adjust the camera parameters before taking an image.In order to simulate a real scene, we let the camera rotate randomly and then go back to the preset to take images.As shown in Fig.11,D was set to 15 m,the initial height of grain surface h1was set to 0.39 m, and the platform was dropped to 0.26 m and 0.14 m, respectively (see the second column of Table 3).Fig.12 showed three images and the corresponding segmentation results and measured results with blue lines.

Fig.12.Segmentation results and measured distances on three simulated granary images.

This experiment verified that our method could monitor the change in grain quantity using a camera.Table 3 showed the measurements for the three images.The second column showed the physical height of the grain surface and the third column listed the average distances between the grain loading line and the grain surface.The fourth column in Table 3 showed the areas of three measurements which are 122,737, 167,808 and 214,584, respectively.Further, as shown in the fifth column of Table 3, the area differences could be easily obtained by subtraction on two consecutive measured areas in the fourth column.If area difference is larger than the specified threshold,it indicated that the grain quantity changed significantly compared to the previous measurement.The threshold was set according to the experience of the grain storage managers.For example, if the grain surface drops 10 cm, it is considered that there is a major change in grain quantity.In this experiment, the test image was scaled to 360 × 640 pixels, and we observed that grain surface dropped 10 cm which corresponded to a height of 62 pixels in the granary image.We therefore set the area difference threshold τ3to 62 × 640 = 39,680, where640 was the width of the granary image.The fifth column in Table 3 showed that the area differences were greater than the threshold.Through the above experiments, we can conclude that our method can achieve the goal of monitoring the change in grain quantity.

Table 3 The measured results of grain surface dropping.

5.Conclusion

In this paper, we proposed a computer vision-based method for monitoring the reduction of grain quantity in a granary.In order to utilize existing hardware devices without adding new equipment (e.g.GPU), we first extracted the grain surface and the grain loading line of granary images by using SVM with two-level spatial constraints followed by a refining process with higher order GrabCut.After calculating the area between the grain surface and the grain loading line, we then compared the current measured area to the previous one.If the area difference between the two measured areas was greater than a specified threshold, an alert was sent to the server system.In the conducted experiments it was observed that our proposed method could ameliorate the problem of SVM and achieve the better segmentation results.It enables our proposed method to estimate the change in grain correctly.Although our method cannot detect the exact quantity of grain in a granary,it can be combined with infrared laser scanner-based method that can extend the life of the infrared laser scanner.Our future work includes the studying of the relationship between the grain quantity change and the grain surface boundary curve.

Conflicts of interest

The authors declare that there are no conflicts of interest.

Acknowledgments

The authors would like to thank the anonymous reviewers for their insightful suggestions.This work was supported by Natural Science Project of Henan Science and Technology Department (Grant 162102210189,132102210494), Special Fund for Basic Scientific Research of Henan University of Technology (Grant 2016QNJH25), High-level Personnel Fund of Henan Province (Grant 21476062, 31401918) and Open fund of Key Laboratory of Grain Information Processing and Control(Grant KFJJ-2018-101).


登录APP查看全文