未定义功能'登录'类型'UINT8“的输入参数 [英] Undefined function 'log' for input arguments of type 'uint8'
本文介绍了未定义功能'登录'类型'UINT8“的输入参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在试图生成图像。
i have been trying generate an image.
C1 = imread(InputImage);
NumberOfGrayLevels=32;
I= 0.299*C1(:,:,1)+0.587*C1(:,:,2)+0.114*C1(:,:,3);
C = 0;
I=(C*log(I+1))';
new=uint8(mat2gray(I)*(NumberOfGrayLevels-1));
[m,n]= size(new);
rgb = zeros(m,n,3);
rgb(:,:,1) = new;
rgb(:,:,2) = rgb(:,:,1);
rgb(:,:,3) = rgb(:,:,2);
new = rgb/256;
imshow(new,[]);
no9=figure;
image(new);
错误是表示I =(C *日志(I + 1))'; ..你能告诉我怎么解决这个
the error is showing at I=(C*log(I+1))';..can you tell me how to solve this?
推荐答案
最有可能的 C1
的类型为 UINT8
。你应该把它转换,即:
Most probably C1
is of type uint8
. You should convert it, i.e.:
C1 = imread(InputImage);
C1 = double(C1);
NumberOfGrayLevels = 32;
I = 0.299*C1(:,:,1) + 0.587*C1(:,:,2) + 0.114*C1(:,:,3);
.....
如果你不转换 C1
到双击
,那么 I
也将键入 UINT8
- 它不包含你想要什么,登录
功能将无法正常工作吧。
if you don't convert C1
to double
, then I
will also be of type uint8
- it will not contain what you want and log
function will not work with it.
这篇关于未定义功能'登录'类型'UINT8“的输入参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文