Object/Class

cogx.compiler.parser.syntaxtree

Field

Related Docs: class Field | package syntaxtree

Permalink

object Field extends CogFunctionAPI with SemanticError

Factory for creating constant fields.

This object extends Intrinsics to give the ImplicitConversions trait a convenient place to access the methods defined there, as in: Field.vectorField(in1, in2)

Linear Supertypes
CogFunctionAPI, ImplicitConversions, SemanticError, CompilerError, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Field
  2. CogFunctionAPI
  3. ImplicitConversions
  4. SemanticError
  5. CompilerError
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def abs(field: Field): Field

    Permalink

    Take the absolute value of every numeric element in field.

    Take the absolute value of every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to absoluteValue(x).

    Definition Classes
    CogFunctionAPI
  5. def acos(field: Field): Field

    Permalink

    Take the arccosine of every numeric element in field.

    Take the arccosine of every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to acos(x).

    Definition Classes
    CogFunctionAPI
  6. def apply(operation: Operation, resultType: platform.types.FieldType): Field

    Permalink

    Create a field of a given type as an output of the given operation.

    Create a field of a given type as an output of the given operation.

    operation

    The operation, possibly multi-output, that generates the field.

    resultType

    The type of the desired field.

    returns

    The field.

  7. def apply(opcode: Opcode, in: Array[Field], fieldType: platform.types.FieldType): Field

    Permalink

    Create a field of type fieldType, with supplied op and inputs

  8. def apply(fieldType: platform.types.FieldType): Field

    Permalink

    Create a field of type fieldType.

  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def asin(field: Field): Field

    Permalink

    Take the arcsine of every numeric element in field.

    Take the arcsine of every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to asin(x).

    Definition Classes
    CogFunctionAPI
  11. def atan2(field: Field, f2: Field): Field

    Permalink

    Compute atan2 of two identically shaped scalar fields.

    Compute atan2 of two identically shaped scalar fields.

    field

    The input field.

    returns

    A scalar field that's the atan2 of the two input fields.

    Definition Classes
    CogFunctionAPI
  12. def backProjectFrame(field: Field, filter: Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution, batchSize: Int = 1): Field

    Permalink

    Convolve a vector field with a vector-field filter frame.

    Convolve a vector field with a vector-field filter frame.

    field

    The input field.

    filter

    The filter to use for convolution; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling convolution along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the convolution, also helps to determine the size of output field.

    batchSize

    The number of logical (possibly multi-plane) images present in the input field.

    returns

    Input field convolved with filter using the supplied border and sampling policies.

    Definition Classes
    CogFunctionAPI
  13. def backwardDivergence(field: Field): Field

    Permalink

    Compute the backward divergence of a 2D vector field.

    Compute the backward divergence of a 2D vector field.

    This is the adjoint operator of forwardGradient.

    field

    The input field.

    returns

    A scalar field representing the backward divergence of an input vector field.

    Definition Classes
    CogFunctionAPI
  14. def backwardGradient(field: Field): Field

    Permalink

    Compute the backward gradient of a 2D scalar or vector field.

    Compute the backward gradient of a 2D scalar or vector field.

    field

    The input field.

    returns

    For a scalar field input, a vector field representing the forward gradient of the input; for a vector input field, an order 4 tensor field representing the forward gradient of the input.

    Definition Classes
    CogFunctionAPI
  15. def blockReduceMax(field: Field, factor: Int): Field

    Permalink

    Reduce a vector field to a shorter (by factor factor) vector field by taking the max() of the first factor input vector elements to form the first output vector element, and so forth.

    Reduce a vector field to a shorter (by factor factor) vector field by taking the max() of the first factor input vector elements to form the first output vector element, and so forth.

    field

    The input field.

    factor

    The factor by which the input field tensor length is reduced.

    returns

    A vector field with each element equal to the max() of factor components of the corresponding vector in the input field.

    Definition Classes
    CogFunctionAPI
  16. def blockReduceMin(field: Field, factor: Int): Field

    Permalink

    Reduce a vector field to a shorter (by factor factor) vector field by taking the min() of the first factor input vector elements to form the first output vector element, and so forth.

    Reduce a vector field to a shorter (by factor factor) vector field by taking the min() of the first factor input vector elements to form the first output vector element, and so forth.

    field

    The input field.

    factor

    The factor by which the input field tensor length is reduced.

    returns

    A vector field with each element equal to the min() of factor components of the corresponding vector in the input field.

    Definition Classes
    CogFunctionAPI
  17. def blockReduceSum(field: Field, factor: Int): Field

    Permalink

    Reduce a vector field to a shorter (by factor factor) vector field by summing the first factor input vector elements to form the first output vector element, and so forth.

    Reduce a vector field to a shorter (by factor factor) vector field by summing the first factor input vector elements to form the first output vector element, and so forth.

    field

    The input field.

    factor

    The factor by which the input field tensor length is reduced.

    returns

    A vector field with each element equal to the sum of factor components of the corresponding vector in the input field.

    Definition Classes
    CogFunctionAPI
  18. def centralGradient(field: Field): Field

    Permalink

    Compute the central gradient of a scalar of vector field.

    Compute the central gradient of a scalar of vector field.

    The central gradient at the point (x, y) is computed using the values at (x - 1, y), (x, y - 1), (x, y + 1), and (x + 1, y + 1)

    field

    The input field.

    returns

    For a scalar field input, returns a vectorField representing the central gradient of the input. For a vector field input, returns an order-4 tensor field representing the central gradient of the input.

    Definition Classes
    CogFunctionAPI
  19. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. def colorField(field: Field): Field

    Permalink

    Create a color field from either a scalar field (with an implicit assumption that the field represents a grayscale image) or a vector field (with the implicit assumption that the vector field represents the (red, green, blue) components of the color image.

    Create a color field from either a scalar field (with an implicit assumption that the field represents a grayscale image) or a vector field (with the implicit assumption that the vector field represents the (red, green, blue) components of the color image.

    field

    The input scalar or vector field.

    returns

    Composed color field.

    Definition Classes
    CogFunctionAPI
  21. def colorField(red: Field, green: Field, blue: Field): Field

    Permalink

    Create a color field from three scalar fields.

    Create a color field from three scalar fields.

    red

    The red component scalar field.

    green

    The green component scalar field.

    blue

    The blue component scalar field.

    returns

    Color field composed of (red, green, blue).

    Definition Classes
    CogFunctionAPI
  22. def complex(real: Field): Field

    Permalink

    Create a complex field from a real field.

    Create a complex field from a real field.

    real

    Real input scalar field.

    returns

    Complex version of real, with imaginary part set to zeros.

    Definition Classes
    CogFunctionAPI
  23. def complex(real: Field, imaginary: Field): Field

    Permalink

    Create a complex field from two scalar fields

    Create a complex field from two scalar fields

    real

    Real part of the created complex field.

    imaginary

    Imaginary part of the created complex field.

    returns

    Complex field composed of the real and imaginary inputs

    Definition Classes
    CogFunctionAPI
  24. implicit def complexToCogComplex(c: cogmath.algebra.complex.Complex): CogComplex

    Permalink

    Implicit conversion of a Complex to a CogComplex which allows for fields to be combined with floating point numbers in a simple way.

    Implicit conversion of a Complex to a CogComplex which allows for fields to be combined with floating point numbers in a simple way. This makes it possible to express commutative operations with a common syntax.

    For example

    Field + Complex

    and

    Complex + Field

    are both legal and compilable with this implicit conversion.

    c

    The Complex to be converted to a CogComplex

    returns

    The CogComplex created from c.

    Definition Classes
    ImplicitConversions
  25. def complexVectorField(fields: Array[ComplexField]): ComplexVectorField

    Permalink

    Create a complex vector field by stacking complex scalar fields.

    Create a complex vector field by stacking complex scalar fields.

    For example, this can be used to stack N complex fields to a single complex vector field where each vector is of length N.

    fields

    The complex fields to be stacked into a complex vector field.

    returns

    The resulting complex vector field.

    Definition Classes
    CogFunctionAPI
  26. def complexVectorField(fields: ComplexField*): ComplexVectorField

    Permalink

    Create a complex vector field by stacking complex scalar fields.

    Create a complex vector field by stacking complex scalar fields.

    For example, this can be used to stack N complex fields to a single complex vector field where each vector is of length N.

    fields

    The complex fields to be stacked into a complex vector field.

    returns

    The resulting complex vector field.

    Definition Classes
    CogFunctionAPI
  27. implicit def complexVectorTo0DComplexVectorField(v: cogmath.algebra.complex.ComplexVector): ComplexVectorField

    Permalink

    Implicit conversion of a ComplexVector to a 0D constant ComplexVectorField which allows for fields to be combined with ComplexVectors in a simple way.

    Implicit conversion of a ComplexVector to a 0D constant ComplexVectorField which allows for fields to be combined with ComplexVectors in a simple way. This makes it possible to express commutative operations with a common syntax.

    For example

    Field + ComplexVector

    and

    ComplexVector + Field

    are both legal and compilable with this implicit conversion.

    v

    The complex vector to be converted to a 0D complex vector field.

    returns

    A 0D complex vector field initialized to v.

    Definition Classes
    ImplicitConversions
  28. def conjugate(field: Field): Field

    Permalink

    Take the complex conjugate of each element in a complex field

    Take the complex conjugate of each element in a complex field

    field

    The input field.

    returns

    Conjugate of the input field.

    Definition Classes
    CogFunctionAPI
  29. def convolve(field: Field, filter: Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution): Field

    Permalink

    Convolve a scalar/vector/matrix field with a filter.

    Convolve a scalar/vector/matrix field with a filter.

    field

    The input field.

    filter

    The filter to use for convolution; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling convolution along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the convolution, also helps to determine the size of output field.

    returns

    Input field convolved with filter using the supplied border and sampling policies.

    Definition Classes
    CogFunctionAPI
  30. def convolveFilterAdjoint(field: Field, filter: Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution, batchSize: Int = 1): Field

    Permalink

    Convolve a vector field with a vector-field with "filter adjoint" plane mixing.

    Convolve a vector field with a vector-field with "filter adjoint" plane mixing.

    field

    The input field.

    filter

    The filter to use for convolution; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling convolution along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the convolution, also helps to determine the size of output field.

    batchSize

    The number of logical (possibly multi-plane) images present in the input field.

    returns

    Input field convolved with filter using the supplied border and sampling policies.

    Definition Classes
    CogFunctionAPI
  31. def convolveSeparable(field: Field, rowFilter: Field, columnFilter: Field, borderPolicy: platform.types.BorderPolicy): Field

    Permalink

    Convolve a scalar/vector/matrix field with a row filter and a column filter (separable convolution).

    Convolve a scalar/vector/matrix field with a row filter and a column filter (separable convolution).

    field

    The input field.

    rowFilter

    The filter to use for convolving the rows with odd size in each dimension.

    columnFilter

    The filter to use for convolving the columns with odd size in each dimension.

    borderPolicy

    Policy to use for handling convolution along borders, implicitly helps to determine size of output field.

    returns

    Input field convolved with filters using the supplied border policy.

    Definition Classes
    CogFunctionAPI
  32. def copy(field: Field): Field

    Permalink

    Create a copy of a field.

    Create a copy of a field. This should not be used normally in a user model, but exists as a debugging tool to help identify Cog core issues. The Cog compiler uses this method internally between pipeline stages that have no other computation between them.

    field

    The input field.

    returns

    A copy of the input field.

    Definition Classes
    CogFunctionAPI
  33. def cos(field: Field): Field

    Permalink

    Take the cosine of every numeric element in field.

    Take the cosine of every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to cos(x).

    Definition Classes
    CogFunctionAPI
  34. def cosh(field: Field): Field

    Permalink

    Take the hyperbolic cosine of every numeric element in field.

    Take the hyperbolic cosine of every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to cosh(x).

    Definition Classes
    CogFunctionAPI
  35. def crossCorrelate(field: Field, filter: Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution): Field

    Permalink

    Cross-correlate a scalar/vector/matrix field with a filter.

    Cross-correlate a scalar/vector/matrix field with a filter.

    field

    The input field.

    filter

    The filter to use for cross-correlation; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the crossCorrelation, also helps to determine the size of output field.

    returns

    Input field cross-correlated with filter using the supplied border and sampling policies.

    Definition Classes
    CogFunctionAPI
  36. def crossCorrelateFilterAdjoint(field: Field, filter: Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution, batchSize: Int = 1): Field

    Permalink

    Cross-correlate a vector field with a vector-field with "filter adjoint" plane mixing.

    Cross-correlate a vector field with a vector-field with "filter adjoint" plane mixing.

    field

    The input field.

    filter

    The filter to use for cross-correlation; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the crossCorrelation, also helps to determine the size of output field.

    batchSize

    The number of logical (possibly multi-plane) images present in the input field.

    returns

    Input field cross-correlated with filter using the supplied border and sampling policies.

    Definition Classes
    CogFunctionAPI
  37. def crossCorrelateSeparable(field: Field, rowFilter: Field, columnFilter: Field, borderPolicy: platform.types.BorderPolicy): Field

    Permalink

    Cross-correlate a scalar/vector/matrix field with a row filter and a column filter (separable convolution).

    Cross-correlate a scalar/vector/matrix field with a row filter and a column filter (separable convolution).

    field

    The input field.

    rowFilter

    The filter to use for cross-correlating the rows with odd size in each dimension.

    columnFilter

    The filter to use for cross-correlating the columns with odd size in each dimension.

    borderPolicy

    Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.

    returns

    Input field cross-correlated with filters using the supplied border policy.

    Definition Classes
    CogFunctionAPI
  38. def crossDot(field: Field, f2: Field): Field

    Permalink

    Multiply a 2D matrix field, field, by a 2D scalar field, f2, to produce a 2D scalar field.

    Multiply a 2D matrix field, field, by a 2D scalar field, f2, to produce a 2D scalar field.

    The scalar field f2 must have the same shape as the matrices in field. This operator is basically pretending that the f2 scalar field is really a matrix and simply dotting that matrix with every matrix in the matrix field field, producing a scalar in the corresponding position of the result scalar field.

    field

    The input field.

    f2

    Scalar field to multiply with field.

    returns

    "cross dot" product of field and f2.

    Definition Classes
    CogFunctionAPI
  39. def dct(field: Field): Field

    Permalink

    Takes the DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    Takes the DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    The following sequence will return the original input, within the bounds of computational error:

    val field
    val transformed: Field =
    val restored = transformed.dctInverse
    // restored is approximately equal to field

    For a somewhat faster version, see dctTransposed.

    The DCT has several requirements:

    The number of rows and columns must each be a power of 2.

    Rows and columns are restricted to the range [256, 2048]

    field

    The input field.

    returns

    The DCT of the input.

    Definition Classes
    CogFunctionAPI
  40. def dctInverse(field: Field): Field

    Permalink

    Takes the inverse DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    Takes the inverse DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    The following sequence will return the original input, within the bounds of computational error:

    val field
    val transformed = field.dct
    val restored = transformed.dctInverse
    // restored is approximately equal to field

    For a somewhat faster version, see dctInverseTransposed.

    The DCT has several requirements:

    The number of rows and columns must each be a power of 2.

    Rows and columns are restricted to the range [256, 2048]

    field

    The input field.

    returns

    The DCT of the input.

    Definition Classes
    CogFunctionAPI
  41. def dctInverseTransposed(field: Field): Field

    Permalink

    Takes the inverse DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    Takes the inverse DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    The following sequence will return the original input, within the bounds of computational error:

    val field
    val transformed = field.dctTransposed
    val restored = transformed.dctInverseTransposed
    // restored is approximately equal to field

    This is a somewhat faster version of dctInverse where the transpose is not important to (or can be compensated within) an application.

    The DCT has several requirements:

    The number of rows and columns must each be a power of 2.

    Rows and columns are restricted to the range [256, 2048]

    field

    The input field.

    returns

    The DCT of the input.

    Definition Classes
    CogFunctionAPI
  42. def dctTransposed(field: Field): Field

    Permalink

    Takes the DCT (discrete cosine transform) of a 2D field and transposes it, producing a field with the same shape as the input transposed.

    Takes the DCT (discrete cosine transform) of a 2D field and transposes it, producing a field with the same shape as the input transposed.

    The following sequence will return the original input, within the bounds of computational error:

    val field
    val transformed = field.dctTransposed
    val restored = transformed.dctInverseTransposed
    // restored is approximately equal to field

    This is a somewhat faster version of dct where the transpose is not important to (or can be compensated within) an application.

    The DCT has several requirements:

    The number of rows and columns must each be a power of 2.

    Rows and columns are restricted to the range [256, 2048]

    field

    The input field.

    returns

    The DCT of the input.

    Definition Classes
    CogFunctionAPI
  43. def dot(field: Field, f2: Field): Field

    Permalink

    Takes the inner product of two identically shaped tensor fields to create a scalar field.

    Takes the inner product of two identically shaped tensor fields to create a scalar field.

    The tensors in both fields must have the same shape. Dotting two tensors involves multiplying corresponding elements in the two tensors and summing the products.

    field

    The input field.

    f2

    Other field to "dot" with field field.

    returns

    Scalar field where each scalar element is computed from the dot product of the tensors in the corresponding location of the two input tensor fields.

    Definition Classes
    CogFunctionAPI
  44. def downsample(field: Field, factor: Int = 2, phase: Int = 0): Field

    Permalink

    Downsample a field by taking every nth element.

    Downsample a field by taking every nth element.

    Example: for input field {1,2,3,4}

    input.downsample(2) yields {1,3}
    
    input.downsample(2,1) yields {2,4}

    Further examples of downsampling on a 2-dimensional input:

    field

    The input field.

    factor

    The sampling factor, defaults to 2.

    phase

    The offset within the scaled up field to put the input data, defaults to an offset of 0.

    Definition Classes
    CogFunctionAPI
  45. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  46. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  47. def exp(field: Field): Field

    Permalink

    Apply the exponential function to every numeric element in field.

    Apply the exponential function to every numeric element in field. This works for complex and real fields.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to exp(x).

    Definition Classes
    CogFunctionAPI
  48. def expand(field: Field, borderPolicy: platform.types.BorderPolicy, sizes: Int*): Field

    Permalink

    Expand an N-dimensional field by padding it with values per the border policy, maintaining the origin.

    Expand an N-dimensional field by padding it with values per the border policy, maintaining the origin. The supported border policies are BorderZero, BorderClamp and BorderCyclic.

    See expand(borderPolicy, shape) for a description of the border policies.

    field

    The input field.

    borderPolicy

    Policy to use for producing border values.

    sizes

    The integer dimensions of the expanded output field.

    returns

    Expanded field with new elements filled in from the nearest input edge per borderPolicy.

    Definition Classes
    CogFunctionAPI
  49. def expand(field: Field, borderPolicy: platform.types.BorderPolicy, shape: cogmath.geometry.Shape): Field

    Permalink

    Expand an N-dimensional field by padding it with values per the border policy, maintaining the origin.

    Expand an N-dimensional field by padding it with values per the border policy, maintaining the origin. The supported border policies are BorderZero, BorderClamp and BorderCyclic.

    With the BorderZero policy, the border values are all 0.

    Border Zero Example. A 3 x 4 input field:

    1  2  3  4
    5 -1 -1  6
    7  8  9  0

    If we expand this to 7 x 8, we fill the new elements with zeroes:

    1  2  3  4  0  0  0  0
    5 -1 -1  6  0  0  0  0
    7  8  9  0  0  0  0  0
    0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0

    With the BorderClamp policy, the border is extended outwards into the expanded output field, wrapping around as though the output field were a torus. This is useful when doing convolution with the FFT and one wishes to minimize border effects by "border clamping".

    BorderClamp Example. A 3 x 4 input field:

    1  2  3  4
    5 -1 -1  6
    7  8  9  0

    If we expand this to 7 x 8, we extend the borders, wrapping around as though the output field were a torus:

    1  2  3  4  4  4  1  1
    5 -1 -1  6  6  6  5  5
    7  8  9  0  0  0  7  7
    7  8  9  0  0  0  0  0
    7  8  9  0  0  0  0  0
    1  2  3  4  0  0  0  0
    1  2  3  4  0  0  0  0

    With the BorderCyclic policy, the border values emulate a cyclic "wrap-around" in the original field, as though the input field were a torus. This is useful when doing cyclic convolution with the FFT and one wishes expand the field to make it a power of 2 (necessary for the FFT) while still preserving cyclic convolution

    BorderCyclic Example. A 3 x 4 input field:

    1  2  3  4
    5 -1 -1  6
    7  8  9  0

    If we expand this to 7 x 8, we extend the borders, wrapping around as though the input field were a torus:

    1  2  3  4  1  2  3  4
    5 -1 -1  6  5 -1 -1  6
    7  8  9  0  7  8  9  0
    1  2  3  4  1  2  3  4
    5 -1 -1  6  5 -1 -1  6
    5 -1 -1  6  5 -1 -1  6
    7  8  9  0  7  8  9  0
    field

    The input field.

    borderPolicy

    Policy to use for producing border values.

    shape

    The shape of the expanded output field.

    returns

    Expanded field with new elements filled in from the nearest input edge per borderPolicy.

    Definition Classes
    CogFunctionAPI
  50. def fft(field: Field): Field

    Permalink

    Compute the FFT of a complex field.

    Compute the FFT of a complex field.

    field

    The input field.

    returns

    FFT of the input field.

    Definition Classes
    CogFunctionAPI
  51. def fftColumns(field: Field): Field

    Permalink

    Compute the FFT of the columns only in a 2D complex field.

    Compute the FFT of the columns only in a 2D complex field.

    field

    The input field.

    returns

    Input with each columns transformed by the FFT.

    Definition Classes
    CogFunctionAPI
  52. def fftInverse(field: Field): Field

    Permalink

    Compute the inverse FFT of a complex field (includes scaling).

    Compute the inverse FFT of a complex field (includes scaling).

    field

    The input field.

    returns

    Inverse FFT of the input field.

    Definition Classes
    CogFunctionAPI
  53. def fftInverseColumns(field: Field): Field

    Permalink

    Compute the inverseFFT of the columns only in a 2D complex field.

    Compute the inverseFFT of the columns only in a 2D complex field.

    field

    The input field.

    returns

    Input with each columns transformed by the inverse FFT.

    Definition Classes
    CogFunctionAPI
  54. def fftInverseRI(real: Field, imaginary: Field): (Field, Field)

    Permalink

    Compute the inverse FFT of a complex field represented as separate real and imaginary fields (includes scaling).

    Compute the inverse FFT of a complex field represented as separate real and imaginary fields (includes scaling).

    real

    The real component of the complex field input.

    imaginary

    The imaginary component of the complex field input.

    returns

    Inverse FFT of the input field, returned as a Tuple2 of the real and imaginary part fields.

    Definition Classes
    CogFunctionAPI
  55. def fftInverseRows(field: Field): Field

    Permalink

    Compute the inverse FFT of the rows only in a 2D complex field.

    Compute the inverse FFT of the rows only in a 2D complex field.

    field

    The input field.

    returns

    Input with each row transformed by the inverse FFT.

    Definition Classes
    CogFunctionAPI
  56. def fftRI(real: Field): (Field, Field)

    Permalink

    Compute the FFT of a real field.

    Compute the FFT of a real field.

    real

    The real component of the input whose imaginary component is 0.

    returns

    FFT of the input, returned as a Tuple2 of the real and imaginary part fields.

    Definition Classes
    CogFunctionAPI
  57. def fftRI(real: Field, imaginary: Field): (Field, Field)

    Permalink

    Compute the FFT of a complex field that is input as two separate real and imaginary fields.

    Compute the FFT of a complex field that is input as two separate real and imaginary fields.

    real

    The real component of the complex field input.

    imaginary

    The imaginary component of the complex field input.

    returns

    FFT of the input, returned as a Tuple2 of the real and imaginary part fields.

    Definition Classes
    CogFunctionAPI
  58. def fftRows(field: Field): Field

    Permalink

    Compute the FFT of the rows only in a 2D complex field.

    Compute the FFT of the rows only in a 2D complex field.

    field

    The input field.

    returns

    Input with each row transformed by the FFT.

    Definition Classes
    CogFunctionAPI
  59. implicit def fieldArrayToMatrixFieldArray(a: Array[Field]): Array[MatrixField]

    Permalink

    Implicit conversion of an array of Fields to an array of ScalarFields.

    Implicit conversion of an array of Fields to an array of ScalarFields.

    a

    An array of Fields.

    returns

    An array of MatrixFields.

    Definition Classes
    ImplicitConversions
  60. implicit def fieldArrayToScalarFieldArray(a: Array[Field]): Array[ScalarField]

    Permalink

    Implicit conversion of an array of Fields to an array of ScalarFields.

    Implicit conversion of an array of Fields to an array of ScalarFields.

    a

    An array of Fields.

    returns

    An array of ScalarFields.

    Definition Classes
    ImplicitConversions
  61. implicit def fieldArrayToVectorFieldArray(a: Array[Field]): Array[VectorField]

    Permalink

    Implicit conversion of an array of Fields to an array of ScalarFields.

    Implicit conversion of an array of Fields to an array of ScalarFields.

    a

    An array of Fields.

    returns

    An array of VectorFields.

    Definition Classes
    ImplicitConversions
  62. def fieldReduceMax(field: Field): Field

    Permalink

    Reduce a scalar field to a 0D scalar containing a single element which is the maximum element in the input field.

    Reduce a scalar field to a 0D scalar containing a single element which is the maximum element in the input field.

    field

    The input field.

    returns

    0D scalar field holding the max value in input field.

    Definition Classes
    CogFunctionAPI
  63. def fieldReduceMedian(field: Field): Field

    Permalink

    Find the median value in a scalar field.

    Find the median value in a scalar field.

    field

    The input field.

    returns

    0D scalar field holding the median value of the input field.

    Definition Classes
    CogFunctionAPI
  64. def fieldReduceMin(field: Field): Field

    Permalink

    Reduce a scalar field to a 0D scalar containing a single element which is the minimum element in the input field.

    Reduce a scalar field to a 0D scalar containing a single element which is the minimum element in the input field.

    field

    The input field.

    returns

    0D scalar field holding the min value in input field.

    Definition Classes
    CogFunctionAPI
  65. def fieldReduceSum(field: Field): Field

    Permalink

    Reduce a scalar field to a 0D scalar containing the sum of all the elements in the input field.

    Reduce a scalar field to a 0D scalar containing the sum of all the elements in the input field.

    field

    The input field.

    returns

    0D scalar field holding the sum of values in input field.

    Definition Classes
    CogFunctionAPI
  66. implicit def fieldToColorField(f: Field): ColorField

    Permalink

    Implicit conversion of a Field to a ColorField.

    Implicit conversion of a Field to a ColorField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ColorField but stored in a Field variable. This method also supports converting a ScalarField or VectorField to a ColorField.

    f

    A field which needs coercion to the ColorField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  67. implicit def fieldToComplexField(f: Field): ComplexField

    Permalink

    Implicit conversion of a Field to a ComplexField.

    Implicit conversion of a Field to a ComplexField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ComplexField but stored in a Field variable. This method also supports converting a ScalarField to a ComplexField.

    f

    A field which needs coercion to the ComplexField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  68. implicit def fieldToComplexVectorField(f: Field): ComplexVectorField

    Permalink

    Implicit conversion of a Field to a ComplexField.

    Implicit conversion of a Field to a ComplexField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ComplexField but stored in a Field variable. This method also supports converting a ScalarField to a ComplexField.

    f

    A field which needs coercion to the ComplexVectorField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  69. implicit def fieldToMatrixField(f: Field): MatrixField

    Permalink

    Implicit conversion of a Field to a MatrixField.

    Implicit conversion of a Field to a MatrixField. Since Field is abstract, the only possible conversion is if the field is already a MatrixField but is stored in a Field variable. This merely does the necessary type coercion.

    f

    A field which needs coercion to the MatrixField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  70. implicit def fieldToScalarField(f: Field): ScalarField

    Permalink

    Implicit conversion of a Field to a ScalarField.

    Implicit conversion of a Field to a ScalarField. Since Field is abstract, the only possible conversion is if the field is already a ScalarField but is stored in a Field variable. This merely does the necessary type coercion.

    f

    A field which needs coercion to the ScalarField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  71. implicit def fieldToVectorField(f: Field): VectorField

    Permalink

    Implicit conversion of a Field to a VectorField.

    Implicit conversion of a Field to a VectorField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a VectorField but stored in a Field variable. This method also supports converting a ColorField to a VectorField.

    f

    A field which needs coercion to the VectorField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  72. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  73. def flip(field: Field): Field

    Permalink

    Flip a field along every dimension.

    Flip a field along every dimension.

    Example. This 2D scalar field:

    1  2  3
    4  5  6
    7  8  9

    looks like this when flipped:

    9  8  7
    6  5  4
    3  2  1
    field

    The input field.

    returns

    A flipped version of the input field.

    Definition Classes
    CogFunctionAPI
  74. implicit def floatToCogFloat(f: Float): CogFloat

    Permalink

    Implicit conversion of a Float to a CogFloat which allows for fields to be combined with floating point numbers in a simple way.

    Implicit conversion of a Float to a CogFloat which allows for fields to be combined with floating point numbers in a simple way. This makes it possible to express commutative operations with a common syntax.

    For example

    Field + Float

    and

    Float + Field

    are both legal and compilable with this implicit conversion.

    f

    The Float to be converted to a CogFloat

    returns

    The CogFloat created from f.

    Definition Classes
    ImplicitConversions
  75. def floor(field: Field): Field

    Permalink

    Map each numeric element of the input field to the largest integer which is less than or equal to that element.

    Map each numeric element of the input field to the largest integer which is less than or equal to that element.

    field

    The input field.

    returns

    Field where every number element has been "floored" to an integer.

    Definition Classes
    CogFunctionAPI
  76. def forwardGradient(field: Field): Field

    Permalink

    Compute the forward gradient of a 2D scalar or vector field.

    Compute the forward gradient of a 2D scalar or vector field.

    This is the adjoint operator of backwardDivergence.

    field

    The input field.

    returns

    For a scalar field input, a vector field representing the forward gradient of the input; for a vector input field, an order 4 tensor field representing the forward gradient of the input.

    Definition Classes
    CogFunctionAPI
  77. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  78. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  79. def imaginaryPart(field: Field): Field

    Permalink

    Extract the imaginary part of a complex field as a scalar field.

    Extract the imaginary part of a complex field as a scalar field.

    field

    The input field.

    returns

    A scalar field with the same shape as the input, with each element equal to the imaginary part of the corresponding complex element in the input.

    Definition Classes
    CogFunctionAPI
  80. def internalError(message: String): Unit

    Permalink

    Declare an internal error described by message.

    Declare an internal error described by message.

    Definition Classes
    CompilerError
  81. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  82. def log(field: Field): Field

    Permalink

    Apply the natural logarithm to every numeric element in field.

    Apply the natural logarithm to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to log(x).

    Definition Classes
    CogFunctionAPI
  83. def magnitude(field: Field): Field

    Permalink

    Take the magnitude of each element in a complex field

    Take the magnitude of each element in a complex field

    field

    The input field.

    returns

    Magnitude of the input field.

    Definition Classes
    CogFunctionAPI
  84. def matrixField(fields: Array[Array[Field]]): MatrixField

    Permalink

    Create a matrix field from a 2D array of scalar fields.

    Create a matrix field from a 2D array of scalar fields.

    For example, this can be used to stack N x K scalar fields to a single matrix field. Each matrix in the result will be N x K.

    fields

    The scalar fields to be stacked into a matrix field.

    returns

    The resulting matrix field.

    Definition Classes
    CogFunctionAPI
  85. def matrixField(fields: Array[Array[ScalarField]]): MatrixField

    Permalink

    Create a matrix field from a 2D array of scalar fields.

    Create a matrix field from a 2D array of scalar fields.

    For example, this can be used to stack N x K scalar fields to a single matrix field. Each matrix in the result will be N x K.

    fields

    The scalar fields to be stacked into a matrix field.

    returns

    The resulting matrix field.

    Definition Classes
    CogFunctionAPI
  86. def matrixField(fields: Array[VectorField]): MatrixField

    Permalink

    Create a matrix field from vector fields by "stacking" the vector fields.

    Create a matrix field from vector fields by "stacking" the vector fields.

    For example, this can be used to stack N vector fields to a single matrix field. If the length of the vectors in the vector fields is K, then each matrix in the result will be N x K.

    fields

    The vector fields to be stacked into a matrix field.

    returns

    The resulting matrix field.

    Definition Classes
    CogFunctionAPI
  87. def matrixField(fields: VectorField*): MatrixField

    Permalink

    Create a matrix field from vector fields by "stacking" the vector fields.

    Create a matrix field from vector fields by "stacking" the vector fields.

    For example, this can be used to stack N vector fields to a single matrix field. If the length of the vectors in the vector fields is K, then each matrix in the result will be N x K.

    fields

    The vector fields to be stacked into a matrix field.

    returns

    The resulting matrix field.

    Definition Classes
    CogFunctionAPI
  88. def matrixRow(field: Field, index: Int): Field

    Permalink

    Convert a matrix field to a vector field by stripping out one row from each matrix in the field and making it a vector.

    Convert a matrix field to a vector field by stripping out one row from each matrix in the field and making it a vector.

    field

    The input field.

    index

    The index of the desired row to strip out of each matrix and use as a vector.

    returns

    A vector field made up of the stripped out vectors from the input matrix field.

    Definition Classes
    CogFunctionAPI
  89. def max(field: Field, f2: Field): Field

    Permalink

    Select the maximum value of corresponding elements in two scalar fields.

    Select the maximum value of corresponding elements in two scalar fields.

    field

    The input field.

    f2

    Second scalar field to compare with field.

    returns

    Scalar field where each element is the largest corresponding elements in field or f2.

    Definition Classes
    CogFunctionAPI
  90. def max(field: Field, value: Float): Field

    Permalink

    For every element, x, in field, compute max(x, that) where 1.0f represents a "true" result and 0.0f represents a "false" result.

    For every element, x, in field, compute max(x, that) where 1.0f represents a "true" result and 0.0f represents a "false" result. The resulting field has the same field shape and tensor shape as filed.

    field

    The input field.

    value

    Operand for max operator.

    returns

    A field equal to field with each element, x, mapped to max(x, that).

    Definition Classes
    CogFunctionAPI
  91. def min(field: Field, f2: Field): Field

    Permalink

    Select the minimum value of corresponding elements in two scalar fields.

    Select the minimum value of corresponding elements in two scalar fields.

    field

    The input field.

    f2

    Second scalar field to compare with field.

    returns

    Scalar field where each element is the smallest corresponding elements in field or f2.

    Definition Classes
    CogFunctionAPI
  92. def min(field: Field, value: Float): Field

    Permalink

    For every element, x, in field, compute min(x, that) where 1.0f represents a "true" result and 0.0f represents a "false" result.

    For every element, x, in field, compute min(x, that) where 1.0f represents a "true" result and 0.0f represents a "false" result. The resulting field has the same field shape and tensor shape as field.

    field

    The input field.

    value

    Operand for min operator.

    returns

    A field equal to field with each element, x, mapped to min(x, that).

    Definition Classes
    CogFunctionAPI
  93. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  94. def normalizeL1(field: Field): Field

    Permalink

    Normalize a scalar field using the L1 norm.

    Normalize a scalar field using the L1 norm.

    field

    The input field.

    returns

    A normalized copy of the input field.

    Definition Classes
    CogFunctionAPI
  95. def normalizeL2(field: Field): Field

    Permalink

    Normalize a scalar field using the L2 norm.

    Normalize a scalar field using the L2 norm.

    field

    The input field.

    returns

    A normalized copy of the input field.

    Definition Classes
    CogFunctionAPI
  96. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  97. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  98. def phase(field: Field): Field

    Permalink

    Take the phase of each element in a complex field.

    Take the phase of each element in a complex field.

    This is also commonly called arg. This is a number in the range (-Pi, Pi]

    field

    The input field.

    returns

    Phase of the input field.

    Definition Classes
    CogFunctionAPI
  99. def polarComplex(magnitude: Field, phase: Field): Field

    Permalink

    Create a complex field from polar coordinates.

    Create a complex field from polar coordinates.

    magnitude

    Scalar field where each scalar is the magnitude of the desired complex field.

    phase

    Scalar field where each scalar is the phase of the desired complex field.

    returns

    Complex field built from magnitude and phase.

    Definition Classes
    CogFunctionAPI
  100. def pow(field: Field, that: Float): Field

    Permalink

    Raise each number in field to the power that.

    Raise each number in field to the power that. The resulting field has the same field shape and tensor shape as field.

    field

    The input field.

    that

    The exponent.

    returns

    Input field with every number raised to the power that.

    Definition Classes
    CogFunctionAPI
  101. def pow(field: Field, that: Int): Field

    Permalink

    Raise each number in field to the power that.

    Raise each number in field to the power that. The resulting field has the same field shape and tensor shape as field.

    field

    The input field.

    that

    The exponent.

    returns

    Input field with every number raised to the power that.

    Definition Classes
    CogFunctionAPI
  102. def probe(fields: Field*): Unit

    Permalink

    User mechanism for marking multiple fields as "probed"

    User mechanism for marking multiple fields as "probed"

    If a field is visible to reflection, it will be automatically named.

    fields

    The fields to be probed.

    Definition Classes
    CogFunctionAPI
  103. def probe(field: Field, userName: String = null): Field

    Permalink

    User mechanism for marking a field as "probed," optionally supplying a name for the field.

    User mechanism for marking a field as "probed," optionally supplying a name for the field.

    If a field is visible to reflection, it will be automatically named. In that case supplying a userName is unnecessary and not recommended.

    field

    The field to be probed.

    userName

    User's name for the field. If not supplied, the field is probed but uses system-inferred naming for the field.

    returns

    The field being probed.

    Definition Classes
    CogFunctionAPI
  104. def projectFrame(field: Field, filter: Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution, batchSize: Int = 1): Field

    Permalink

    Cross-correlate a vector field with a vector-field filter frame.

    Cross-correlate a vector field with a vector-field filter frame.

    field

    The input field.

    filter

    The filter to use for cross-correlation; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the crossCorrelation, also helps to determine the size of output field.

    batchSize

    The number of logical (possibly multi-plane) images present in the input field.

    returns

    Input field cross-correlated with filter using the supplied border and sampling policies.

    Definition Classes
    CogFunctionAPI
  105. def random(field: Field, bits: Int): Field

    Permalink

    Compute a random field based on this input field using cellular automaton based RNG.

    Compute a random field based on this input field using cellular automaton based RNG. The output ranges from [0 to 1] (inclusive) and is uniformly distributed.

    field

    The input field.

    bits

    The number of bits of precision to use

    returns

    A Vector field where each point in the field is random

    Definition Classes
    CogFunctionAPI
  106. def realPart(field: Field): Field

    Permalink

    Extract the real part of a complex field as a scalar field.

    Extract the real part of a complex field as a scalar field.

    field

    The input field.

    returns

    A scalar field with the same shape as the input, with each element equal to the real part of the corresponding complex element in the input.

    Definition Classes
    CogFunctionAPI
  107. def reciprocal(field: Field): Field

    Permalink

    Perform 1/x operation on every numeric element of a field.

    Perform 1/x operation on every numeric element of a field.

    Somewhat dangerous to use if any element in the field could be zero, since the resulting element would be NaN which does not throw an exception.

    field

    The input field.

    returns

    Input field with each numeric element, x, mapped to 1/x.

    Definition Classes
    CogFunctionAPI
  108. def reduceMax(field: Field): Field

    Permalink

    Reduce a vector field to a scalar field by mapping each vector to the maximum of its components.

    Reduce a vector field to a scalar field by mapping each vector to the maximum of its components.

    field

    The input field.

    returns

    A scalar field with each element equal to the maximum of the components of the corresponding vector in the input field.

    Definition Classes
    CogFunctionAPI
  109. def reduceMin(field: Field): Field

    Permalink

    Reduce a vector field to a scalar field by mapping each vector to the minimum of its components.

    Reduce a vector field to a scalar field by mapping each vector to the minimum of its components.

    field

    The input field.

    returns

    A scalar field with each element equal to the minimum of the components of the corresponding vector in the input field.

    Definition Classes
    CogFunctionAPI
  110. def reduceSum(field: Field): Field

    Permalink

    Reduce a vector field to a scalar field by mapping each vector to the sum of its components.

    Reduce a vector field to a scalar field by mapping each vector to the sum of its components.

    field

    The input field.

    returns

    A scalar field with each element equal to the sum of components of the corresponding vector in the input field.

    Definition Classes
    CogFunctionAPI
  111. def replicate(field: Field, shape: cogmath.geometry.Shape): Field

    Permalink

    Replicate a scalar field as matrices in a matrix field (each matrix in the matrix field is identical to the input scalar field).

    Replicate a scalar field as matrices in a matrix field (each matrix in the matrix field is identical to the input scalar field).

    field

    The input field.

    shape

    The shape of the resulting output field.

    returns

    A matrix field with the same field shape as f2 and tensor shape the same as the input scalar field.

    Definition Classes
    CogFunctionAPI
  112. def reshape(field: Field, fieldShape: cogmath.geometry.Shape, tensorShape: cogmath.geometry.Shape, checkLegacyReshape: Boolean = Cog.checkLegacyReshape): Field

    Permalink

    Change the shape of a scalar field without changing the number of elements in it.

    Change the shape of a scalar field without changing the number of elements in it.

    This depends on the row-major ordering we use for elements in a field. Elements in any scalar field, regardless of dimension, have that linear ordering. Reshaping preserves that ordering; it really does nothing more than change the sizes of each dimension of the field.

    field

    The input field.

    fieldShape

    the output field shape to use

    tensorShape

    the output tensor shape to use

    checkLegacyReshape

    Warn of uses of reshape that had different behaviors prior to libcog 4.3

    returns

    The input field, reshaped, with the same elements in the same linear order.

    Definition Classes
    CogFunctionAPI
  113. def reshape(field: Field, size: Int*): Field

    Permalink

    Change the shape of a scalar field without changing the number of elements in it.

    Change the shape of a scalar field without changing the number of elements in it.

    This depends on the row-major ordering we use for elements in a field. Elements in any scalar field, regardless of dimension, have that linear ordering. Reshaping preserves that ordering; it really does nothing more than change the sizes of each dimension of the field.

    field

    The input field.

    size

    A sequence of new sizes for each dimensions. The product of this sequence must equal the number of elements in the input field.

    returns

    The input field, reshaped, with the same elements in the same linear order.

    Definition Classes
    CogFunctionAPI
  114. def reverseCrossDot(field: Field, f2: Field): Field

    Permalink

    Multiply a matrix field, field, by a scalar field, f2, to produce a scalar field.

    Multiply a matrix field, field, by a scalar field, f2, to produce a scalar field.

    The matrix field and scalar field operands must have identical field shapes. Each scalar element of the scalar field is multiplied by the corresponding element in the matrix field. These products are then summed to produce the scalar field result (which has the same shape as the matrices in the matrix field).

    field

    The input field.

    f2

    Scalar field operand which have the same field shape as field.

    returns

    Product of field and f2.

    Definition Classes
    CogFunctionAPI
  115. def select[T <: Field](fields: Array[T], index: Field): Field

    Permalink

    Dynamically select a scalar field from an array of scalar fields.

    Dynamically select a scalar field from an array of scalar fields.

    Example:

    val fields: Array[ScalarFieldExpr] = ...
    val index: ScalarFieldExpr
    val selected: ScalarFieldExpr = select(fields, index)
    index

    0-dimensional scalar field supplying the index for the array to be read.

    returns

    If index is in-bounds for the array, returns the selected field from that array; if index is out-of-bounds, returns a field of NaNs.

    Definition Classes
    CogFunctionAPI
  116. def shift(field: Field, rowShift: Int, colShift: Int): Field

    Permalink

    Shift a 2D scalar field in both dimensions, pulling in zeroes where necessary.

    Shift a 2D scalar field in both dimensions, pulling in zeroes where necessary. Negative shift amounts result in shifts up and to the left, while positive shift amounts result in shifts down and to the right.

    field

    The input field.

    rowShift

    Number of pixels to shift field.

    colShift

    Number of pixels to shift field.

    returns

    Shifted input field.

    Definition Classes
    CogFunctionAPI
  117. def shift(field: Field, colShift: Int): Field

    Permalink

    Shift a 1D scalar field left (negative colShift) or right (positive colShift), pulling in zeroes where necessary.

    Shift a 1D scalar field left (negative colShift) or right (positive colShift), pulling in zeroes where necessary.

    field

    The input field.

    colShift

    Number of pixels to shift field.

    returns

    Shifted input field.

    Definition Classes
    CogFunctionAPI
  118. def shiftCyclic(field: Field, rowShift: Int, colShift: Int): Field

    Permalink

    Shift a 2D scalar field in both dimensions, pulling in values from the opposite side where necessary.

    Shift a 2D scalar field in both dimensions, pulling in values from the opposite side where necessary. Negative shift amounts result in shifts up and to the left, while positive shift amounts result in shifts down and to the right.

    field

    The input field.

    rowShift

    Number of pixels to shift field.

    colShift

    Number of pixels to shift field.

    returns

    Shifted input field.

    Definition Classes
    CogFunctionAPI
  119. def shiftCyclic(field: Field, colShift: Int): Field

    Permalink

    Shift a 1D scalar field left (negative colShift) or right (positive colShift), pulling in values from the opposite side where necessary.

    Shift a 1D scalar field left (negative colShift) or right (positive colShift), pulling in values from the opposite side where necessary.

    field

    The input field.

    colShift

    Number of pixels to shift field.

    returns

    Shifted input field.

    Definition Classes
    CogFunctionAPI
  120. def signum(field: Field): Field

    Permalink

    Apply the signum operator to every numeric element in field.

    Apply the signum operator to every numeric element in field.

    Signum(x) is defined to be:

    1 if x > 0

    0 if x: Field =

    -1 if x < 0

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to signum(x).

    Definition Classes
    CogFunctionAPI
  121. def sin(field: Field): Field

    Permalink

    Apply the sine operator to every numeric element in field.

    Apply the sine operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to sin(x).

    Definition Classes
    CogFunctionAPI
  122. def sinh(field: Field): Field

    Permalink

    Apply the hyperbolic sine operator to every numeric element in field.

    Apply the hyperbolic sine operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to sinh(x).

    Definition Classes
    CogFunctionAPI
  123. def solve(field: Field, b: Field): Field

    Permalink

    Solve Ax - b

    Solve Ax - b

    This actually solves the equation for each matrix / vector pair in the fields field and b, producing a vector field representing x. The vectors in b must be length 2 and the matrices in field must be 2 x 2. Solves the equations using the pseudo inverse

    field

    The input field.

    b

    Vector field argument.

    returns

    The solution, x, to the set of linear equations.

    Definition Classes
    CogFunctionAPI
  124. def sq(field: Field): Field

    Permalink

    Apply the square operator to every numeric element in field.

    Apply the square operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to (x * x).

    Definition Classes
    CogFunctionAPI
  125. def sqrt(field: Field): Field

    Permalink

    Apply the square root operator to every numeric element in field.

    Apply the square root operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to sqrt(x).

    Definition Classes
    CogFunctionAPI
  126. def stack[T <: Field](fields: Array[T]): Field

    Permalink

    Stack tensor fields to create a higher-order tensor field.

    Stack tensor fields to create a higher-order tensor field.

    For example, this can be used to stack N scalar fields to a single vector field where each vector is of length N.

    fields

    The fields to be stacked.

    returns

    The resulting, higher-order tensor field.

    Definition Classes
    CogFunctionAPI
  127. def stack(fields: Field*): Field

    Permalink

    Stack tensor fields to create a higher-order tensor field.

    Stack tensor fields to create a higher-order tensor field.

    For example, this can be used to stack N scalar fields to a single vector field where each vector is of length N.

    fields

    The fields to be stacked.

    returns

    The resulting, higher-order tensor field.

    Definition Classes
    CogFunctionAPI
  128. def subfield(field: Field, guide: Field, shape: cogmath.geometry.Shape, border: platform.types.BorderPolicy = BorderClamp): Field

    Permalink

    Extracts a window from a 1D or 2D scalar, vector or matrix field, guided by a 0D vector field called "the guide." The guide specifies the upper-left-most (or left-most for 1D fields) point of the window, and shape specifies the size of the window.

    Extracts a window from a 1D or 2D scalar, vector or matrix field, guided by a 0D vector field called "the guide." The guide specifies the upper-left-most (or left-most for 1D fields) point of the window, and shape specifies the size of the window.

    A guiding vector with value (v1, v2) means a given point (row, col) extracts the element at location (row + v1, col + v2) as its output. If that location falls outside of the field, the BorderPolicy attached to the the opcode determines how the missing value is computed. If either of the guide vector components v1 and v2 is non-integral, bilinear interpolation is used to to determine the approximate value.

    field

    The input field.

    guide

    The guide vector.

    shape

    Shape of the window.

    border

    Policy for handling border processing.

    returns

    Extracted window.

    Definition Classes
    CogFunctionAPI
  129. def subfields(field: Field, diameter: Int): Field

    Permalink

    Extract all subfields from a 2D scalar field into a 2-D vector field.

    Extract all subfields from a 2D scalar field into a 2-D vector field.

    field

    The input field.

    diameter

    Sizes (rows and columns) of each subfield. Must be odd.

    returns

    A 2-D vector field where the length of the vector equals the number of diameter x diameter subfields in the input. For example, a 4 x 4 input field has four subfields of size 3 x 3, so this operator would return a 2-D vector field of size 3 x 3 (the size of the subfields) with vectors of length 4. Each layer of the vector field is one subfield of of the input.

    Definition Classes
    CogFunctionAPI
  130. def supersample(field: Field): Field

    Permalink

    Supersample a scalar field by 2X in each dimension, replicating pixels to fill in the gaps.

    Supersample a scalar field by 2X in each dimension, replicating pixels to fill in the gaps.

    field

    The input field.

    returns

    Input field expanded by 2X in each dimension with pixel replication.

    Definition Classes
    CogFunctionAPI
  131. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  132. def tan(field: Field): Field

    Permalink

    Apply the tangent operator to every numeric element in field.

    Apply the tangent operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to tan(x).

    Definition Classes
    CogFunctionAPI
  133. def tanh(field: Field): Field

    Permalink

    Apply the hyperbolic tangent operator to every numeric element in field.

    Apply the hyperbolic tangent operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to tanh(x).

    Definition Classes
    CogFunctionAPI
  134. def toColorField(field: Field): ColorField

    Permalink

    Explicit conversion of a Field to a ColorField.

    Explicit conversion of a Field to a ColorField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ColorField but stored in a Field variable. This method also supports converting a ScalarField or VectorField to a ColorField.

    field

    The input field.

    returns

    The converted field.

    Definition Classes
    CogFunctionAPI
  135. def toComplexField(field: Field): ComplexField

    Permalink

    Explicit conversion of a Field to a ComplexField.

    Explicit conversion of a Field to a ComplexField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ComplexField but stored in a Field variable. This method also supports converting a ScalarField to a ComplexField.

    field

    The input field.

    returns

    The converted field.

    Definition Classes
    CogFunctionAPI
  136. def toComplexVectorField(field: Field): ComplexVectorField

    Permalink

    Explicit conversion of a Field to a ComplexVectorField.

    Explicit conversion of a Field to a ComplexVectorField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ComplexVectorField but stored in a Field variable. This method also supports converting a VectorField to a ComplexVectorField.

    field

    The input field.

    returns

    The converted field.

    Definition Classes
    CogFunctionAPI
  137. def toGenericComplexField(field: Field): Field

    Permalink

    Another explicit conversion, this time working on both ScalarFields and VectorFields.

    Another explicit conversion, this time working on both ScalarFields and VectorFields. The return type is Field though, the common base class of both ComplexFields and ComplexScalarFields.

    field

    The input field.

    Definition Classes
    CogFunctionAPI
  138. def toMatrixField(field: Field): MatrixField

    Permalink

    Explicit conversion of a Field to a MatrixField.

    Explicit conversion of a Field to a MatrixField. Since Field is abstract, the only possible conversion is if the field is already a MatrixField but is stored in a Field variable. This merely does the necessary type coercion.

    field

    The input field.

    returns

    The converted field.

    Definition Classes
    CogFunctionAPI
  139. def toScalarField(field: Field): ScalarField

    Permalink

    Explicit conversion of a Field to a ScalarField.

    Explicit conversion of a Field to a ScalarField. Since Field is abstract, the only possible conversion is if the field is already a ScalarField but is stored in a Field variable. This merely does the necessary type coercion.

    field

    The input field.

    returns

    The converted field.

    Definition Classes
    CogFunctionAPI
  140. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  141. def toVectorField(field: Field): VectorField

    Permalink

    Explicit conversion of a Field to a VectorField.

    Explicit conversion of a Field to a VectorField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a VectorField but stored in a Field variable. This method also supports converting a ColorField to a VectorField.

    field

    The input field.

    returns

    The converted field.

    Definition Classes
    CogFunctionAPI
  142. def transform(field: Field, f2: Field): Field

    Permalink

    (1) Multiply a matrix field by a matrix field to produce a matrix field; or (2) multiply a matrix field by a vector field to produce a vector field.

    (1) Multiply a matrix field by a matrix field to produce a matrix field; or (2) multiply a matrix field by a vector field to produce a vector field.

    For case (1), corresponding matrices in field and f2 are multiplied using standard matrix multiplication to produce the corresponding matrix in the resulting matrix field.

    For case (2), corresponding matrix/vector pari in field and f2 are multiplied using standard matrix/vector multiplication to produce the corresponding vector (a linear transformation of the input vector) in the resulting vector field.

    field

    The input field.

    f2

    Matrix field or vector field; must have the same field shape as field.

    returns

    Matrix field or vector representing the matrix multiplications of corresponding elements in the two input fields.

    Definition Classes
    CogFunctionAPI
  143. def transpose(field: Field): Field

    Permalink

    Transpose a 2D tensor field or color field.

    Transpose a 2D tensor field or color field.

    field

    The input field.

    Definition Classes
    CogFunctionAPI
  144. def transposeMatrices(field: Field): Field

    Permalink

    Transpose all the matrices in a matrix field to produce a new matrix field.

    Transpose all the matrices in a matrix field to produce a new matrix field.

    field

    The input field.

    returns

    Copy of input matrix field with all matrices transposed.

    Definition Classes
    CogFunctionAPI
  145. def transposeVectors(field: Field): Field

    Permalink

    Transpose each vector in a vector field to a single row matrix, thus creating a matrix field from a vector field

    Transpose each vector in a vector field to a single row matrix, thus creating a matrix field from a vector field

    field

    The input field.

    returns

    Copy of input matrix field with all vectors transposed to single row matrices.

    Definition Classes
    CogFunctionAPI
  146. def trim(field: Field, resultShape: cogmath.geometry.Shape): Field

    Permalink

    "Trim" a field to a smaller size by clipping off indices (maintaining the origin).

    "Trim" a field to a smaller size by clipping off indices (maintaining the origin).

    field

    The input field.

    resultShape

    Desired shape of the resulting field; must not be larger in any dimension than the corresponding dimension of the input field

    returns

    The trimmed field.

    Definition Classes
    CogFunctionAPI
  147. def upsample(field: Field, factor: Int = 2, phase: Int = 0): Field

    Permalink

    Upsample with zeroes inserted between field points, increasing the size of the input in all dimensions.

    Upsample with zeroes inserted between field points, increasing the size of the input in all dimensions.

    Example: for input field {1,2,3}

    input.upsample(2) yields {1,0,2,0,3,0}
    
    input.upsample(2,1) yields {0,1,0,2,0,3}
    field

    The input field.

    factor

    The sampling factor, defaults to 2.

    phase

    The offset within the scaled up field to put the input data, defaults to an offset of 0.

    Definition Classes
    CogFunctionAPI
  148. def vectorElement(field: Field, index: Int): Field

    Permalink

    Convert a vector field to a scalar field by extracting one element of each vector.

    Convert a vector field to a scalar field by extracting one element of each vector.

    field

    The input field.

    index

    The element of each vector to be extracted.

    returns

    Input field with tensor order reduced by one.

    Definition Classes
    CogFunctionAPI
  149. def vectorElements(field: Field, indices: Field): Field

    Permalink

    Convert a vector field to a smaller vector field by extracting a dynamically indexed a range of elements

    Convert a vector field to a smaller vector field by extracting a dynamically indexed a range of elements

    field

    The input field.

    returns

    Input field with tensor order reduced by one.

    Definition Classes
    CogFunctionAPI
  150. def vectorField(field: ColorField): VectorField

    Permalink

    Convert a color field to a vector field, with each vector of length 3 representing, in order, the red, green and blue components of the corresponding pixel.

    Convert a color field to a vector field, with each vector of length 3 representing, in order, the red, green and blue components of the corresponding pixel.

    field

    Color field to be converted to vector field.

    returns

    Vector field, with each vector holding the red, green, blue components.

    Definition Classes
    CogFunctionAPI
  151. def vectorField(fields: Array[Field]): VectorField

    Permalink

    Create a vector field from scalar fields by "stacking" the scalar fields.

    Create a vector field from scalar fields by "stacking" the scalar fields.

    For example, this can be used to stack N scalar fields to a single vector field where each vector is of length N.

    fields

    The scalar fields to be stacked into a vector field.

    returns

    The resulting vector field.

    Definition Classes
    CogFunctionAPI
  152. def vectorField(fields: Array[ScalarField]): VectorField

    Permalink

    Create a vector field from scalar fields by "stacking" the scalar fields.

    Create a vector field from scalar fields by "stacking" the scalar fields.

    For example, this can be used to stack N scalar fields to a single vector field where each vector is of length N.

    fields

    The scalar fields to be stacked into a vector field.

    returns

    The resulting vector field.

    Definition Classes
    CogFunctionAPI
  153. def vectorField(fields: ScalarField*): VectorField

    Permalink

    Create a vector field from scalar fields by "stacking" the scalar fields.

    Create a vector field from scalar fields by "stacking" the scalar fields.

    For example, this can be used to stack N scalar fields to a single vector field where each vector is of length N.

    fields

    The scalar fields to be stacked into a vector field.

    returns

    The resulting vector field.

    Definition Classes
    CogFunctionAPI
  154. implicit def vectorTo0DVectorField(v: cogmath.algebra.real.Vector): VectorField

    Permalink

    Implicit conversion of a Vector to a 0D constant VectorField which allows for fields to be combined with vectors in a simple way.

    Implicit conversion of a Vector to a 0D constant VectorField which allows for fields to be combined with vectors in a simple way. This makes it possible to express commutative operations with a common syntax.

    For example

    Field + Vector

    and

    Vector + Field

    are both legal and compilable with this implicit conversion.

    v

    The vector to be converted to a 0D vector field.

    returns

    A 0D vector field initialized to v.

    Definition Classes
    ImplicitConversions
  155. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  156. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  157. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  158. def warp(field: Field, guide: Field, border: platform.types.BorderPolicy = BorderClamp): Field

    Permalink

    Warps a 2D scalar, vector or matrix field, guided by a vector field called "the guide." The guide must either be zero-dimensional, in which case the input field is translated uniformly, or must be a 2D vector field with exactly the same shape as the input.

    Warps a 2D scalar, vector or matrix field, guided by a vector field called "the guide." The guide must either be zero-dimensional, in which case the input field is translated uniformly, or must be a 2D vector field with exactly the same shape as the input.

    The guiding vector with value (v1, v2) at a given point (row, col) extracts the element at location (row - v1, col - v2) as its output. If that location falls outside of the field, the BorderPolicy attached to the the opcode determines how the missing value is computed. If either of the guide vector components v1 and v2 is non-integral, bilinear interpolation is used to to determine the approximate value.

    field

    The input field.

    guide

    The guiding vector field.

    border

    Policy for handling borders.

    returns

    Input field, warped by the guide.

    Definition Classes
    CogFunctionAPI
  159. def winnerTakeAll(field: Field): Field

    Permalink

    Compute the "winner" of a scalar field by mapping its largest element to 1.0f and the other elements to 0.0f

    Compute the "winner" of a scalar field by mapping its largest element to 1.0f and the other elements to 0.0f

    This is not well-defined when multiple elements share the maximum value, so beware.

    field

    The input field.

    returns

    A scalar field with the same shape as the input, with a single element containing 1.0f and the rest containing 0.0f.

    Definition Classes
    CogFunctionAPI

Deprecated Value Members

  1. def bilateralFilter(field: Field, spatialFilter: cogmath.algebra.real.Matrix, rangeSigma: Float): Field

    Permalink

    Perform bilateral filtering using spatialFilter for spatial filtering (typically this will be a truncated Gaussian) and a Gaussian with width rangeSigma for range filtering.

    Perform bilateral filtering using spatialFilter for spatial filtering (typically this will be a truncated Gaussian) and a Gaussian with width rangeSigma for range filtering.

    WARNING: This is an old algorithm that is not very efficient. Consider a newer algorithm such as domain transform filtering.

    field

    The input field.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) inefficient, use domain transform filter instead

  2. def conditionNumber(field: Field): Field

    Permalink

    Given a matrix field, compute the condition number for each matrix in that field.

    Given a matrix field, compute the condition number for each matrix in that field. This is currently limited to fields containing 2 x 2 matrices.

    field

    The input field.

    returns

    Scalar field holding the condition numbers for the corresponding matrices in the input matrix field.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  3. def determinant(field: Field): Field

    Permalink

    Compute the determinant of every matrix in a matrix field.

    Compute the determinant of every matrix in a matrix field.

    field

    The input field.

    returns

    Scalar field holding the determinants for the corresponding matrices in the input matrix field.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  4. def domainFilterColumns(field: Field, domainTransform: ScalarField, boxFilterRadius: Float): Field

    Permalink

    Perform a "domain filter" on the columns of a color field as a step in edge-aware normalized convolution.

    Perform a "domain filter" on the columns of a color field as a step in edge-aware normalized convolution. This "correlates" an adaptive box filter with each pixel in the columns of the color field, guided by domainTransform.

    This operation works only on color fields and is an optimization. The following code sequences, A and B, are functionally identical:

    // Prepare for filtering
    val rowTransform: Field =
    val colTransform: Field =
    
    // Sequence A (slower)
    var smooth = colorImage
    smooth = smooth.domainFilterRows(rowTransform, ...)
    smooth = smooth.transpose.domainFilterRows(colTransform, ...).transpose
    
    // Sequence B, using this operation (faster, no transposes)
    var smooth = colorImage
    smooth = smooth.domainFilterRows(rowTransform, ...)
    smooth = smooth.domainFilterColumns(colTransform, ...)

    For details, see the paper "Domain transform for edge-aware image and video processing," Gastal and Oliveira, 2011. Normally this is not useful for end-users, but you're welcome to try it if you would like to write your own edge-aware filters.

    field

    The input field.

    domainTransform

    The cumulative domain transform for the image.

    boxFilterRadius

    Radius of box filter.

    returns

    The domain transform of the columns (equation 11) in the Gastal paper as a scalar field.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  5. def domainFilterRows(field: Field, domainTransform: Field, boxFilterRadius: Float): Field

    Permalink

    Perform a "domain filter" on the rows of a tensor or color field as a step in edge-aware normalized convolution.

    Perform a "domain filter" on the rows of a tensor or color field as a step in edge-aware normalized convolution. This "correlates" an adaptive box filter with each pixel in the rows of the color field, guided by domainTransform.

    For details, see the paper "Domain transform for edge-aware image and video processing," Gastal and Oliveira, 2011. Normally this is not useful for end-users, but you're welcome to try it if you would like to write your own edge-aware filters.

    field

    The input field.

    domainTransform

    The cumulative domain transform for the image.

    boxFilterRadius

    Radius of box filter.

    returns

    The domain transform of the rows (equation 11) in the Gastal paper as a scalar field.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  6. def domainTransformRows(field: Field, spaceSigma: Float, rangeSigma: Float): Field

    Permalink

    Perform a "domain transform" on the rows of a color field or tensor field as a step in edge-aware normalized convolution.

    Perform a "domain transform" on the rows of a color field or tensor field as a step in edge-aware normalized convolution.

    For details, see the paper "Domain transform for edge-aware image and video processing," Gastal and Oliveira, 2011. Normally this is not useful for end-users, but you're welcome to try it if you would like to write your own edge-aware filters.

    field

    The input field.

    spaceSigma

    Width of filter in space.

    rangeSigma

    Width of filter in range.

    returns

    The domain transform of the rows (equation 11) in the Gastal paper as a scalar field.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  7. def invertMatrices(field: Field): Field

    Permalink

    Invert all matrices in a matrix field using Gauss-Jordan elimination.

    Invert all matrices in a matrix field using Gauss-Jordan elimination.

    This is numerically stable only for small matrices, and let's not even get in to singular matrices. Be careful.

    field

    The input field.

    returns

    A matrix field where each matrix is the (approximate) inverse of the corresponding matrix in the input matrix field.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  8. def localMax(field: Field, neighborhood: cogmath.algebra.real.Matrix): Field

    Permalink

    Find the local maximum of a neighborhood centered on each pixel in a 2D scalar field.

    Find the local maximum of a neighborhood centered on each pixel in a 2D scalar field.

    For each point in the input 2D scalar field, this searches a small neighborhood of that point and extracts the largest scalar found.

    The neighborhood is defined by a matrix which is centered on the point. A non-zero value in the kernel means the corresponding point in the field is part of the neighborhood, while a zero implies the point should be ignored.

    For example, the kernel

    1 1 0
    1 1 0
    0 0 0

    specifies the 2 x 2 neighborhood for the maximum value search.

    field

    The input field.

    neighborhood

    An odd-sized matrix describing the neighborhood for doing the local max search. TO DO: This will become a field rather than a matrix. XXX

    returns

    A scalar field with the same shape as the input, where each element is equal to the local max of the input field as defined by neighborhood.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  9. def localMaxPosition(field: Field, neighborhood: cogmath.algebra.real.Matrix): Field

    Permalink

    For a scalar field, find the relative position of the local maximum of a neighborhood centered on the current pixel.

    For a scalar field, find the relative position of the local maximum of a neighborhood centered on the current pixel. This is returned as vector field, with each vector's tail at the current pixel and the head pointing at the pixel containing the neighborhood's local maximum.

    The neighborhood is defined by a matrix which is centered on the point. A non-zero value in the kernel means the corresponding point in the field is part of the neighborhood, while a zero implies the point should be ignored.

    For example, the kernel

    1 1 0
    1 1 0
    0 0 0

    specifies the 2 x 2 neighborhood for the maximum value search.

    field

    The input field.

    neighborhood

    An odd-sized matrix describing the neighborhood for doing the local max search. TO DO: This will become a field rather than a matrix. XXX

    returns

    A vector field with the same field shape as the input scalar field, with each vector pointing to the maximum value in the neighborhood relative to the center of the neighborhood.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  10. def localMin(field: Field, neighborhood: cogmath.algebra.real.Matrix): Field

    Permalink

    Find the local minimum of a neighborhood centered on each pixel in a 2D scalar field.

    Find the local minimum of a neighborhood centered on each pixel in a 2D scalar field.

    For each point in the input 2D scalar field, this searches a small neighborhood of that point and extracts the smallest scalar found.

    The neighborhood is defined by a matrix which is centered on the point. A non-zero value in the kernel means the corresponding point in the field is part of the neighborhood, while a zero implies the point should be ignored.

    For example, the kernel

    1 1 0
    1 1 0
    0 0 0

    specifies the 2 x 2 neighborhood for the minimum value search.

    field

    The input field.

    neighborhood

    An odd-sized matrix describing the neighborhood for doing the local max search. TO DO: This will become a field rather than a matrix. XXX

    returns

    A scalar field with the same shape as the input, where each element is equal to the local min of the input field as defined by neighborhood.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  11. def localMinPosition(field: Field, neighborhood: cogmath.algebra.real.Matrix): Field

    Permalink

    For a scalar field, find the relative position of the local minimum of a neighborhood centered on the current pixel.

    For a scalar field, find the relative position of the local minimum of a neighborhood centered on the current pixel. This is returned as vector field, with each vector's tail at the current pixel and the head pointing at the pixel containing the neighborhood's local manimum.

    The neighborhood is defined by a matrix which is centered on the point. A non-zero value in the kernel means the corresponding point in the field is part of the neighborhood, while a zero implies the point should be ignored.

    For example, the kernel

    1 1 0
    1 1 0
    0 0 0

    specifies the 2 x 2 neighborhood for the minimum value search.

    field

    The input field.

    neighborhood

    An odd-sized matrix describing the neighborhood for doing the local min search. TO DO: This will become a field rather than a matrix. XXX

    returns

    A vector field with the same field shape as the input scalar field, with each vector pointing to the minimum value in the neighborhood relative to the center of the neighborhood.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  12. def maxPosition(field: Field): Field

    Permalink

    Find the location/position of the maximum element in a scalar field.

    Find the location/position of the maximum element in a scalar field.

    field

    The input field.

    returns

    A 0D vector field containing a vector holding the indices of the maximum element.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  13. def medianFilter(field: Field): Field

    Permalink

    Filter a 2D input scalar field with a 3 x 3 median filter.

    Filter a 2D input scalar field with a 3 x 3 median filter.

    field

    The input field.

    returns

    A 2D scalar field with the same field shape as the input, with each element median filtered.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  14. def nonMaximumSuppression(field: Field): Field

    Permalink

    Forces locally non-maximum pixels to zero for both scalar fields and vector fields.

    Forces locally non-maximum pixels to zero for both scalar fields and vector fields.

    Locality is defined to be the 8 nearest neighbors to a given pixel. If a pixel is greater than or equal to any of those neighbors, its value is left intact on the output, otherwise it's set to zero. Note that border pixels have only 5 nearest neighbors and corner pixels have only 3 nearest neighbors, so those are the only ones checked.

    Vector fields are treated as though they were an array of scalar fields, so non-maximum suppression is executed independently on each.

    field

    The input field.

    returns

    A copy of the input field with locally non-maximum values set to zero.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  15. def orientedNonMaximumSuppression(field: Field, orientation: Field): Field

    Permalink

    Forces locally non-maximum pixels to zero for calar fields, but only when comparing the pixels on either side of a given pixel, using orientation to define where to look for the two pixels for comparison.

    Forces locally non-maximum pixels to zero for calar fields, but only when comparing the pixels on either side of a given pixel, using orientation to define where to look for the two pixels for comparison.

    field

    The input field.

    orientation

    A scalar field holding the local orientation of the input field at every point. Orientation ranges from -Pi/2 to Pi/2, where the corresponding orientation rotates clockwise from horizontal (-Pi/2) to vertical (0) to horizontal (Pi/2).

    returns

    A copy of the input field with locally non-maximum values set to zero.

    Definition Classes
    CogFunctionAPI
    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

Inherited from CogFunctionAPI

Inherited from ImplicitConversions

Inherited from SemanticError

Inherited from CompilerError

Inherited from AnyRef

Inherited from Any

Ungrouped