Automated Greenhouse for Plant Phenotyping Using the Image Processing Method

Collection of the plant phenotype data is about understanding the plant growth. The response of plants to the environment is very important information in plant development, but at present, phenotype data is still very scarce, probably because data acquisition devices are hard to find. A cheap and easily available raspberry pi system is designed to measure the plant leaf area and experimentally collected the phenotype data by collecting the canopy width or leaf area, Normalized Difference Vegetation Index (NDVI), which is plant health index and standardization of the color of the image by using OpenCV to process is implemented in this paper because it is an easily accessible library that can be further measured. This research uses OpenCV functions that are uncomplicated, easy to develop and can be measured. This makes phenotype measurements more accessible.


INTRODUCTION
Nowadays, smart agriculture is concerning about a new era of agriculture that will bring Artificial Intelligence (AI) to improve the plant breeding and production [1].It requires a lot of data to process because the phenotype data can make us understand plant characteristics or plant responses to environmental conditions or diseases.Collecting data for analysis is important for breeding development or improving agricultural productivity in the future.
However, the tools for collecting data are scarce and difficult to access.Additionally, the tools for collecting phenotype data are expensive.Commercially available devices to develop in conjunction with an image processing system are therefore significant.
Image processing technology plays an important role in detecting different characteristics, whether it is the color or size of the object.Therefore, the benefits of image processing can be applied to physical data collection of plants that are difficult to access.Using a cheap and easy to find device such as a raspberry pi is a suitable device for the experiment.To design a plant size measurement system in conjunction with image processing, using OpenCV or an open source library used in image processing, experimentally measuring the area of the plant or the area of the leaf can be measured the growth, and measure Normalized Difference Vegetation Index (NDVI) to measure the health of plants.Plant phenotype measurements need to be developed for image processing using simple functions such as the use of numpy contour functions that are computed or detected.It is a successful function that can easily understand the working process and can actually measure the results.
This research project focuses on developing an accessible and easy-to-use tool for collecting phenotype data.By combining image processing technology and Raspberry Pi, it can help those who want to collect physical data of plants efficiently.It is not complicated and can actually be measured.

MATERIAL AND METHODS 2.1 Plant Phenotype
Plant phenotype or the physical characteristics of plants reflect the nature of heredity that is expressed in the characteristics of the plant, indicating the genes or species, which have factors that cause the phenotype to change in a variety of ways, for instance the environment that affects plants, where the plant phenotype data is useful in many areas such as the plant breeding development or the use of data related to the growth for analysis.At present, there is increasingly interested in the plant phenotype data collection, resulting in the development of more complex and accurate data collection.However, the data collection is still very limited [2].

Leaf Area
The leaf area of the plant is an important information that shows the plant growth as well as the plant environment such as keeping the width of plant canopy during plant growth to monitor the growth of plants or the width of the canopy of plants in lettuce leaves that are slender.This leds to an analysis that lettuce is underexposed [3].It can be seen that collecting canopy width data allows us to understand plant genetics and the environment that affects plants.

Normalized Difference Vegetation Index (NDVI)
NDVI or Normalized Difference Vegetation Index is an indicator of the condition of plants whether they have good growth or health, which is measured from the reflected light with NIR (Near Infared) and the red light reflected by plants.The image obtained from the camera must use the camera that can take pictures in the NIR range, which the NDVI value will have.The calculation formula is [4]    = This formula is used to calculate the NIR value or the near infrared range of plants with the red light value to find the difference between NIR and RED to see the greenness of plants.It ranges from -1 to 1, with -1 to 0.2 indicating that the area has no plant growth that the healthy plant has a photosynthetic process and the high NIR light absorption is seen in red.For instance, the example below is a trial to bring the yellow spots on the test leaves to see that the yellow spot of the leaves does not reflect the light, indicating that if the tree is healthy, the image will not reflect the red light.Figure 1 shows the reflection of NDVI and plant health.

Raspberry pi Microcontroller
In this research, the Raspberry pi microcontroller running on Raspberry pi OS is used, which is extracted from Linux.Thus, the commands are similar, allowing for customization or programming in a variety of languages such as python and modules.The camera is attached to the microcontroller.

Structure Design
The structure of the experiment is designed for a photographic area of size 80x60x65 cm (see Figure 2).It is assembled from aluminum profiles and a plaswood plate, with the camera mounted on the top of the device.A lot of images can be processed because measuring the size of plants for accuracy requires a clear distance.

Image Processing
Image processing or data reading from digital images bases on pixels or colors to read data using various techniques and algorithms in order to process or improve the image to obtain the information that can be used further.For example, plant diseases are detected with leaf blight due to the fact that the color of blight leaves is clearly distinguished between brown and green, machine learning may be used to help process data with greater accuracy [5].Using image processing can help in processing to store the data quickly, and can be applied to a wide variety of the data.The device used in this research as mentioned above is a Raspberry pi with a camera module.

