MATLAB Programming/Psychtoolbox/Screen Commands/GetImage

From Wikibooks, open books for an open world
Jump to navigation Jump to search



Slowly copy an image from a window, returning a MATLAB uint8 array. If the window's pixelSize>8 then the returned imageArray has three layers, an RGB image. rect is in window coordinates, and its default is the whole window.

As of April, 1998, imageArray is now uint8 instead of double to save space (a factor of 8). However, MATLAB will issue an error if you try to do math on a uint8 array, so you may need to use DOUBLE to convert it, e.g. imageArray/255 will produce an error, but double(imageArray)/255 is ok. Also see PutImage and CopyWindow.