Class DnnSuperResImpl
A class to upscale images via convolutional neural networks. The following four models are implemented:
- edsr
- espcn
- fsrcnn
- lapsrn
Implements
Inherited Members
Namespace: OpenCvSharp.DnnSuperres
Assembly: OpenCvSharp.dll
Syntax
public class DnnSuperResImpl : DisposableCvObject, ICvPtrHolder
Constructors
| Improve this Doc View SourceDnnSuperResImpl()
Empty constructor
Declaration
public DnnSuperResImpl()
DnnSuperResImpl(IntPtr)
Declaration
protected DnnSuperResImpl(IntPtr ptr)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | ptr |
DnnSuperResImpl(String, Int32)
Constructor which immediately sets the desired model
Declaration
public DnnSuperResImpl(string algo, int scale)
Parameters
Type | Name | Description |
---|---|---|
System.String | algo | String containing one of the desired models:
|
System.Int32 | scale | Integer specifying the upscale factor |
Methods
| Improve this Doc View SourceDisposeUnmanaged()
Declaration
protected override void DisposeUnmanaged()
Overrides
| Improve this Doc View SourceGetAlgorithm()
Returns the scale factor of the model
Declaration
public string GetAlgorithm()
Returns
Type | Description |
---|---|
System.String | Current algorithm. |
GetScale()
Returns the scale factor of the model
Declaration
public int GetScale()
Returns
Type | Description |
---|---|
System.Int32 | Current scale factor. |
ReadModel(String)
Read the model from the given path
Declaration
public void ReadModel(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to the model file. |
ReadModel(String, String)
Read the model from the given path
Declaration
public void ReadModel(string weights, string definition)
Parameters
Type | Name | Description |
---|---|---|
System.String | weights | Path to the model weights file. |
System.String | definition | Path to the model definition file. |
SetModel(String, Int32)
Set desired model
Declaration
public void SetModel(string algo, int scale)
Parameters
Type | Name | Description |
---|---|---|
System.String | algo | String containing one of the desired models:
|
System.Int32 | scale | Integer specifying the upscale factor |
SetPreferableBackend(Backend)
Ask network to use specific computation backend where it supported.
Declaration
public void SetPreferableBackend(Backend backendId)
Parameters
Type | Name | Description |
---|---|---|
Backend | backendId | backend identifier. |
SetPreferableTarget(Target)
Ask network to make computations on specific target device.
Declaration
public void SetPreferableTarget(Target targetId)
Parameters
Type | Name | Description |
---|---|---|
Target | targetId | target identifier. |
Upsample(InputArray, OutputArray)
Upsample via neural network
Declaration
public void Upsample(InputArray img, OutputArray result)
Parameters
Type | Name | Description |
---|---|---|
InputArray | img | Image to upscale |
OutputArray | result | Destination upscaled image |
UpsampleMultioutput(InputArray, out Mat[], IEnumerable<Int32>, IEnumerable<String>)
Upsample via neural network of multiple outputs
Declaration
public void UpsampleMultioutput(InputArray img, out Mat[] imgsNew, IEnumerable<int> scaleFactors, IEnumerable<string> nodeNames)
Parameters
Type | Name | Description |
---|---|---|
InputArray | img | Image to upscale |
Mat[] | imgsNew | Destination upscaled images |
IEnumerable<System.Int32> | scaleFactors | Scaling factors of the output nodes |
IEnumerable<System.String> | nodeNames | Names of the output nodes in the neural network |