How to exclude NaN values from evaluation on raster data

I have a raster which have NaN values. I would like to evaluate graythresh for my data, but the NaN values are taken into account and as a results I have 0 (zero). Is there a way to exclude NaN values from evaluation or remove them from data?

 Réponse acceptée

x_no_nans = x(~isnan(x))

4 commentaires

... and then graythresh(x_no_nans). graythresh() does not care what order the data is in.
I have one more question, if the implementation of Otsu method in matlab is sensitive for very small values? I have one dataset with values between 0-1, but the majority of values is smaller than 0.004, so evaluated threshold is 0. The threshold is visible on image, but the algorithm cannot find it, and I think it is due to very small values.
What is EM, the effectiveness metric output? Otsu is not great for all images, it's really only for when there is an object in the foreground.
Karolina
Karolina le 7 Août 2015
Modifié(e) : Karolina le 7 Août 2015
I have two datasets where the threshold is zero. EM is for these data: 0.9862, and 0.5902

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by