Home > SaliencyToolbox > loadImage.m

loadImage

PURPOSE ^

loadImage - returns the imgData for the Image structure

SYNOPSIS ^

function imgData = loadImage(Image)

DESCRIPTION ^

 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 Image.filename, 
        converted to double and returned.

 See also initializeImage, dataStructures.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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 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-2013
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 if isa(Image.data,'uint8')
0021   imgData = im2double(Image.data);
0022 elseif isnan(Image.data)
0023   imgData = im2double(imread(Image.filename));
0024 else
0025   imgData = Image.data;
0026 end

Generated on Thu 18-Jul-2013 06:10:46 by m2html © 2005