我试图通过读取图像文件来创建直方图数据:
>> img = imread('Flowers.jpg');
>> g = img(:,:,2);
>> bins = 0:1:255;
>> H = hist(g(:), bins);
?? Error using ==> full
Function 'full' is not defined for values of class 'uint8'.
Error in ==> C:\MATLAB\toolbox\matlab\datafun\hist.m
On line 66 ==> xx = full(real(xx)); y = full(real(y)); % For compatibility
>> version
ans =
6.5.0.180913a (R13)
>> 我不知道为什么我会收到这个错误?
发布于 2014-01-20 12:22:21
如果您有图像处理工具箱,我建议您改用imhist。这将本机处理uint8图像,而不必进行任何转换,并且可以处理二进制和灰度图像。
与hist类似,您可以在没有输出的情况下调用它来直接获取图像,或者获取输出并自己绘制结果。与hist不同,您只能给它一些回收箱(对于灰比例尺,这默认为256个),而不是向量。
img = imread('Flowers.jpg');
g = img(:,:,2);
[counts, x] = imhist(g);
stem(x,counts); % or bar, or whatever you prefer这里的输出x将与您的bins相同。
https://stackoverflow.com/questions/21231254
复制相似问题