Package org.opencv.dnn_superres

## Class DnnSuperResImpl

- java.lang.Object
- - org.opencv.dnn_superres.DnnSuperResImpl

-     public class DnnSuperResImpl
      extends java.lang.Object

  A class to upscale images via convolutional neural networks. The following four models are implemented:
  - edsr
  - espcn
  - fsrcnn
  - lapsrn

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected long` | `nativeObj` |

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static DnnSuperResImpl` | `__fromPtr__​(long addr)` |
    `static DnnSuperResImpl` | `create()` | Empty constructor for python
    `protected void` | `finalize()` |
    `java.lang.String` | `getAlgorithm()` | Returns the scale factor of the model:
    `long` | `getNativeObjAddr()` |
    `int` | `getScale()` | Returns the scale factor of the model:
    `void` | `readModel​(java.lang.String path)` | Read the model from the given path
    `void` | `setModel​(java.lang.String algo, int scale)` | Set desired model
    `void` | `setPreferableBackend​(int backendId)` | Set computation backend
    `void` | `setPreferableTarget​(int targetId)` | Set computation target
    `void` | `upsample​(Mat img, Mat result)` | Upsample via neural network
    `void` | `upsampleMultioutput​(Mat img, java.util.List<Mat> imgs_new, MatOfInt scale_factors, java.util.List<java.lang.String> node_names)` | Upsample via neural network of multiple outputs

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

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

- - ### Field Detail

    - #### nativeObj

          protected final long nativeObj

  - ### Constructor Detail

    - #### DnnSuperResImpl

          protected DnnSuperResImpl​(long addr)

  - ### Method Detail

    - #### getNativeObjAddr

          public long getNativeObjAddr()

    - #### __fromPtr__

          public static DnnSuperResImpl __fromPtr__​(long addr)

    - #### create

          public static DnnSuperResImpl create()

      Empty constructor for python
      Returns:
        automatically generated

    - #### readModel

          public void readModel​(java.lang.String path)

      Read the model from the given path
      Parameters:
        `path` - Path to the model file.

    - #### setModel

          public void setModel​(java.lang.String algo,
                               int scale)

      Set desired model
      Parameters:
        `algo` - String containing one of the desired models:
        - __edsr__
        - __espcn__
        - __fsrcnn__
        - __lapsrn__
        `scale` - Integer specifying the upscale factor

    - #### setPreferableBackend

          public void setPreferableBackend​(int backendId)

      Set computation backend
      Parameters:
        `backendId` - automatically generated

    - #### setPreferableTarget

          public void setPreferableTarget​(int targetId)

      Set computation target
      Parameters:
        `targetId` - automatically generated

    - #### upsample

          public void upsample​(Mat img,
                               Mat result)

      Upsample via neural network
      Parameters:
        `img` - Image to upscale
        `result` - Destination upscaled image

    - #### upsampleMultioutput

          public void upsampleMultioutput​(Mat img,
                                          java.util.List<Mat> imgs_new,
                                          MatOfInt scale_factors,
                                          java.util.List<java.lang.String> node_names)

      Upsample via neural network of multiple outputs
      Parameters:
        `img` - Image to upscale
        `imgs_new` - Destination upscaled images
        `scale_factors` - Scaling factors of the output nodes
        `node_names` - Names of the output nodes in the neural network

    - #### getScale

          public int getScale()

      Returns the scale factor of the model:
      Returns:
        Current scale factor.

    - #### getAlgorithm

          public java.lang.String getAlgorithm()

      Returns the scale factor of the model:
      Returns:
        Current algorithm.

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

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