Leaf Area Function in Image Processing
In order to use image processing to find the area of the leaf, OpenCV libraries are used together with the math module to help in calculating the first image and then grayscale for easy processing.The canny function is then utilized to perform the canny edge detection F by setting threshold values High and Low for the edge detection [6].After that, CV.findcontour is used to search for lines in the image by capturing the edges of the contour lines that are only outside of the plant leaves, using the green range to help for processing the ZXimage to be more accurate and when the contour lines have been obtained.The area is calculated by using the contour to calculate the area in the detected contour as a pixel using with OpenCV area function, the overall process is to capture the contour of the image and convert it to the actual area (see Figure 3).The resulting plant is square millimeters (mm 2 ).

NDVI Function in Image Processing
For the use of NDVI function, a NOIR camera and raspberry pi must be used to take pictures and measure NDVI values.The image processing function captures the color value of every pixel and calculates the NDVI using equation 1), then the average NDVI is calculated to obtain the NDVI value of the plant.The program design uses OpenCV as the image processing library and numpy as the mathematical processing library.The operation of the program starts from turning on the camera to take pictures and then takes that picture to calculate NDVI, finds the average and displays the NDVI value, and finishes the processing to find the NDVI value as shown in Figure 4.

Color Collection Function
Color collection is a function used to adjust the color condition of the image in order to see the color of vegetables accurately.This  research uses the color plate to calibrate the camera to take pictures and refer to the color of the color plate and then adjust the image settings so that the captured image has the least color distortion.The operation of the program uses OpenCV and numpy libraries to calculate image processing.The shooting will take a 6x4 color plate, then the program will determine the color metric from the 6x4 color card value for color adjustment and uses the transform function to make the color value in the image to be adjusted according to the color card, and displays the color corrected image.

Leaf Area Experiment
An experiment to measure the accuracy of the plant area meter is conducted by designing the paper with different shapes [7], using solidworks program to design 6 different shapes and sizes.They are then printed using a 1:1 scale and are cut to fit, and use them for the experiment with the system.Using colored paper with a 1:1 ratio is a good choice, if regular leaves are used, there may be a discrepancy in measurement.The shape and area of the experimental plate are demonstrated in Figure 5, and the photographic experiment to measure leaf size is illustrated in Figure 6.
The experiment is conducted in a cabinet designed as an indoor smart farm.LED lights are used for growing plants because they have a fixed light value, so there is no need to calibrate the light value often because if the light disturbed or changed, the adjusted color value settings may cause distortion.The experiment with the closed system cabinet can solve the problem of lighting.The height of the camera must be also adjusted to find the exact distance in order to bring the distance to set and calculate the area of the leaves.

Leaf Area Function
From the photographic experiments, it can be found that the size of the aberration still exists, with the outline of the green area being considered good.The green outline is not spread out, thus ensuring that the function used can detect and measure the area of the leaf (see Figure 7).
After that, six different samples are experimented.The line processing is good even though the shapes are different by the processing area values of 6 samples as shown in Table 1.It can be observed that there is an error processing in some samples, the value obtained from the experiment is the experimental value and the results are adjusted until the lowest ERROR value is shown in the table.

NDVI Function
The NDVI experiment can be concluded that the program can be used to capture and display the NDVI values using OpenCV, the results of the experimental collection of plant health values are quite accurate.The NDVI values of both spots are according to the theory that if the plants were healthy, the red light range would appear intense, but if the plants were poorly healthy, the red light spectrum would be less or negative as Figure 8.
It can be seen that the raspberry pi with a Noir camera can be programmed using OpenCV to create the function to collect NDVI values to measure plant health.Reliability must be compared to standard equipment for greater accuracy.

Color Collection
The experimental color collection function is performed by using the function to collect uncorrected images and save one image, and then process that image to adjust the color and save it one more image, and bring the color adjusted image into the program to see the value of the color in the pixel whether it meets the standard color sheet or not.By the results of the color adjustment experiment, the color value can be adjusted by the color adjustment range, there may still be some colors that have some color distortion, but not much and can still be accepted by the experimental image.As in Figure 9, it can be seen that the color value on the card may not be accurate, but this function can adjust the value to be as close to

CONCLUSIONS
By designing the standard sample for testing, the image processing system designed to measure the area of a plant or leaf is able to measure the area with acceptable error values and with the use of available equipment.As simple and inexpensive as a raspberry pi and a closed enclosure for mounting the camera to capture data, this inexpensive and easy to program phenotype detector is experimental with basic image processing functions that are not too difficult.But from experimenting with plants, if plants have color  that is different from green or is so transparent, which it cannot capture the green range.It may cause the processing to be wrong.
In the future, machine learning may be used in order to increase the processing accuracy and measure the area of plants to be more accurate [8].The NDVI index measurement part is practical and can measure susceptible plants and healthy plants, and there are obviously different values.By adjusting the color of the image, the color of the plant can be analysed.If the camera normally notices that the color is highly distorted, this function must be used in order to see the color that is close to the brightness.as real as possible.This can be extended to smart farms or let farmers know how to use tools to monitor productivity with equipment that is not very expensive and easy to find.The work program is also not complicated.

Figure 5 :
Figure 5: Shape and Area of the Experimental Plate.

Figure 6 :
Figure 6: Photographic Experiment to Measure Leaf Size.

Figure 7 :
Figure 7: Images Processed by Image Processing.

Table 1 :
Experimental Results of Measuring the Area of the Experimental Plate.