[blobid, blobrect] = CreateProceduralGaussBlob(windowPtr, width, height [, backgroundColorOffset =(0,0,0,0)][, disableNorm=0][, contrastPreMultiplicator=1])
Creates a procedural texture that allows to draw “Gaussian blob” stimulus
patches in a very fast and efficient manner on modern graphics hardware.
Parameters and their meaning:
‘windowPtr’ A handle to the onscreen window.
‘width’ x ‘height’ The maximum size (in pixels) of the blob. More
precise, the size of the mathematical support of the blob. Providing too
small values here would ‘cut off’ peripheral parts or your blob. Too big
values don’t hurt wrt. correctness or accuracy, they just hurt
performance, ie. drawing speed. Use a reasonable size for your purpose.
‘backgroundColorOffset’ Optional, defaults to [0 0 0 0]. A RGBA offset
color to add to the final RGBA colors of the drawn blob, prior to
‘disableNorm’ Optional, defaults to 0. If set to a value of 1, the
special multiplicative normalization term normf = 1/(sqrt(2*pi) * sc)
will not be applied to the computed blob. By default (setting 0), it
will be applied. This term seems to be a reasonable normalization of the
total amplitude of the blob, but it is not part of the standard
definition of a blob. Therefore we allow to disable this normalization.
‘contrastPreMultiplicator’ Optional, defaults to 1. This value is
multiplied as a scaling factor to the requested contrast value. If you
set the ‘disableNorm’ parameter to 1 to disable the builtin normf
normalization and then specify contrastPreMultiplicator = 0.5 then the
per blob ‘contrast’ value will correspond to what practitioners of the
field usually understand to be the contrast value of a blob.
The function returns a procedural texture handle ‘blobid’ that you can
pass to the Screen(‘DrawTexture(s)’, windowPtr, blobid, …) functions
like any other texture handle. The ‘blobrect’ is a rectangle which
describes the size of the blob support.
A typical invocation to draw a single blob patch may look like this:
Screen(‘DrawTexture’, windowPtr, blobid, , dstRect, Angle, , ,
modulateColor, , kPsychDontDoRotation, [contrast, sc, aspectratio, 0]);
Draws the blob ‘blobid’ into window ‘windowPtr’, at position ‘dstRect’,
or in the center if ‘dstRect’ is set to . Make sure ‘dstRect’ has the
size of ‘blobrect’ to avoid spatial distortions! You could do, e.g.,
dstRect = OffsetRect(blobrect, xc, yc) to place the blob centered at
screen position (xc,yc).
The definition of the blob mostly follows the definition of Wikipedia for a
gabor patch, just that there isn’t a sin() term to define a grating. Instead
there’s assumed to be a constant 1.0, so you only get the shape of the
exponential function - a gaussian blob.
Wikipedia’s definition (better readable): http://en.wikipedia.org/wiki/Gabor_filter
See http://tech.groups.yahoo.com/group/psychtoolbox/message/9174 for
Psychtoolbox forum message 9174 with an in-depth discussion of this
‘Angle’ is the optional orientation angle in degrees (0-360), default is zero degrees.
‘modulateColor’ is the base color of the blob patch - it defaults to
white, ie. the blob has only luminance, but no color. If you’d set it to
[255 0 0] you’d get a reddish blob.
‘sc’ is the spatial constant of the gaussian hull function of the blob, ie.
the “sigma” value in the exponential function.
‘contrast’ is the amplitude of your blob in intensity units - A factor
that is multiplied to the evaluated blob equation before converting the
value into a color value. ‘contrast’ may be a bit of a misleading term
‘aspectratio’ Defines the aspect ratio of the hull of the blob.