www.gusucode.com > MATLAB实现图像的SIFT特征提取,并做在不同光照、不同视角下的特征匹配 > util/imreadbw.m

    function I = imreadbw(file) 
% IMREADBW  Reads an image as gray-scale
%   I=IMREADBW(FILE) reads the image FILE and converts the result to a
%   gray scale image (with DOUBLE storage class anr range normalized
%   in [0,1]).

I=im2double(imread(file)) ;

if(size(I,3) > 1)
  I = rgb2gray( I ) ;
end