Volume estimation of cassava using consumer-grade RGB-D camera

Mismanagement during postharvest handling of cassava can degrade the quality of the product and depreciate its selling price considerably. This study proposed the feasibility of using RGB-depth camera to measure the quality of cassava roots in a non-destructive, fast and cost-effective manner. Methodology to estimate the volume of cassavas Kasetsart 50 variety was the focus of this study. Using RGB-D images collected from 60 cassava samples with each one being photographed from 6 different orientations. Image Processing model and Point Cloud image model were used to find the volume from depth images, and then disk method and box method were used to estimate the volume of cassava under ellipsoidal shape. Both estimation methods provided usable values for the volumes in the range of 100 - 500 ml with RMSE values of 5.91% and 4.02%, respectively. The estimated volume can be applied to find density to predict the rotten cassava for improving quality and efficiency of cassava industry.


Introduction
Cassava is easily grown and planted widely in Thailand. The demand of cassava products is continuously increasing. In general, cassava products are processed into cassava starch, cassava chip and cassava pellets, and are used as the raw material in industry such as Feed mill, Ethanol factory, Paper factory and Glue factory. According to the report from the Office of Agricultural Economics in 2019, the export of cassava products totaled to were exported about 80 million baht. The export value is in the top three among the agricultural products in Thailand, and it is only lower than rice and sugarcane [1]. It can be seen that products from cassava are exported at the top and cassava is an important crop in the economy of Thailand.
Processes and methods of harvesting cassava until it has been processed will affect the properties, quality and quantity of the produce. Therefore, careful postharvest handling procedures are required to obtain higher value and maximize efficiency. Beginning from harvest, agriculturist harvest cassava that has appropriate age, depending on the varieties cultivated in order to get good starch. The harvest method must be suitable and must not cause too much damage to cassava roots. When harvesting is complete, the produce is collected and sold to the middleman or factory immediately. Trading of cassava mainly looks at the percentage of starch content in cassava roots. If the percentage of starch is high, the price will be high. But the price will be deducted when there are contaminates attached more than usual. The estimation of cassava is done by randomly measuring cassava from a truck for 3 times at 5 kg at a time. The randomized cassava is evaluated for impurity using the buyer's experience and the percentage of starch content is measured using a beam balance. The principle of beam balance is weighting cassava roots in water. The composition of cassava consists of water, starch, peel, and cyanide. Heavy cassava roots in water have a high starch content, or the amount of water in cassava roots is low. After the transaction is completed, cassava roots are managed immediately according to the type of plant. The duration from the postharvest to the transformation must be done within 3 days otherwise, the cassava will start to lose its weight due to the microbes, resulting in a degradation of the starch quality and starch content [2].
Tools related to post-harvest cassava to pre-processing that are currently used are scales and a beam balance. It can be seen that there are very few tools to determine the quality of cassava compared with other agricultural products such as rice, which uses moisture meter, blower and rice mill. Having tools that can indicate or monitor the quality of cassava will improve management especially in the case of cassava roots since the rotting process happens rapidly within 1-3 days after harvest and cannot be observed with the naked eye [3]. If cassava can be processed while having the best starch percentage, it is considered to be an effective management. And this tool can serve as a benchmark for determining the prices of cassava roots. Recently the camera along with machine vision technology has been used for quality inspection. The followings are some research works using this type of technique in agricultural products inspection since it does not damage the product and it can measure piece by piece in bulk at a high throughput rate. RGB-D camera was used to evaluate the potato quality. A new image processing algorithm for depth images was built to measure potato volume without damage [4]. The maximum diameter and volume of sweet onions were also measured by RGB-D camera. The method using color image and depth image were compared and used geometrical features to calculate volume [5]. Varying sizes of watermelons were measured for volume by ellipsoid approximation and image processing from low-cost CMOS camera [6]. The focus of this paper is the method to estimate the volume of cassavas using consumer-grade RGB-D camera. Common cameras only provide RGB images or color images. In this study, Kinect camera was used because it could provide more data besides RGB images. Kinect had a depth sensor that emit infrared light hit the object and receive reflected light, then process the data to be depth. This type of tool will help researchers monitoring cassava. The volume will be used to find the density at final to predict the rotten cassava for improvement of quality and efficiency of the cassava industry.

Material and methods
The shape of cassava was difficult to calculate with geometric shapes precisely. The cassava was classified into 4 shapes. There were conical, conical-cylindrical, cylindrical and irregular shapes [7]. The ellipsoidal was used in this study because of a similar geometric shape of cassava. Two methods were selected to calculate the cassava volume, the image processing and point cloud image method. Volume estimated operations were proceeded using MATLAB program developed based on MATLAB imaging processing, computer vision system and robotics toolbox.

Cassava samples
Cassavas "Kasetsart 50 variety" at 8-12 months of age were collected from Khon kaen and Nakhon Ratchasima province, in the northeastern part of Thailand. There were 60 cassava roots which are of diversity in shape and size. The range of the samples was 60 to 600 ml. The weight of each cassava roots was measured 3 times using a digital precision scale with ±0.01 g accuracy and the average value was calculated. The volume of each cassava roots was measured using the water displacement method. Each cassava samples were stored in 22x32 cm plastic bags, labeled with numbers, to avoid the water entering into internal spaces. The air in the bag was vacuumed out and then the bag was sealed. Each cassava samples were submerged, and the volume of displaced water was directly measured using a 500 ml cylinder. The volume of the vacuum bag was less significant compared with the cassava volume and was neglected.

