Iimg1=double(rgb2gray(imread('img1.png'))); img2=double(rgb2gray(imread('img2.png'))); 这样就可以将可以将可以将图像从RGB转化为灰度图