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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.