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-2008 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 isa(Image.data,'uint8') 0023 imgData = im2double(Image.data); 0024 elseif isnan(Image.data) 0025 imgData = im2double(imread([IMG_DIR Image.filename])); 0026 else 0027 imgData = Image.data; 0028 end