%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Siddhartha Kasivajhula % PSYCH 221/ EE 362 (Winter 2007-2008) % Final Project: A Probabilistic Model of the Visual System % % GenerateScene.m % REPRESENTATION OF A SCENE % % A scene is modeled as a set of features, each of which is % represented as a vector of zeros with a 1 at an index % corresponding to the feature that is present in the scene % For example, if we have 10 possible features, then % f_i = [0 0 0 1 0 0 0 0 0 0] represents feature #4. % % This "function" generates a scene, in accordance with the definition % above. % % Arguments are: % NUM_FEATURES is the size of the feature space, i.e. the total number of % features available. % % scene_features is a vector of features contained in the scene (feature % indices, not feature vectors) % Ex: scene_features = [1 4 6 7 9 10] means features 1, 4, 6, 7, 9, and 10 % are present in the scene. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function scene = GenerateScene(NUM_FEATURES, scene_features) % uniquely represent all possible features as vectors all_features = eye(NUM_FEATURES); scene = []; for i=1:size(scene_features, 2) scene = [scene; all_features(scene_features(i), :)]; end