Supplemental sprite functions.
These are mostly generator functions that fill sprites with
useful pixel patterns: gratings of various times, Gaussian
envelopes etc. It extends the basic functionality provided
by the sprite module and most functions work on existing
Sprite objects by modding the underlying image data.
|
|
|
g2rgb(a)
Convert an [WxHx1] grayscale image into a [WxHx3] RGB array. |
source code
|
|
|
pixelize(a,
rgb=None,
norm=1)
Convert a floating point array into an np.uint8 array. |
source code
|
|
|
genpolar(w,
h=None,
typecode=np.float64,
degrees=False)
Generate polar axes (like polar meshgrid) |
source code
|
|
|
|
|
rgb2rgb8(r,
g,
b,
inrange=(-1.0,1.0))
Convert rgb image data to 8bit integer array. |
source code
|
|
|
singrat(s,
frequency,
phase_deg,
ori_deg,
R=1.0,
G=1.0,
B=1.0,
meanlum=0.5,
moddepth=1.0,
ppd=None,
color=None)
2D sine grating generator (odd symmetric). |
source code
|
|
|
cosgrat(s,
frequency,
phase_deg,
ori_deg,
R=1.0,
G=1.0,
B=1.0,
meanlum=0.5,
moddepth=1.0,
ppd=None,
color=None)
2D cosine grating generator (even symmetric). |
source code
|
|
|
singrat2(s,
frequency,
phase_deg,
ori_deg,
R=1.0,
G=1.0,
B=1.0,
meanlum=0.5,
moddepth=1.0,
ppd=None,
color=None,
xcache=None)
CACHING version of singrat |
source code
|
|
|
cosgrat2(s,
frequency,
phase_deg,
ori_deg,
R=1.0,
G=1.0,
B=1.0,
meanlum=0.5,
moddepth=1.0,
ppd=None,
color=None,
xcache=None)
CACHING version of cosgrat |
source code
|
|
|
polargrat(s,
cfreq,
rfreq,
phase_deg,
polarity,
R=1.0,
G=1.0,
B=1.0,
logpolar=False,
meanlum=0.5,
moddepth=1.0,
ppd=None,
color=None)
2D polar (non-Cartesian) grating generator. |
source code
|
|
|
logpolargrat(s,
cfreq,
rfreq,
phase_deg,
polarity,
R=1.0,
G=1.0,
B=1.0,
meanlum=0.5,
moddepth=1.0,
ppd=None,
color=None)
2D log polar (non-Cartesian) grating generator |
source code
|
|
|
hypergrat(s,
freq,
phase_deg,
ori_deg,
R=1.0,
G=1.0,
B=1.0,
meanlum=0.5,
moddepth=1.0,
ppd=None,
color=None)
2D hyperbolic (non-Cartesian) grating generator. |
source code
|
|
|
hartley(s,
kx,
ky,
R=1.0,
G=1.0,
B=1.0,
meanlum=0.5,
moddepth=1.0,
color=None)
Hartley basis function generator (after Ringach et al, 1997) |
source code
|
|
|
gabor(s,
frequency,
phase_deg,
ori_deg,
sigma,
R=1.0,
G=1.0,
B=1.0,
meanlum=0.5,
moddepth=1.0,
ppd=None,
color=None)
2D gabor generator. |
source code
|
|
|
uniformnoise(s,
binary=False,
R=1.0,
G=1.0,
B=1.0,
meanlum=0.5,
moddepth=1.0,
color=None)
Fill sprite with uniform white noise |
source code
|
|
|
gaussiannoise(s,
R=1.0,
G=1.0,
B=1.0,
meanlum=0.5,
stddev=1.0,
color=None)
Fill sprite with Gaussian white noise |
source code
|
|
|
alphabar(s,
bw,
bh,
ori_deg,
R=1.0,
G=1.0,
B=1.0)
Generate a bar into existing sprite using the alpha channel. |
source code
|
|
|
alpha_gaussian(s,
xsigma,
ysigma=None,
ori_deg=0.0)
Generate symmetric and asymmetric Gaussian envelopes
into the alpha channel. |
source code
|
|
|
alphaGaussian(s,
xsigma,
ysigma=None,
ori_deg=0.0)
Generate symmetric and asymmetric Gaussian envelopes
into the alpha channel. |
source code
|
|
|
|