问题:如何导入图片到MATLAB
解决:
Image1 = imread('E:\Graduate project\Database\test\subject01.centerlight.gif'); % 括号内为绝对路径
Image2 = imread('subject01.centerlight.gif'); %使用文件相对路径
Image3 = imread('subject01.centerlight','GIF'); %注意文件只有文件名,无后缀(不区分大小写),记着加引号
imshow(Image1);%显示
IMREAD Read image from graphics file.A = IMREAD(FILENAME,FMT) reads a grayscale or color image from the file specified by the string FILENAME. If the file is not in the current directory, or in a directory on the MATLAB path, specify the full pathname.
The text string FMT specifies the format of the file by its standard file extension. For example, specify 'gif' for Graphics Interchange Format files. To see a list of supported formats, with their file extensions, use the IMFORMATS function. If IMREAD cannot find a file named FILENAME, it looks for a file named FILENAME.FMT.
The return value A is an array containing the image data. If the file contains a gray scale image, A is an M-by-N array.