Package org.opencv.dnn

## Class Layer

- java.lang.Object
- - org.opencv.core.Algorithm
  - - org.opencv.dnn.Layer

-     public class Layer
      extends Algorithm

  This interface class allows to build new Layers - are building blocks of networks. Each class, derived from Layer, must implement forward() method to compute outputs. Also before using the new layer into networks you must register your layer by using one of REF: dnnLayerFactory "LayerFactory" macros.

- - ### Field Summary

    - ### Fields inherited from class org.opencv.core.Algorithm

      `nativeObj`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `Layer​(long addr)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static Layer` | `__fromPtr__​(long addr)` |
    `protected void` | `finalize()` |
    `void` | `finalize​(java.util.List<Mat> inputs, java.util.List<Mat> outputs)` | Computes and sets internal parameters according to inputs, outputs and blobs.
    `java.util.List<Mat>` | `get_blobs()` |
    `java.lang.String` | `get_name()` |
    `int` | `get_preferableTarget()` |
    `java.lang.String` | `get_type()` |
    `int` | `outputNameToIndex​(java.lang.String outputName)` | Returns index of output blob in output array.
    `void` | `run​(java.util.List<Mat> inputs, java.util.List<Mat> outputs, java.util.List<Mat> internals)` | Deprecated. This method will be removed in the future release.
    `void` | `set_blobs​(java.util.List<Mat> blobs)` |

    - ### Methods inherited from class org.opencv.core.Algorithm

      `clear, empty, getDefaultName, getNativeObjAddr, save`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Layer

          protected Layer​(long addr)

  - ### Method Detail

    - #### __fromPtr__

          public static Layer __fromPtr__​(long addr)

    - #### finalize

          public void finalize​(java.util.List<Mat> inputs,
                               java.util.List<Mat> outputs)

      Computes and sets internal parameters according to inputs, outputs and blobs.
      Parameters:
        `outputs` - vector of already allocated output blobs This method is called after network has allocated all memory for input and output blobs and before inferencing.
        `inputs` - automatically generated

    - #### run

          @Deprecated
          public void run​(java.util.List<Mat> inputs,
                          java.util.List<Mat> outputs,
                          java.util.List<Mat> internals)

      Deprecated.
      This method will be removed in the future release.
      Allocates layer and computes output.
      Parameters:
        `inputs` - automatically generated
        `outputs` - automatically generated
        `internals` - automatically generated

    - #### outputNameToIndex

          public int outputNameToIndex​(java.lang.String outputName)

      Returns index of output blob in output array. SEE: inputNameToIndex()
      Parameters:
        `outputName` - automatically generated
      Returns:
        automatically generated

    - #### get_blobs

          public java.util.List<Mat> get_blobs()

    - #### set_blobs

          public void set_blobs​(java.util.List<Mat> blobs)

    - #### get_name

          public java.lang.String get_name()

    - #### get_type

          public java.lang.String get_type()

    - #### get_preferableTarget

          public int get_preferableTarget()

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `Algorithm`
      Throws:
        `java.lang.Throwable`