Image acquisition
To acquire RGB-D images of cassava samples, a machine vision system consisted of an LED 9W light source, RGB-D camera (Kinect, Microsoft), a 60x55 cm blue foam board and wood stage was built (Figure 1). The camera and light source were attached to the center of the frame with a height of 108.5 cm from the stage. The stage with foam board at top was aligned with the camera by water level. The camera was linked to a computer via a USB cable using MATLAB program (R2018a) to acquire the color image (640x480 pixels) and the depth map (640x480 pixels). The 2x2 cm white and black paper was captured, and then the number of pixels of paper was measured. The dimensions in millimeters were divided by the dimensions in pixels and the pixel resolution (mm/pixel) was calculated. Each cassava root was laid down on the center of the stage to have the photo taken and then it is manually rotated to 6 different orientations by random turning around the vertical axis. After three image acquisition operations, the sample was flipped along the horizontal axis. Then, another three images were acquired at different orientations. Therefore, for each cassava sample, six color images, six depth images and six-point cloud images at different orientations were collected in a MATfile. Fig. 1. Schematic of the machine vision system to acquire RGB-D image.

Volume estimation using image processing method
There were some steps to process the image, and then calculate the cassava volume with geometric formula. At first, images were cropped into a size of 281x281 pixels. The dark spot E3S Web of Conferences 187, 02002 (2020) TSAE 2020 https://doi.org/10.1051/e3sconf /202018702002 or zero value was removed to be the averaged value around. The background of the image was subtracted from the depth images. Then, the orientation of cassava root was rotated parallel to the x-axis of the picture (Figure 2d). The disk method was used to calculate the cassava volume (Figure 3a). In each nonzero column of the image is the thickness of disk (∆ ) and the number of nonzero pixels in row of image is the diameter (△y). The sum of the cross-section area of disk ( ) is the total volume ( ). Equation (1) shows the volume of a cylindrical disk.

Volume estimation based on the point cloud image
The point cloud image is the points on the scene, which calculate from intensity level in a grayscale and color image, fitting into a coordinate system. With this method, a simple 3-D coordinate system (X, Y, Z) was created, in which Z refers to the distance from the point of surface to the camera (Figure 4a). To calculate the volume, the first step was the point cloud of background and sample were specified. Next, the height of each cassava surface points (ℎ , ) was calculated by subtracting the value of each cassava sample points ( , ). from the value of background points ( ) as shown in Equation 4. Then, each point was treated as a box or square prism in which dimension of cross-section area (length × width) is × (pixel resolution was found from image acquisition) and the height is ℎ , (Figure 3b). The total volume ( ) is the sum of all box or point of cassava samples.
The estimated total volume in the previous steps included both the volume of the cassava roots and the volume of the gap between the bottom surface and the background. From Figure  4b, the ratio of the actual volume was calculated from the ellipsoidal and oval prism. The total volume was the volume of ellipsoidal ( ) and volume of space ( ) sum together. In Figure 4a, b were radius of three principal axes of ellipsoid. The actual volume of cassava roots is 80% of the total volume.

Statistical analysis
The accuracy of the volume estimation was interpreted by root mean square error (RMSE) where is the estimated value, ̂ is the estimator and is the number of samples. The t-test was used to compare the volume estimation with measured volume using two-tailed with a significance level of 0.05. The data operations and statistical analyses were performed using Microsoft Excel. 3 Results and discussion

Volume estimation
The volume from both estimation methods was compared to find the appropriate method to estimate cassava volume. The paired sample t-test result showed that the volume measured with image processing and point cloud was not significantly different from the volume  Figure 5 shows the relationship of the estimated volume and the volume measured by water displacement. The trendline of both scatter plots compared with the Y= X line showed good correlation between the volume estimated using the proposed models vs. the water displacement model, with a few exception in the low value (< 100 ml) and high value (> 500 ml). The R-squared value of both scatter plots, cassava volume calculated from the depth image and cassava volume calculated from the point cloud image were 0.9743 and 0.9761, respectively. The R-squared show well correlation when the value approach one. The volume estimated by point cloud image had better accuracy than the volume estimated by image processing. The root mean squared error (RMSE) of volume estimated by image processing and point cloud image was 35.47 ml and 24.14 ml or 5.91% and 4.02% of maximum volume measured by water displacement method in order. So, the point cloud image method is better than the image processing method with lower RMSE and higher R-squared.

Conclusion
This study illustrated the feasibility of using consumer grade RGB-depth camera to measure the quality of cassava roots non-destructively, low-cost and quickly. The quality of cassava roots is determined from many factors such as the dimension, color, volume, density and impurity. Volume was the property chosen for this study. There were many methods to estimate the volume, but not every method could be used to quantify for cassava roots which the shape was not likely geometry. Volume estimation based on image processing method E3S Web of Conferences 187, 02002 (2020) TSAE 2020 https://doi.org/10.1051/e3sconf /202018702002 and volume estimation based on point cloud image method provided usable values in the volume range of 100 -500 m, with RMSE of 5.91% and RMSE of 4.02%, respectively. However, the better volume estimation must be invented because of the development of technology. In the future, data of cassava (dimension, color, volume, density and impurity) should be automatically collected by the tool and analyzed to determine the quality information for developing cassava in both research and industry.
This study was financially supported by Cyber-physical system engineering, Chulalongkorn university.