when I calculate threshold using entropy and the convert grayscale image to binary image using imbinarize(img,T) it shows the error. How to deal with this error
1 Answer
imbinarize uses a 256 bin image histogram to compute Otsu's threshold, so it expects a 'uint' image.
From the error we can deduce that your image is double, so just convert it to uint:
img = im2uint8(img)
and then run imbinarize on top of im
im_binarized = imbinarize(img,T)
EDIT:
Also your problem might be that you don't have the image processing toolbox installed.
You can threshold an image without the toolbox, just do:
im_binarized = im > T; % where T is your threshold
2 Comments
sohna pathak
Undefined function 'im2unit8' for input arguments of type 'double'. show this error