I am using the EBImage package and the otsu() function to convert a red-green-blue band raster into a binary image. I am working with geographif .tiff files.
My main issue is that the rasters are saved with -3.40282e+38 as nodata values and the minimum values of my raster is -0.31. While computing the otsu threshold the nodata values are being included.
Setting a range for the otsu function, otsu(x, range = c(0, 1), levels = 256) does not work. The function results in the following error:
Error in otsu(image, range = c(-0.31, 2)) : unused argument (range = c(-0.31, 2))
How can I remove all values below the minimum value of my raster image using the EBImage package as my final goal is to compute the threshold value using the same package?
histogram of the image
```#read rgb raster layer image = readImage("I:/00_bunku/00_data_processing/04_orthomosaics/VIs/330_old_OP_sparse_vari.tif")
display(image, method = 'raster')
hist(image)
otsu(image, range = c(-0.31,2))