r code for single images not for orthomosaic image

148 views
Skip to first unread message

Alok

unread,
Dec 17, 2020, 9:27:44 AM12/17/20
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
I am trying to estimate vegetation indices value for a single images ,but i am facing problem at the last code while i run code ,it appears error .
the code are -
library(FIELDimageR)
sample<-list.files("./sample/")
test<-stack(paste("./sample/",sample[3],sep = ""))
plotRGB(test)
test.crop<-fieldCrop(mosaic = test)
test.remSoil<-fieldMask(test.crop)
plotshape=fieldPolygon(mosaic=test.crop,extent = T)
plotshape=plotshape$fieldShape
test.indices<-fieldIndex(mosaic = test.remSoil$newMosaic,Red = 1,Green = 2,Blue = 3,index = c("NGRDI","SCI"),myIndex = c("Green/(Green+Red+Blue)"))
plot(test.indices$NGRDI)
test.info<-fieldInfo(mosaic = test.indices[[c("NGRDI","SCI","myIndex")]],fieldShape = plotshape,fun = "mean",n.core = 3,projection = TRUE)

error -Error in if (projection(fieldShape) != projection(mosaic)) { : 
  missing value where TRUE/FALSE needed

please, help me to solve this error
 

fmatias

unread,
Dec 20, 2020, 10:27:23 AM12/20/20
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
Hi Alok,

When running single images you can use projection = F to fix this problem.

All the best,
Filipe

Alok

unread,
Dec 20, 2020, 11:18:45 AM12/20/20
to FIELD...@googlegroups.com
Thank you, Filipe.
There are some  Question -
1. while I am removing soil, the resolution of the image reduces. why? How I can get original pixel resolution.
2. I have only RGB image, and I am trying to find out indices, please clarify, whether these indices based on reflectance value or pixel value of each band.
3. How I can find out the pixel value of vegetation in an image.

regard,
Alok Kumar Maurya


--
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/0e31686b-4847-4639-b921-2996beb7e716n%40googlegroups.com.

fmatias

unread,
Dec 29, 2020, 11:08:48 AM12/29/20
to FIELDimageR: A R package to analyze orthomosaic images from field trials.

Hi Alok, thank you for asking…!

1. while I am removing soil, the resolution of the image reduces. why? How I can get original pixel resolution.

A: The code does not reduce image resolution. Only if you are using the function “aggregate()” from the “raster” package. Maybe you are seeing pixels around the plants (mix of green and brown) that the mask didn’t remove (In this case, you need to change the index to remove the soil). Could you share your image before and after removing the soil step?

 

2. I have only RGB image, and I am trying to find out indices, please clarify, whether these indices based on reflectance value or pixel value of each band.

A: The function uses the relative value from pixels in the image. The user should make the transformation from a digital number to a reflectance number. You need to check how to do it in your Camera (Sensor) manual.  

 

3. How I can find out the pixel value of vegetation in an image.

A: You can extract information from the image using the function “fieldInfo()” (https://github.com/OpenDroneMap/FIELDimageR#P9) or “fieldDraw()” (https://github.com/OpenDroneMap/FIELDimageR#P11). But if you want to know the information of one unique point (pixel) you can use the function “identify()” (https://stat.ethz.ch/R-manual/R-patched/library/graphics/html/identify.html).

 

Let me know if you have more questions.

All the best and happy new year,

Filipe

Alok

unread,
Jan 30, 2021, 7:33:57 AM1/30/21
to FIELDimageR: A R package to analyze orthomosaic images from field trials.

Thanks, Filipe
Here I have a question, while I am uploading an image in r it looked like a full-frame, but when I cropped the image and save it into the device it comes with a black rectangular frame and some white background. as I have attached images (output from R). please suggest me to how to get only full-frame images as output and you can check how image quality reduces after uploading in R.
thank you,
output from R.png

fmatias

unread,
Jan 30, 2021, 2:37:55 PM1/30/21
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
Hi Alok,

There are many ways to save images or rasters from R. 

In the tutorial, I used a simple way to be easier to upload it back into the R. But you can save it on TIFF, JPG, PDF, etc. 

Here is some material from where you can start your searching:

All the best,
Filipe

Alok

unread,
Jan 30, 2021, 9:54:13 PM1/30/21
to FIELD...@googlegroups.com
thanks, Filipe for your suggestion.
but can use save as window in r studio to save the file. the original file dimension is 4032*3024, while the output file resolution is 863*536. this means your codes reduces image resolution by which the quality of images also reduces.
please suggest to me, how to get the original resolution of masked images.
thank you,

Alok Kumar Maurya
(M.Tech- Land and Water Resource Engineering)
Indian Institute of Technology, Kharagpur
Kharagpur, West Bengal – 721302


--
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/B2USyXIq9hQ/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/d573428f-8542-4816-99af-ff1098c53a89n%40googlegroups.com.

fmatias

unread,
Jan 31, 2021, 4:39:25 PM1/31/21
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
Hi Alok,

Probably you are using the function called aggregate()

I normally use this function on my pipelines to reduce the picture resolution and make the analysis faster.

If you are extracting the plot average (e.g., vegetation indices, height, etc.)  the resolution does not affect the final results as I explained here: https://github.com/OpenDroneMap/FIELDimageR#P12 

If you need the original resolution you should remove this function (aggregate) from your code.

Please, let me know if it makes sense.

All the best,
Filipe
Reply all
Reply to author
Forward
0 new messages