Exemplo Embrapa

15 views
Skip to first unread message

Daniel Sarto Rocha

unread,
Jun 28, 2020, 6:14:36 PM6/28/20
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
Boa Noite Filipe!
Tudo Bem?

Eu tentei rodar o exemplo da Embrapa, mas na hora de contar as sementes esverdeadas os pontos foram colocados onde não há sementes.
Você pode me ajudar, por favor?
Desde já Obrigado

O código que usei foi esse:

# Necessary packages 
library(FIELDimageR)
library(raster)
library(ggplot2)
library(agricolae)
library(reshape2)
library(lme4)

# Uploading one image as example and decreasing the resolution
EX1<-stack("soybean/11.jpg")
EX1<-aggregate(EX1, fact= 4)
plotRGB(EX1)

# extent=T (The whole image area will be the shapefile)
EX.shapeFile<-fieldPolygon(EX1,extent = T)

# Select one index to identify leaves and remove the background
EX1.I1<- fieldIndex(mosaic = EX1,index = c("SI","BGI","BI"))

# Thresholding
dev.off()
par(mfrow=c(1,2))
hist(EX1.I1$BGI)
plot(EX1.I1$BGI)

# 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"))

#BI index
plot(EX1.I2$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))

Foto das contagens:



A versão do R é R x64 3.6.3
e do R Studio Version 1.2.5042

fmatias

unread,
Jul 1, 2020, 9:16:24 AM7/1/20
to FIELD...@googlegroups.com

Oi Daniel obrigado por perguntar, 


Eu acredito que você esteja usando uma versão antiga do FIELDimageR.

 

Tente excluir a versão que você tem e instalar novamente conforme esse link: https://github.com/OpenDroneMap/FIELDimageR#Instal 

 

Veja se isso resolve,

Abs

Daniel Sarto Rocha

unread,
Jul 1, 2020, 9:24:28 AM7/1/20
to FIELD...@googlegroups.com
Ok. Eu vou tentar. Obrigado

--
You received this message because you are subscribed to the Google Groups "FIELDimageR: A R package to analyze orthomosaic images from field trials." group.
To unsubscribe from this group and stop receiving emails from it, send an email to FIELDimageR...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/FIELDimageR/df26ab92-0a22-4be0-bac2-8dc074e458b5o%40googlegroups.com.

Daniel Sarto Rocha

unread,
Jul 1, 2020, 7:27:26 PM7/1/20
to FIELD...@googlegroups.com
Eu reinstalei e deu certo.
Obrigado!
--
Daniel Sarto Rocha
Eng° Agrônomo
Piracicaba-SP

fmatias

unread,
Jul 2, 2020, 11:40:15 AM7/2/20
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
Ótimo, fico feliz...!!!
Abs
Reply all
Reply to author
Forward
0 new messages