imageArray=
Screen('
GetImage', windowPtr
[,rect
] [,bufferName
] [,floatprecision=
0] [,nrchannels=
3])
Slowly copy an image from a window or texture to Matlab/Octave, by default
returning a uint8 array. The returned imageArray by default has three layers,
i.e. it's an RGB image. "windowPtr" is the handle of the onscreen window,
offscreen window or texture whose image should be returned. "rect" is the
rectangular subregion to copy, and its default is the whole window.
Matlab/Octave will complain 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
Screen '
PutImage' and '
CopyWindow'.
"bufferName" is a string specifying the buffer from which to copy the image: The
'bufferName' argument is meaningless for offscreen windows and textures and will
be silently ignored. For onscreen windows, it defaults to 'frontBuffer', i.e.,
it returns the image that your subject would see at that moment. If
frame-sequential stereo mode is enabled, 'frontLeftBuffer' returns what your
subject would see in its left eye, 'frontRightBuffer' returns the subjects
right-eye view. If double-buffering is enabled, you can also return the
'backBuffer', i.e. what your subject will see after the next
Screen('
Flip')
command, and for frame-sequential stereo also 'backLeftBuffer' and
'backRightBuffer' respectively. 'aux0Buffer' - 'aux3Buffer' returns the content
of
OpenGL AUX buffers 0 to 3. Only query the AUX buffers if you know what you
are doing, otherwise your script will crash. This is mostly meant for internal
debugging of PTB. If the imaging pipeline is enabled you can also return the
content of the unprocessed backbuffer, ie. before processing by the pipeline, by
requesting 'drawBuffer'.
"floatprecision" If you set this optional flag to 1, the image data will be
returned as a double precision matrix instead of a uint8 matrix. Please note
that normal image data will be returned in the normalized range 0.0 to 1.0
instead of 0 - 255. Floating point readback is only beneficial when reading back
floating point precision textures, offscreen windows or the framebuffer when the
imaging pipeline is active and HDR mode is selected (ie. more than 8bpc
framebuffer).
"nrchannels" Number of color channels to return. By default, 3 channels (RGB)
are returned. Specify 1 for Red/Luminance only, 2 for Red+Green or
Luminance+Alpha, 3 for RGB and 4 for RGBA.
[imageOrPtr, width, height, channels, extType, extFormat
] = PsychKinect
('
GetImage', kinectPtr
[, imtype=
0][, returnTexturePtr=
0]);
Return the color image data for the frame fetched via '
GrabFrame'.
If 'returnTexturePtr' is zero (default), a uint8 3D image matrix is returned,
which could be directly fed to image processing toolbox, imwrite() or
Screen('
MakeTexture').
'imtype' if set to 1 returns a color-coded depth image instead of the RGB camera
image.
If 'returnTexturePtr' is one, a double-encoded memory pointer to a RGBA8
rectangle texture buffer is returned, for use with
Screen('
SetOpenGLTextureFromMemPointer') for injection into PTB's texturing
system.