我正在尝试为 IP 编写最佳量化。我是 matlab 新手,在这段代码中,我试图遍历 Z 的每个间隔中的每个像素,将其与直方图相乘并求和,这样我就可以计算出最佳 Q。
问题 :Attempted to access hist(257);index out of bounds because numel(hist)=256.
for i=1:K,
for j=(Z(i)):Z(i+1),
sum1=(j)*hist(j+1)+sum1;
count=count+hist(j+1);
end
end