Undefined function 'graythresh' for input arguments of type 'uint8'

조회 수: 3 (최근 30일)
Johoon Kim
Johoon Kim 2015년 2월 12일
댓글: minseok kang 2022년 5월 16일
img1=imread('Counting.jpg');
imshow(img1)
img1=rgb2gray(img1);
imshow(img1)
img2=im2bw(img1,graythresh(img1));
imshow(img2)
img2=~img2;
imshow(img2)
B = bwboundaries(img2);
imshow(img2)
text(10,10,strcat('\color{green}Objects Found:',num2str(length(B))))
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'g', 'LineWidth', 0.2)
end
When I type this in, I get an error saying, "Undefined function 'graythresh' for input arguments of type 'uint8'
Does anybody know why? Help would be greatly appreciated.

채택된 답변

Image Analyst
Image Analyst 2015년 2월 12일
You do not have the Image Processing Toolbox installed. Type "ver" on the command line to see what toolboxes you have. imread() and rgb2gray() are both in base MATLAB so that is why you didn't see an error with them even though they were called prior to graythresh().
  댓글 수: 3
madhan ravi
madhan ravi 2018년 11월 9일
Accepted answer by madhan ravi since the OP didn’t

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Bassel
Bassel 2016년 2월 24일
Hello, I have the same problem. although i have installed the "Image Processing Toolbox"
It'll be great if you can help me.
kind regards Bassel
  댓글 수: 2
Image Analyst
Image Analyst 2018년 11월 9일
You may have it installed but don't have a license for it, for example you're in a pool of licenses and all the Image Processing licenses are checked out when you try to check one out. What does this show:
>> hasLicenseForToolbox = license('test', 'image_toolbox') % Check for Image Processing Toolbox.
hasLicenseForToolbox =
1
As you can see, you should see a 1 if there is a license available.
minseok kang
minseok kang 2022년 5월 16일
thank you - from south korea

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by