Determine a threshold of backscatter intensity with Otsu method on Matlab to detect water from non-water pixel using Sentinel-1 data

I am using the Sentinel-1 data.
I am learning to code on Matlab to detect water pixels by setting a threshold with Otsu method. Can anyone guide me how to do it? An aapply spatial window with Otsu method to process?

In Matlab you directly have a syntax for finding the threshold using Otsu’s method. Kindly, refer to this LINK you will find the syntax.

1 Like

Thank you for your help.

  1. Which format are you using as input to Matlab?
  2. Do we need to grayscale S1 first?
  1. TIFF
  2. Already S1 data is a grayscale image by default since it is captured in microwave range.

"Undefined function or variable ‘otsuthresh’.

Error in Test (line 9)
T = otsuthresh(counts);"
got this error, Is outsuthresh function working?

outsuthresh function works well for me. Try to maintain indentation as it is mentioned in the LINK

1 Like

I have tried. Another question is did you use otsu method to detect flood successfully?