Learn R Programming

rPAex (version 1.0.1)

imageField: Matching Pixels With Field Book

Description

The function uses the raster image of all bands. It generates the limits of the unit and extracts the values of each pixel of the plot n x m units (n, m = 1,2, ...). The function requires the dimensions of the unit observed and the number of units per row (width) and column (length). The result is a table with image information and the characteristics of the experimental unit.

Usage

imageField(r, P, nPl, nPw, long, wide,  ploting = TRUE, ...)

Value

parameters

Parameters of experimental design in precision agriculture

Qbase

Image data frame with location in field

Arguments

r

raster image

P

References points of de area

nPl

Number of experimental units along the plot (X axis)

nPw

Number of experimental units across the plot (Y axis)

wide

Wide of unit plots

long

Long of unit plots

ploting

Overlap the units in the area, TRUE or FALSE

...

Other parameters the plot

See Also

borderPoint, externalPoint, fixedPoint, fourPoint, designRaster, movePlot

Examples

Run this code
library(rPAex)
crop <- system.file("external/cassava.csv", package="rPAex")
s<-read.csv(crop,header = TRUE)
r <- raster::rasterFromXYZ(s)
#-----
# P<-locator(3)
P<-list(x=c(287698.21, 287700.99, 287702.39), y=c(8664200.68, 8664201.57,8664190.63))
Q<-fourPoint(P)
#-----
nPl<-11; nPw<-3; long=1; wide=0.9
raster::image(r,useRaster=FALSE,main="Cassava crop\nnear infrared image")
img<-imageField(r, P=Q, nPl, nPw, long, wide, ploting = TRUE, border="blue",lwd=1)
R<-img$Qbase
head(R)
q<-agricolae::tapply.stat(R[,2:3],R[,1],mean)
text(q[,2],q[,3],q[,1],cex=1)

Run the code above in your browser using DataLab