Class DnnSuperResImpl
- Namespace
- OpenCvSharp.DnnSuperres
- Assembly
- OpenCvSharp.dll
A class to upscale images via convolutional neural networks. The following four models are implemented:
- edsr
- espcn
- fsrcnn
- lapsrn
public class DnnSuperResImpl : DisposableCvObject, IDisposable, ICvPtrHolder
- Inheritance
-
DnnSuperResImpl
- Implements
- Inherited Members
Constructors
DnnSuperResImpl()
Default constructor
public DnnSuperResImpl()
DnnSuperResImpl(nint)
Constructor
protected DnnSuperResImpl(nint ptr)
Parameters
ptrnint
DnnSuperResImpl(string, int)
Constructor which immediately sets the desired model
public DnnSuperResImpl(string algo, int scale)
Parameters
algostringString containing one of the desired models: - edsr - espcn - fsrcnn - lapsrn
scaleintInteger specifying the upscale factor
Methods
DisposeUnmanaged()
releases unmanaged resources
protected override void DisposeUnmanaged()
GetAlgorithm()
Returns the scale factor of the model
public string GetAlgorithm()
Returns
- string
Current algorithm.
GetScale()
Returns the scale factor of the model
public int GetScale()
Returns
- int
Current scale factor.
ReadModel(string)
Read the model from the given path
public void ReadModel(string path)
Parameters
pathstringPath to the model file.
ReadModel(string, string)
Read the model from the given path
public void ReadModel(string weights, string definition)
Parameters
SetModel(string, int)
Set desired model
public void SetModel(string algo, int scale)
Parameters
algostringString containing one of the desired models: - edsr - espcn - fsrcnn - lapsrn
scaleintInteger specifying the upscale factor
SetPreferableBackend(Backend)
Ask network to use specific computation backend where it supported.
public void SetPreferableBackend(Backend backendId)
Parameters
backendIdBackendbackend identifier.
SetPreferableTarget(Target)
Ask network to make computations on specific target device.
public void SetPreferableTarget(Target targetId)
Parameters
targetIdTargettarget identifier.
Upsample(InputArray, OutputArray)
Upsample via neural network
public void Upsample(InputArray img, OutputArray result)
Parameters
imgInputArrayImage to upscale
resultOutputArrayDestination upscaled image
UpsampleMultioutput(InputArray, out Mat[], IEnumerable<int>, IEnumerable<string>)
Upsample via neural network of multiple outputs
[SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")]
public void UpsampleMultioutput(InputArray img, out Mat[] imgsNew, IEnumerable<int> scaleFactors, IEnumerable<string> nodeNames)
Parameters
imgInputArrayImage to upscale
imgsNewMat[]Destination upscaled images
scaleFactorsIEnumerable<int>Scaling factors of the output nodes
nodeNamesIEnumerable<string>Names of the output nodes in the neural network