如果是MATLAB的话,循环错了,应该是这样for i = 1:m for j =1:n B(i,j) = 255 - A (i,j); endend
p=imread('filename.bmp');i=rgb2gray(p);%i就是灰度矩阵
B=255-A(i,j);