本文整理汇总了Python中nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python BaseFilter.__init__方法的具体用法?Python BaseFilter.__init__怎么用?Python BaseFilter.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter
的用法示例。
在下文中一共展示了BaseFilter.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, xsize, ysize, c, preserveCenterResolution=False, Debug=False):
"""
Initializes the kernel matrices, a one-time cost, which are then applied to
each image.
@param xsize -- The x-dimension size of the desired output
@param ysize -- The y-dimension size of the desired output
@param c -- Paramaterizes how much the image bends (ie. how steep the
fish-eye. c=0 is no distortion. c=3 is severe.
@param preserveCenterResolution -- if True, the resolution of the center of the
image will be preserved and the edges will be sub-sampled.
If False, the center pixels will be blown up to keep the
outside corners at the original resolution.
@param Debug -- Determines whether to compute and save some intermediate
data structures for debugging (deltaxmat, deltaymat, scales).
"""
BaseFilter.__init__(self)
# Init params
self._lastOutputImage = None
self._xsize = xsize
self._ysize = ysize
self._c = c
self._pcr = preserveCenterResolution
self._debug = Debug
self._kernelx = None
self._kernely = None
self._kernel = None
self._imgSize = (-1,-1)
示例2: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, noiseLevel=0.0, doForeground=True, doBackground=False,
dynamic=True, noiseThickness=1):
"""
noiseLevel -- Amount of noise to add, from 0 to 1.0. For black and white
images, this means the values of noiseLevel fraction of the pixels will
be flipped (e.g. noiseLevel of 0.2 flips 20 percent of the pixels). For
grayscale images, each pixel will be modified by up to 255 * noiseLevel
(either upwards or downwards).
doForeground -- Whether to add noise to the foreground. For black and white
images, black pixels are foreground and white pixels are background. For
grayscale images, any pixel which does not equal the background color
(the ImageSensor 'background' parameter) is foreground, and the rest is
background.
doBackground -- Whether to add noise to the background (see above).
"""
BaseFilter.__init__(self)
self.noiseLevel = noiseLevel
self.doForeground = doForeground
self.doBackground = doBackground
self.dynamic = dynamic
self.noiseThickness = noiseThickness
# Generate and save our random state
saveState = numpy.random.get_state()
numpy.random.seed(0)
self._randomState = numpy.random.get_state()
numpy.random.set_state(saveState)
示例3: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, factor=1.0, scaleTowardCenter=False):
"""
Parameters
----------
factor: float
How much contrast to produce in the output image relative
to the input image. A factor of 0 returns a solid gray image,
a factor of 1.0 returns the original image, and higher values
return higher-contrast images.
scaleTowardCenter: bool
If False (the default), uses PIL.ImageEnhance.Contrast.
If True, scales the pixel values toward 0.5.
"""
BaseFilter.__init__(self)
if factor < 0:
raise ValueError("'factor' must be nonnegative")
self.factor = factor
self.scaleTowardCenter = scaleTowardCenter
if scaleTowardCenter and not (0.0 <= factor <= 1.0):
raise ValueError("scaleTowardCenter only supports contrast factors "
"between 0 and 1, inclusive.")
示例4: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, level=1):
"""
@param level -- Number of times to blur.
"""
BaseFilter.__init__(self)
self.level = level
示例5: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, shiftSize=1):
"""
@param stepSize -- number of pixels to shift
"""
BaseFilter.__init__(self)
self.shiftSize = shiftSize
示例6: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, difficulty = 0.5, seed=None, reproducible=False):
"""
@param seed -- Seed value for random number generator, to produce
reproducible results.
@param reproducible -- Whether to seed the random number generator based
on a hash of the image pixels upon each call to process().
'seed' and 'reproducible' cannot be used together.
"""
BaseFilter.__init__(self, seed, reproducible)
示例7: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, width, height):
"""
** DEPRECATED **
@param width -- Target width, in pixels.
@param height -- Target height, in pixels.
"""
BaseFilter.__init__(self)
self.width = width
self.height = height
示例8: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, seed=None, reproducible=False, both=False):
"""
@param seed -- Seed value for random number generator, to produce
reproducible results.
@param reproducible -- Whether to seed the random number generator based
on a hash of the image pixels upon each call to process().
'seed' and 'reproducible' cannot be used together.
both -- Whether to also pass through the original image.
"""
BaseFilter.__init__(self, seed, reproducible)
self.both = both
示例9: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, box):
"""
@param box -- 4-tuple specifying the left, top, right, and bottom coords.
"""
BaseFilter.__init__(self)
if box[2] <= box[0] or box[3] <= box[1]:
raise RuntimeError('Specified box has zero width or height')
self.box = box
示例10: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, difficulty = 0.5, seed=None, reproducible=False):
"""
@param difficulty -- Value between 0.0 and 1.0 that controls the intensity of the gradient applied.
@param seed -- Seed value for random number generator, to produce
reproducible results.
@param reproducible -- Whether to seed the random number generator based
on a hash of the image pixels upon each call to process().
'seed' and 'reproducible' cannot be used together.
"""
BaseFilter.__init__(self, seed, reproducible)
self.difficulty = difficulty
self.types = ('horizontal', 'vertical', 'circular')
self.gradientImages = {}
示例11: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, factor=1.0):
"""
@param factor -- Factor by which to brighten the image, a nonnegative
number. 0.0 returns a black image, 1.0 returns the original image, and
higher values return brighter images.
"""
BaseFilter.__init__(self)
if factor < 0:
raise ValueError("'factor' must be a nonnegative number")
self.factor = factor
示例12: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, numRectangles=4, seed=None, reproducible=False):
"""
@param numRectangles -- Number of rectangles to add.
@param seed -- Seed value for random number generator, to produce
reproducible results.
@param reproducible -- Whether to seed the random number generator based
on a hash of the image pixels upon each call to process().
'seed' and 'reproducible' cannot be used together.
"""
BaseFilter.__init__(self, seed, reproducible)
self.numRectangles = numRectangles
示例13: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, difficulty = 0.5, seed=None, reproducible=False):
"""
@param difficulty -- Value between 0.0 and 1.0 that controls how many lines to add in image.
@param seed -- Seed value for random number generator, to produce
reproducible results.
@param reproducible -- Whether to seed the random number generator based
on a hash of the image pixels upon each call to process().
'seed' and 'reproducible' cannot be used together.
"""
BaseFilter.__init__(self, seed, reproducible)
self.difficulty = difficulty
#Maximum number of lines to add
self.maxLines = 10
示例14: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, scales=[1], simultaneous=False):
"""
** DEPRECATED **
@param scales -- List of factors used for scaling. scales = [.5, 1] returns
two images, one half the size of the original in each dimension, and one
which is the original image.
@param simultaneous -- Whether the images should be sent out of the sensor
simultaneously.
"""
BaseFilter.__init__(self)
self.scales = scales
self.simultaneous = simultaneous
示例15: __init__
# 需要导入模块: from nupic.vision.regions.ImageSensorFilters.BaseFilter import BaseFilter [as 别名]
# 或者: from nupic.vision.regions.ImageSensorFilters.BaseFilter.BaseFilter import __init__ [as 别名]
def __init__(self, img=None, threshold=10, maskScale=1.0, blurRadius=0.0):
"""
@param img -- path to background image(s) to use
"""
BaseFilter.__init__(self)
self.bgPath = img
self.bgImgs = None
self._rng = random.Random()
self._rng.seed(42)
self._threshold = threshold
self._maskScale = maskScale
self._blurRadius = blurRadius