[英]Matlab Error: Undefined function 'knnclassify' for input arguments of type 'double'
[英]Error - Undefined function 'imbinarize' for input arguments of type 'double' in matlab
當我使用熵計算閾值,並使用imbinarize(img,T)將灰度圖像轉換為二進制圖像時,將顯示錯誤。 如何處理這個錯誤
imbinarize
使用256 bin圖像直方圖來計算Otsu的閾值,因此期望使用“ uint”圖像。
從錯誤中我們可以推斷出您的圖像是double
,因此只需將其轉換為uint
:
img = im2uint8(img)
然后在im之上運行imbinarize
im_binarized = imbinarize(img,T)
編輯:
另外,您的問題可能是您沒有安裝圖像處理工具箱。
您可以在沒有工具箱的情況下對圖像進行閾值處理,只需執行以下操作:
im_binarized = im > T; % where T is your threshold
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.