loadImage - returns the imgData for the Image structure imgData = loadImage(Image) Returns the imgData from one of two sources: (1) If Image.data is valid, it is returned after conversion to double (if necessary). (2) Otherwise, the image is loaded from [IMG_DIR Image.filename], converted to double and returned. See also initializeImage, dataStructures.
0001 % loadImage - returns the imgData for the Image structure 0002 % 0003 % imgData = loadImage(Image) 0004 % Returns the imgData from one of two sources: 0005 % (1) If Image.data is valid, it is returned after conversion 0006 % to double (if necessary). 0007 % (2) Otherwise, the image is loaded from [IMG_DIR Image.filename], 0008 % converted to double and returned. 0009 % 0010 % See also initializeImage, dataStructures. 0011 0012 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2007 0013 % by Dirk B. Walther and the California Institute of Technology. 0014 % See the enclosed LICENSE.TXT document for the license agreement. 0015 % More information about this project is available at: 0016 % http://www.saliencytoolbox.net 0017 0018 function imgData = loadImage(Image) 0019 0020 declareGlobal; 0021 0022 if isnan(Image.data) 0023 imgData = imread([IMG_DIR Image.filename]); 0024 else 0025 imgData = Image.data; 0026 end 0027 0028 if isa(imgData,'uint8') 0029 imgData = im2double(imgData); 0030 end