OpenDroneMap / FIELDimageR

FIELDimageR: A R package to analyze orthomosaic images from agricultural field trials. This package is a compilation of functions to analyze pos-mosaicking images from research fields, and allows to: crop the image; remove soil effect; build vegetation indices; rotate the image; build the plot shapefile; extract information for each plot; and evaluate stand count, canopy percentage, and plant height.
GNU General Public License v2.0
230 stars 89 forks source link

Modifying fieldIndex to add more VIs #46

Open pjjagwe opened 11 months ago

pjjagwe commented 11 months ago

Hi @filipematias23, I added more VIs to the Indices.txt file used to run the fieldIndex function.

image

When i run this code; X.Indices2 <- fieldIndex2(X.RemSoil$newMosaic,Red=1,Green=2,Blue=3,RedEdge=4,NIR=5, index = c("NDVI","NDRE", "BI", "SCI", "GLI", "HI","NGRDI", "SI", "VARI", "HUE", "BGI", "PSRI", "GNDVI", "RVI", "TVI", "CVI", "CIG", "CIRE", "DVI", "EVI", "GDVI","GLI","GOSAVI","GRVI", "GEMI","GARI" ,"GSAVI","IPVI","LAI", "MNLI","MSAVI2","MSR","NLI","OSAVI","RDVI","SAVI","TDVI","VARI","WDRVI","SR"))

I get an error: Error in eval(parse(text = as.character(Ind$eq[as.character(Ind$index) == : object 'EVI' not found In addition: Warning messages: 1: In for (f in 1:length(filename)) { : closing unused connection 4 (C:/Users/pjjagwe/AppData/Local/Temp/RtmpaOFv1e/raster/r_tmp_2023-08-25_181651.200041_16852_88055.gri) 2: In for (f in 1:length(filename)) { : closing unused connection 3 (C:/Users/pjjagwe/AppData/Local/Temp/RtmpaOFv1e/raster/r_tmp_2023-08-25_180154.128608_16852_62923.gri)

pjjagwe commented 11 months ago

@filipematias23 Could you kindly share some insight.

Thanks

filipematias23 commented 11 months ago

Hi there, try using the parameter "myIndex" in fieldIndex(). You can write the new indices direct in the coding. Here is one example:

Test.Indices<- fieldIndex(mosaic = Test, Red = 1, Green = 2, Blue = 3, RedEdge=4, NIR=5, index = c("NGRDI","NDVI"), myIndex = c("Write your Index", "Write your Index", "2*Green/Blue"))

Hope it helps...!

All the best, Filipe

pjjagwe commented 10 months ago

Thanks @filipematias23