FIELDimageR:
Performing image analysis in plant breeding programs
Introduction
Image phenotyping platforms
Image phenotyping platforms are a fast and non-invasive tool for phenotyping plant under lab and field conditions. The most common are sensors for imaging. The reflected light captured in these images can be used to draw inference about many traits, including:
- Geometric traits (i.e. plant height, leaf area index, lodging, crop canopy cover)
- Canopy spectral texture (spectral features)
- Physiological traits (i.e., chlorophyll, biomass, pigment content, photosynthesis)
- Abiotic/biotic stress indicators (i.e., stomatal conductance, canopy temperature difference, leaf water potential, senescence index)
- Nutrients (nitrogen concentration, protein content)
- Yield
Image segmentation
Image segmentation is the process of partitioning a digital image into multiple segments (sets of pixels or image objects).
Thresholding
Thresholding is the simplest method of image segmentation. This method is based on a clip-level (or a threshold value) to turn a gray-scale image into a binary image (Mask).
FIELDimageR
FIELDimageR is a R package to analyze images from research fields, and allows to:
- Crop the image
- Remove the background
- Build vegetation indices
- Rotate the image
- Build the plot shapefile
- Extract information for each plot
Datasets (Embrapa Maize & Sorghum)
Required packages
# Installing
install.packages("sp")
install.packages("raster")
install.packages("rgdal")
install.packages("ggplot2")
install.packages("agricolae")
install.packages("reshape2")
install.packages("devtools")
install.packages("parallel")
install.packages("foreach")
install.packages("doParallel")
install.packages("lme4")
devtools::install_github("filipematias23/FIELDimageR")
# Necessary packages
library(FIELDimageR)
library(raster)
library(ggplot2)
library(agricolae)
library(reshape2)
library(lme4)
Embrapa EX1 (
Counting seeds
)
A) Counting green seeds in Soybean:
4 pictures: soybean samples with different green seeds percentage
Number of green seeds (0, 1, 6, and 11)
Donwload:
soybean.zip
# Uploading one image as example and decreasing the resolution
EX1<-stack("soybean/11.jpg")
EX1<-aggregate(EX1, fact= 4)
plotRGB(EX1)
# Select one index to identify leaves and remove the background
EX1.I1<- fieldIndex(mosaic = EX1,index = c("SI","BGI","BI"))
# Removing the background
EX1.R1<- fieldMask(mosaic = EX1, index = "BGI",
cropValue = 0.7,
cropAbove = T)
# Counting the total number of seeds
EX.P.Total<-fieldCount(mosaic = EX1.R1$mask,
fieldShape = EX.shapeFile$fieldShape,
minSize = 0.1,
cex = 1.5,
na.rm = T)
# Select one index to identify green seeds
EX1.I2<- fieldIndex(mosaic = EX1.R1$newMosaic,index = c("SI","BGI","BI"))
# Selecting green seeds
EX1.R2<- fieldMask(mosaic = EX1.R1$newMosaic,
index = "BI",
#myIndex = "Blue",
cropValue = 130,
cropAbove = T)
# Counting the number of green seeds
EX.Green<-fieldCount(mosaic = EX1.R2$mask,
fieldShape = EX.shapeFile$fieldShape,
minSize = 0.07,
cex = 1.5,
na.rm = T)
# Joying information
data.frame(Total=EX.P.Total$fieldCount,
Green=EX.Green$fieldCount,
Percentage=round(EX.Green$fieldCount/EX.P.Total$fieldCount,2))
################
### Parallel ###
################
# Required packages
library(parallel)
library(foreach)
library(doParallel)
# Images names (folder directory: "./soybean/")
pics<-list.files("./soybean/")
# Number of cores
n.core<-2
# Starting parallel
cl <- makeCluster(n.core, output = "")
registerDoParallel(cl)
EX.Table.Parallel <- foreach(i = 1:length(pics), .packages = c("raster","FIELDimageR"),
.combine = rbind) %dopar% {
EX1<-stack(paste("./soybean/",pics[i],sep = ""))
EX1<-aggregate(EX1, fact= 4)
EX.shapeFile<-fieldPolygon(EX1,extent = T,
plot = F)
EX1.R1<- fieldMask(mosaic = EX1, index = "BGI",
cropValue = 0.7,
cropAbove = T,
plot = F)
EX.P.Total<-fieldCount(mosaic = EX1.R1$mask,
fieldShape = EX.shapeFile$fieldShape,
minSize = 0.1,
cex = 1.5,
na.rm = T)
EX1.R2<- fieldMask(mosaic = EX1.R1$newMosaic,
index = "BI",
cropValue = 130,
cropAbove = T,
plot = F)
EX.Green<-fieldCount(mosaic = EX1.R2$mask,
fieldShape = EX.shapeFile$fieldShape,
minSize = 0.07,
cex = 1.5,
na.rm = T)
data.frame(Total=EX.P.Total$fieldCount,
Green=EX.Green$fieldCount,
Percentage=round(EX.Green$fieldCount/EX.P.Total$fieldCount,2))
}
rownames(EX.Table.Parallel)<-pics
EX.Table.Parallel
Embrapa EX2 (
Vegetation indices and plant height
)
B) Vegetation indices and plant height in sorghum:
- 256 sorghum genotypes: granifero, biomassa, forrageiro
- 288 total plots (16 columns and 18 rows)
- Trait: plant height (PH)
- Donwload:
orthophoto.tif