Converting an image to binary using threshold
In the following example 0.5 is the threshold to decide threshold of g, if g’s value is above 0.5, the A’s corresponding value is 1, otherwise it’s 0.
Example
>> g g = 0.0980 0.1961 0.5020 0.7843 >> A = im2bw(g,0.5) A = 0 0 1 1
We can also decide this threshold directly by evaluating with corresponding array as :
Example
>> g g = 0.0980 0.1961 0.5020 0.7843 >> A = g > 0.5 A = 0 0 1 1