我正在编写以下matlab代码,使用我的GUI在轴上显示16位tiff图像:
I1 = gpuArray(reshape(linspace(0,1,20),[5 4])); %performs the conversion on a GPU.
W = gather (I1);
[I1,map] = imread(fullname);
imshow(I1,map)
myImageAsGray = rgb2gray(map)
%graycomatrix ignores pixel pairs if either of the pixels contains a NaN,
%replaces positive Infs with the value NumLevels,
%replaces negative Infs with the value 1.
%ignores border pixels, if the corresponding neighbor pixel falls outside the image boundaries
graycomatrix(I1, 'offset', [0 1], 'Symmetric', true)
graycomatrix(I1, 'offset', [0 1], 'Symmetric', false)
graycomatrix(I1, 'offset', [0 -1], 'Symmetric', false)
imshow(myImageAsGray)
imagesc(myImageAsGray)
我可以打开并显示图像(我也尝试使用ind2rgb)但是报告了一条错误消息:
:
Error using rgb2gray>parse_inputs (line 81)
MAP must be a m x 3 array.
Error in rgb2gray (line 35)
X = parse_inputs(varargin{:});
Error in que (line 9)
I = rgb2gray(old_image);
我该如何解决问题?