Plant Screen Mobile (PSM)
Eine vielseitige Smartphone-basierte App für die Quantifizierung von Pflanzenwachstumsparametern
Leaf area is one of the fundamental variables to quantify plant growth and physiological function and is therefore widely used to characterize genotypes and their interaction with the environment. With the development of Plant Screen Mobile (PSM) we provide a suitable smartphone solution for estimating proxies of leaf area and biomass in various imaging scenarios in the lab, greenhouse and in the field. This requires image segmentation of plant parts and background. Therefore the core of the application comprises different classification approaches. Beyond the estimation of projected leaf area the app can also be used to quantify color and shape.
The development of leaf area is one of the fundamental variables to quantify plant growth and physiological function and is therefore widely used to characterize genotypes and their interaction with the environment. To date, analysis of leaf area often requires elaborate and destructive measurements or imaging-based methods accompanied by automation that may result in costly solutions. Consequently, in recent years, there is an increasing trend towards simple and affordable sensor solutions and methodologies. A major focus is currently on harnessing the potential of applications developed for smartphones that provide access to analysis tools to a wide user basis. However, most existing applications still entail significant manual effort by users during both data acquisition and analysis. With the development of Plant Screen Mobile we provide a suitable smartphone solution for estimating proxies of leaf area and biomass in various imaging scenarios in the lab, greenhouse and in the field. To distinguish between plant parts and background the core of the application comprises different classification approaches that are easy to parametrize delivering results on-the-fly. The resulting amount of pixels that reflect plant leaves, shoot or specific plant organs can be used as proxies for leaf area and/or biomass. Beyond the estimation of projected leaf area the app can also be used to quantify color and shape parameters as well as to estimate the number of objects in an image (e.g. suitable for seed counting).
PSM runs on Android-based smartphones with Android Version 4.0 (Ice Cream Sandwich) or higher. On older smartphones models with less CPU power some of the processing tools require substantially more time and the frame rate in the live view mode is reduced. This can be compensated by switching to lower camera resolutions. There is no implementation planned for iOS.
- PSM is available in the Google Play Store.
- On first start of the app give the permission to capture images or videos and to access the location (GPS).
- Inside the app-specific directory (/Android/data/de.fz_juelich.plantscreenmobile/files) several sub-folders are created to store data. One of the folders, “Projects”, is reserved for user-created data like image files, processing results and filter configurations. In the beginning only a “Default” project folder is created. Later other projects can be added from inside the app.
The live screen shows the actual image with the resolution pre-defined in the settings. Most of the time a red frame around this image is displayed indicating a tilted smartphone orientation. A horizontal or vertical orientation is indicated with a green frame, in this case the text “Top View” (horizontal) or “Side View Landscape” or just “Side view” (vertical) are display on the top left. This helps to adjust the tilt for particular imaging situations, e.g. capturing a leaf on a horizontal base from nadir.
The live screen contains several icons on the left and right side.
- Left Top (LT) – Bulb: Toggles the smartphone light on / off
- Left Bottom (LB) – Tools: toggles an additional menu on the bottom on /off
Bottom Left – “App Config”
- Misc. Configuration
- Camera Calibration
- Camera Resolution
Bottom Right – “Filter Config”
- HSV – Filter
- Greenness filter
- Threshold Filter
- Train HSV Filter
- Right Top (RT) – Switch: Toggles the selected filter on / of
- Right Upper Center (RUC) – Slider: Filter Selection
- Right Lower Center (RLC) – Camera: capture an image as displayed in the live screen
- Right Bottom (RB) – Gear Wheel: Batch Processing
Images from the live screen or images that are batch-processed need to be stored in a project. Activation of an existing project or adding a new one is done in the LB-“App Config” à Misc. Configuration. The activation is done in “Project folder”. Either type in the folder path to the project or select a project folder by pressing on the right “Open” icon; after that press “Confirm” on the bottom of the screen. To create a new project, press the “Open” icon on the right and move to the “Projects” folder either by pressing the listed sub-folders or by pressing the “Back” Button on your smartphone. Here all existing projects should be listed, in the beginning only “Default”. Then press the “New Folder” button and enter a new project name. This project folder together with a sub-folder structure has now been created on your smartphone’s storage. Pressing “Confirm” finalizes this process and activates this new project folder. New filter parametrizations are now stored in this project structure and applied in batch processing mode. In the project configuration there is also the option to set a “Project name”. This name will be used as a prefix e.g. of the output csv-file name.
PSM offers two image processing modes. Mode 1 processes the live image with a pre-selected filter, mode 2 is batch processing of images captured with the smartphone camera outside the PSM app. Details to each mode are explained in the subsequent chapters.
- Mode 1: Applying mode 1 starts with the parametrization of a suitable filter (LB-“Filter Config”), then the filter is selected (RUC) and the live screen is toggled to the filtered image (RT). If the result is sufficiently good, an image of scene can be captured (RLC). If not, it may help to adjust the filter parametrization (again LB).
- Mode 2: Take images with your camera. In PSM create a new project (LB-“App config” à Misc. Configuration) and move images to the new folder. After that parametrize and select a filter (as explained for mode 1). Go to batch processing (RB), select the directory with the images, enable post-processing options and start the batch processing.
Filters are configured in LB-“Filter Config”. Three different filters can be used: HSV Filter, Greenness Filter, and Threshold Filter. The parametrization of each of these filter types is stored on the smartphone, even if the app is switched off. You can alter the filter configurations for each project separately. If you load an older project, the filter configurations of that project will be loaded automatically. The last option “Train HSV filter” allows for an optimized HSV filter parametrization via training images.
In HSV color space Hue (H) is associated with color, saturation (S) with colorfulness, and value (V) with the lightness of all RGB channels. Because color is only represented by Hue, thresholding operations are easy to apply, when color is the dominant feature in an image. The HSV filter uses 6 thresholds, 2 for each channel, which are lower and upper boundaries. These 2 thresholds limit the channel region, inside which a pixel is treated as a potential plant pixels. Only if all channels agree on a pixel to be counted as a plant pixel, it is classified as plant. Values for Hue range between 0-360, for Saturation between 0-1, and for Value between 0-255. Due to the particular nature of Hue, the channel displays a unique feature: the 0 and the 360 indicate the same color in the red region. Therefore, lower and upper thresholds can be switched, i.e. the lower threshold contains the higher number. In this case all values outside the limits are counted as plant pixels. This can be useful, if the desired color feature contains red and purple values, which are located at the extremes of the Hue channel.
RGB channels can be used to compute a greenness index, which serves as a basis for thresholding operations. We included three standard computations for greenness, which are called “Excess Green Excess Red (ExGR)”, “Green Chromatic Coordinate (GCC)” and “Vegetative Index (VEG)”. The respective greenness values are then classified into plant and background according to the threshold that is set below. Suitable thresholds differ strongly depending on the selected greenness method as every method displays its own range of values.
Threshold filtering refers to assigning a threshold to a gray-value image. The threshold separates the pixels above and below the threshold. We included four different methods, which are called “Simple Threshold”, “Otsu”, ”Adaptive Mean” and “Adaptive Gaussian”. “Simple Threshold” applies a threshold that is selected by the user to the entire image. “Otsu” thresholding is a well-known method, where the threshold is automatically calculated and applied on the entire image. The integral part is an estimation of a threshold, which splits up the intensity distribution such that resultant distributions display low intra-variance and high inter-variance. “Adaptive mean” considers local variance of the illumination, i.e. each pixel is treated with an individual threshold that is computed from a small region around. The size of this region is determined by the value “Window Size”. In this case the threshold defines a correction value (Adaptive Constant C) that is considered as follows. If a pixel’s gray value plus correction value is higher than the average gray value of the region around (defined by the “Window size”), it is considered as one class and vice versa. The same applies for the “Adaptive Gaussian” except that the reference value of the region is computed with a Gaussian kernel. This gives more impact to the values near the target pixel according to a Gaussian distribution. The shape of the distribution is defined by sigma, a parameter that is automatically adjusted with respect to the pre-selected “Window size”. The option “Invert Image” should be considered for images, where the desired object is darker than the background. It should be mentioned that the camera automatically adjusts the exposure time depending on the imaged pixel intensities. This will most likely result in different segmentations of the same object, if e.g. the field of view is changed by turning the camera or changing the distance.
HSV parameter optimization
The parameter optimization uses a genetic algorithm and requires a separate set of RGB images that are comparable in their HSV properties to the ones that will be analyzed later. Usually, a complete set of images that will be analyzed with one HSV parameter setting is split up into a training set and a test set. Each image in the training set should have an analyzed counterpart, i.e. an image mask with ones (plant pixels) and zeros (background pixels). These masks do not necessarily need to come from the PSM app, but can in principle be produced by any software. The optimization process requires some time, even on well-equipped desktop computer. Due to the restricted memory capabilities of a smartphone it makes sense to pre-process the training images on a different PC and transfer them to the smartphone for optimization. Such pre-processing steps could include a reduction in image resolution or cropping to an interest region. We recommend a final image resolution of 1 megabyte or less.
A filter is selected by pressing the RUC icon. Beside the discussed filters in the previous chapter this menu also contains additional display (filter) options that cannot be used for segmentation, but that can be of general use. These are single channel filters in HSV color space, a “Color Picker” to display color values in RGB and HSV for the smartphone screen center area, a “Histogram” tool to display color channel intensity distributions in RGB, Gray-value and Hue, and lastly, a “Sensor Data“-tool that can be used to display the device orientation, light intensity, GPS coordinates and the current pixel to mm ratio defined by the calibration. If a filter is selected its effect can be displayed by pressing the RT icon. The frame rate of this filtered live view strongly depends on the smartphone’s computational power, the selected camera resolution (LB “App config”) and the filter type. If the filtered result is sufficiently good, an image can be captured by pressing the RLC icon. The camera image is stored in the project folder structure under “Screenshots”, the filtered result is stored in the same project, in a sub-folder of “Screenshots”, which is named “Filtered Images”. The active project needs to be defined in LB “App config”.
The batch processing is the most effective way to process images. However, if using the batch mode, one should also be aware of the restrictions. The batch mode processes all image files in a pre-selected folder with a pre-selected filter, which has a pre-defined parametrization. To ensure that all images are processed in a proper way, rather constant imaging conditions and comparable target plants or plant organs are required. The best way to do this would be a fixed imaging setup, preferably with artificial constant light and a suitable uniform background. On the other hand, using a fixed parametrization allows for a better comparability of the different photos. Press the RB icon to get to the batch processing menu. It should be noted that images do not necessarily need to be located in the project folder structure. The active project only defines where results are stored and which pre-parametrized filters can be used. A folder with images can be selected from any place in the storage. First, select a method from the pull-down menu. The respective method uses the latest parametrization, which is displayed on the center of the screen. Then select a directory by pressing the button on the bottom left. The current folder is displayed on the top. Navigate through this menu either by pressing one of the folders or by pressing the back-button on your smartphone. Navigate to the folder with your images and press OK. The folder path is now displayed on the top and the number of images below. The lower screen half offers several post-processing options for image filtering and analysis, which are “Morphology Open”, “Clean Mask”, “Count Objects” and “Calculate Metric Values”.
“Morphology Open” applies erosion followed by dilatation (for more details refer e.g. to https://en.wikipedia.org/wiki/Mathematical_morphology).
“Clean Mask” includes the filling of holes up to a pixel number given by “Hole Size” and the removal of fragments up to a pixel number given by “Object Size”. Holes are background patches completely enclosed by plant pixels and vice versa. If the option “Count Objects” is enabled, the number of plant patches (completely separated by background pixels) is counted. This can be useful e.g. when imaging seeds.
“Calculate Metric Values” adds the converted pixel values in mm to the output file based on the current calibration and pixel-to-mm ratio (see also the next chapter on camera calibration). If everything is set, the batch mode for image filtering and post-processing is started by pressing the “Start”-button on the bottom right. Be aware that depending on the image size and chosen post-processing options the processing time can be up to one minute per image. Especially the “Clean Mask” option is very time consuming. Pressing “Return” on the bottom center will lead back to the Live-screen without batch processing any images. The output, which is stored in a time-labeled folder in the current project folder, consists of two classes of images, a text-file with the parameter settings and a csv-file with quantified traits (the available traits are listed in the table). The first image class with the file name ending ‘trait’ is a binary classification of object and background. The second class “mask” is the masked original, i.e. each color image is masked with the corresponding binary classification. The csv-file contains all trait values that can be quantified with PSM either for the entire image or for each image segment, depending on whether “Count Objects” is enabled or not.
Table: List of available traits
Projected Leaf Area (PLA)
segment-wise pixel sum
px / mm²
Length of Segment Contour
px / mm
maximum horizontal segment strech
px / mm
maximum vertical segment strech
px / mm
average intensity in the red channel
average intensity in the green channel
average intensity in the blue channel
average intensity in the hue channel
average intensity in the saturation channel
average intensity in the value channel
The PSM app is also capable to deliver metric projected leaf area values in the batch processing output. This ensures comparability between images taken from different distances. In this case each set of images (captured at the same distance to the object) requires an extra calibration and therefore needs to be processed separately. For calibration a target with a checkerboard image is required. It should contain at least 4 x 4 fields (a pdf with a suitable checkerboard image is available as download). Calibration data is stored project-wise. Therefore a project needs to be defined or activated prior to the calibration. The camera calibration can be reached by pressing the LB button – “App Configuration” à Camera Calibration. Here, you insert the number of crossing points in X- and Y-direction and the edge length of a field, e.g. a checkerboard with 7 x 6 fields contains 6 x 5 crossing points. When pressing “Calibrate” a live image is displayed and as soon as the software recognizes the target colored lines are displayed. By touching the live screen the pattern is analyzed and can be saved by pressing the “Save” button. In order to use the calibration in batch processing mode, the option “Calculate Metric Values” needs to be activated there. Take into account that converted values are only representative, if the object was imaged at the same distance like the calibration distance and if the object is rather flat. This works especially well for single leaves with a flat surface structure.