Otsu threshold segmentation using EBImage
1
0
Entering edit mode
@1a06bf5e
Last seen 4 weeks ago
Germany

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

EBImage • 201 views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 3 hours ago
United States

It's very likely that you have another package loaded that is masking otsu from EBImage, in which case you can use EBImage::otsu instead. That's the only reason you should get that error, as EBImage::otsu for sure has a range argument.

Login before adding your answer.

Traffic: 874 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6