# An Image Processing Method for Measuring the Surface Area of Rapeseed Pods
## 2 Materials and Methods
### Measurement Principle and Operation  
#### 2.3.1 Image Processing Method  
The application of the image processing method depends on the integrated use of image processing technology and data analysis. The basic principle is that the pod is considered an irregular column composed of several circular slices with different diameters. The length of the column is the length of the pod, and each circular slice can be regarded as an oblique cylinder with equal height and different diameters. The diameter of each circular slice represents the width of the corresponding position of the pod. The side area of the irregular column of the pod is the sum of the side areas of all the circular slices, which can be estimated using calculus [40], and is considered to be the approximate surface area of the pod. The process of image processing involves calculating the value of pod length and the width at different positions transformed from the image of pods; these are required for the use of calculus through image processing. The correlation between the estimated pod surface area and the corresponding pod \"actual area\" was then analyzed. A correction model was established to correct the measurement results of the other pod images. The specific procedure and methods were as follows:  
(1) Image acquisition device. We configured an image acquisition device, as shown in Figure 3, which used consistent parameters to obtain highly defined and high-quality images. The device was primarily composed of five parts: a long-strip desktop, a self-use iPhone, a tripod for fixing the mobile phone, white background cardboard for placing the pods, and a remote Bluetooth device that can control the photography of the mobile phone. Using a long strip desktop, we established the batch placement of pods and the assembly line operation and improved the efficiency of imaging acquisition. The tripod fixed the shooting distance, unified the shooting background, and provided an identity guarantee for later image processing and comparison analysis. The selection of white background cardboard helped to separate the pod and background during later image segmentation. Bluetooth was used to prevent the mobile phone from shaking during shooting, which affects the image quality. (2) The pixel transformation equation was generated. The image acquisition device was used to capture an object space frame of reference (Figure 4) and calculate the transformation equation of pixel coordinates and actual coordinates. The transformation equation of pixel position \((i,j)\) and actual coordinates \((x,y)\) used the binary quadratic functions Equation (1) [41], and the parameters were obtained by least-square fitting. The goal was to ensure that the distance between the adjacent points on the transformed coordinates of the transformation map was closer to their actual distance. \[\left\{ \begin{array}{l}x=a_{1}\cdot i^{2}+b_{1}\cdot i\cdot j+c_{1}\cdot j^{ 2}+d_{1}\cdot i+e_{1}\cdot j+f_{1}\\ y=a_{2}\cdot i^{2}+b_{2}\cdot i\cdot j+c_{2}\cdot j^{2}+d_{2}\cdot i+e_{2} \cdot j+f_{2}\end{array} \right. \tag{1}\]  
Figure 2: Research flowchart of the proposed methodology for measuring the rapeseed pod surface area. After calculation, the transformation equation between the position of the pixel \((i,j)\) and the actual coordinate \((x,y)\) applied the binary quadratic functions as follows:  
\[\left\{ \begin{array}{c}x=-7.3314\times 10^{-6}\cdot i^{2}+6.7344\times 10^{-7} \cdot i\cdot j-2.2592\times 10^{-7}\cdot j^{2}+0.090528\cdot i-0.0089604\cdot j\\ y=-1.4521\times 10^{-6}\cdot i^{2}-7.2268\times 10^{-6}\cdot i\cdot j+7.7158\times 10^{-8} \cdot j^{2}+0.014176\cdot i+0.09199\cdot j\end{array} \right. \tag{2}\]  
(3) Image acquisition. The images can be acquired using multiple people (Figure 3). One person was designated to take photographs and the others were responsible for placing, numbering, recycling, and recording the pods.