'How to use imbinarize function in matlab correctly when the input is a 3D data
I am trying to use Otsu's thresholding method on my 3D matrix by using "imbinarize" function on Matlab. There are no error warnings, but the result is incorrect. If I compare the original 3D matrix to the thresholded model, the thresholded model looks very bad.
This is the code that I ran on Matlab:
T2=graythresh (data);
BW2=imbinarize(data,T2);
BW2=single(BW2);
figure ();
volshow(BW2);
figure ();
volshow(data);
After imbinarize my single data turns into a logical data, so I added BW2=single(BW2) for consistency. I feel like the issue is caused by turning the single data to logical data. Before and after adding this line.
Here are my results. The left model is the thresholded result and the right model is the original one.

After comment of Alamakanambra I changed normalized my input before using imbinarize, which led to a better result, but the visualization of the data is still different (e.g. texture).

I don't understand why my output is worse than my input. What have I done wrong?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


