components.modulate
- class Modulate(config={}, **kwds)[source]
Bases:
Transformer
Modulate or sample an image.
Multiplies each pixel value by a modulating value that can vary horizontally, vertically and temporally. The modulating function is supplied in a small “cell” whose dimensions should be the repeat period of the function in each direction.
The
cell
input method is used to update the modulating function. No processing happens until a cell is received, and new cells can be applied while the component is running.The cell is supplied in a
Frame
object sent to thecell
input. Unlike most otherFrame
objects the data must have 4 dimensions. If the first dimension is greater than unity then the modulation function can have a temporal variation.If the cell data’s 4th dimension is unity then the same modulation is applied to each component of the input. Alternatively the cell data’s 4th dimension should match the input’s, allowing a different modulation to be applied to each colour.
For example, a cell to simulate a Bayer filter could look like this:
cell = Frame() cell.data = numpy.array([[[[0, 0, 1], [0, 1, 0]], [[0, 1, 0], [1, 0, 0]]]], dtype=numpy.float32) cell.type = 'cell' audit = cell.metadata.get('audit') audit += 'data = Bayer filter modulation cell\n' cell.metadata.set('audit', audit)
- inputs = ['input', 'cell']
Comments or questions? Please email jim@jim-easterbrook.me.uk.