下面是一段读取图像并进行互信息相关计算的一段代码(出错部分):
I=imread(handles.filenameI);
J=imread(handles.filenameJ);
handles.I=I;
handles.J=J;
[a1 b1]=size(I);
[a2 b2]=size(J);
%确定两幅图像的公共区域
if a1>a2
d1=a2;
else
d1=a1;
end
if b1>b2
d2=b2;
else
d2=b1;
end
%计算两幅图像的概率密度分布函数PDF[i,j]
HIST=zeros(256,256);
for i=1:d1
for j=1:d2
HIST(I(i,j)+1,J(i,j)+1)=HIST(I(i,j)+1,J(i,j)+1)+1;
end
end
报错如下:
??? Error using ==> +
Function '+' is not defined for values of class 'uint8'.
Error in ==> C:\Documents and Settings\jeason\桌面\mi\MI.m (pushbutton3_Callback)
On line 162 ==> HIST(I(i,j)+1,J(i,j)+1)=HIST(I(i,j)+1,J(i,j)+1)+1;
Error in ==> E:\朱齐亮\program\matlab\toolbox\matlab\uitools\gui_mainfcn.m
On line 66 ==> feval(varargin{:});
Error in ==> C:\Documents and Settings\jeason\桌面\mi\MI.m
On line 42 ==> gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback.
请高手帮忙看看!谢谢!