Error in seq.default(x$from, x$to) : 'to' must be a finite number

213 views
Skip to first unread message

Artūrs Katamadze

unread,
Nov 13, 2023, 3:00:53 PM11/13/23
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
Hi, sorry to keep bothering you guys.


Since the upgrade of the FIeldImageR packadge I am receiving this error (Error in seq.default(x$from, x$to) : 'to' must be a finite number) when i try to visualize my Orthomosaic. Previously some one mentioned that there is something wrong with my Orthomosaic, and if so i am not sure what it is. I use Agisoft and follow the official tutorial completely. With the previous version of FIeldImageR it worked well. 

If anyone has any ideas i would appreciate it. 

Filipe Matias

unread,
Nov 13, 2023, 3:04:44 PM11/13/23
to FIELD...@googlegroups.com
Hey Arthur,

Can you share your ortho and script? Without having the same error on our examples is hard to help.

Best, 
Filipe 

--
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/eee2de56-652f-4d63-8de2-5f747eec4c51n%40googlegroups.com.

Artūrs Katamadze

unread,
Nov 13, 2023, 3:44:07 PM11/13/23
to FIELD...@googlegroups.com
Yes of course. Here are 2 versions of my Ortho. This is oriented which I normally use since I don't have to crop and rotate https://files.fm/u/ve3du93av2
And here is the original (here I am experiencing a different error, that is in another thread) https://failiem.lv/u/vusf5ke764

I hope you can bring some clarity, been struggling with this question for a while now.





fmatias

unread,
Nov 14, 2023, 5:29:16 AM11/14/23
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
Hi Artur,

I was able to see both of your images (original and oriented) using fieldView(). 

I also tried a new PC (installing FIELDimageR and FIELDimageR.Extra for the first time) and it worked great!

Capture.JPG

Here is the code:

###################
### FIELDimageR ###
###################

devtools::install_github("filipematias23/FIELDimageR.Extra")
devtools::install_github("OpenDroneMap/FIELDimageR")

# Packages:
library(FIELDimageR)
library(FIELDimageR.Extra)
library(terra)
library(mapview)
library(sf)
library(stars)
library(leafsync)

# Uploading an example mosaic
Test_1 <- rast("Original.tif")
Test_2 <- rast("Oriented.tif")

# Visualization Option-01 (FIELDimageR.Extra):
m1<-fieldView(Test_1)
m2<-fieldView(Test_1)

sync(m1,m2)

###########
### END ###
###########



I am not sure what is going on on your PC... What R and RStudio versions?

Best,
Filipe

fmatias

unread,
Nov 14, 2023, 6:36:42 AM11/14/23
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
Hi Artur,

I am sorry, I was looking only at the original data ... You are right, there is something about your orthos that it is not being recognized by the functions. We need to dig more into that!

I only visualized the Original image using fieldVIew() the Oriented didn't work because of projection. However, I could see that fieldIndex() is running for both orthos:

Rplot.jpeg  Rplot02.jpeg

I also tried fieldShape_render() and it didn't work for your original image but one way around is using only one index to create the grid shape. Check this example with ncols = 2 and nrows = 4. It worked...!

Capture.JPG Capture1.JPG

Maybe it can help you for now until we figure out what is going on ... I would recommend reprocessing your orthos and using the default parameters from the software to see what happens. Maybe if you share your raw images we can try running it on different ortho-making software and compare results.

Here is the code I am using:

###################
### FIELDimageR ###
###################

# devtools::install_github("filipematias23/FIELDimageR.Extra")
# devtools::install_github("OpenDroneMap/FIELDimageR")


# Packages:
library(FIELDimageR)
library(FIELDimageR.Extra)
library(terra)
library(mapview)
library(sf)
library(stars)
library(leafsync)
library(mapedit)


# Uploading an example mosaic
Test_1 <- rast("Original.tif")
Test_2 <- rast("Oriented.tif")

# Visualization Option-01 (FIELDimageR.Extra):
fieldView(Test_1)
fieldView(Test_2)
# There is a error in the image projection!

### Vegetation Indices

Test.Indices_1<- fieldIndex(mosaic = Test_1, Red=3,Green=2,Blue=1,RedEdge=4,NIR=5,
                            index = c("NGRDI","BGI"),
                            myIndex = c("(Red-Blue)/Green"))

Test.Indices_2<- fieldIndex(mosaic = Test_2, Red=3,Green=2,Blue=1,RedEdge=4,NIR=5,
                         index = c("NGRDI","BGI"),
                         myIndex = c("(Red-Blue)/Green"))

# Shape:

FieldShape<-fieldShape_render(mosaic = Test.Indices_1$NGRDI,
                                  ncols = 2,
                                  nrows = 4)

fieldView(mosaic = Test.Indices_1$NGRDI,
          fieldShape = FieldShape,
          type = 1,
          alpha_grid = 0.2)

# Correcting Projection -
It didn'twork yet !

LCC <- "+init=EPSG:3347"
WGS84 <- "+init=EPSG:4326"
NAD83 <- "+init=EPSG:4269"
WClim_CRS <- "GEOGCRS[\"WGS 84\",\n    DATUM[\"World Geodetic System 1984\",\n        ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n            LENGTHUNIT[\"metre\",1]]],\n    PRIMEM[\"Greenwich\",0,\n        ANGLEUNIT[\"degree\",0.0174532925199433]],\n    CS[ellipsoidal,2],\n        AXIS[\"geodetic latitude (Lat)\",north,\n            ORDER[1],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        AXIS[\"geodetic longitude (Lon)\",east,\n            ORDER[2],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n    ID[\"EPSG\",4326]]"

Test_2 <- terra::project(Test_2, WGS84) # R crashes lol
fieldView(Test_2)

###########
### END ###
###########



Hope it helps for now...!

All the best,
Filipe

Artūrs Katamadze

unread,
Nov 14, 2023, 8:18:36 AM11/14/23
to FIELD...@googlegroups.com
Thanks for your efforts Filipe!

I am using Agisoft following their guide on ortho creation (Link). I have also tried Pix4Dfields, but the result is the same as Test_1. I have not tried using WebODM, I guess the radiometric calibration is a bit more complicated. 
Here are the photos obtained from Altum Link 

Let me know if there is anything more I can provide.


Best,
Artūrs


You received this message because you are subscribed to a topic in the Google Groups "FIELDimageR: A R package to analyze orthomosaic images from field trials." group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/FIELDimageR/SwLYH_DKa_0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to FIELDimageR...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/FIELDimageR/5b6eeb62-e443-44ec-bc67-0752fa0e9ce8n%40googlegroups.com.

fmatias

unread,
Nov 18, 2023, 11:11:58 AM11/18/23
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
Hi Arturs,

The software that I have here did not work for your images ... I am sorry!

Does the strategy to use index to draw the grid shape file worked for you?

Also, you can try using QGIS and this Draw_Plots_QGIS_Tool to make it: https://www.youtube.com/watch?v=wrPPKSniXW0&t=2s 


Best,
Filipe

Reply all
Reply to author
Forward
0 new messages