/// <summary> /// Release this memory associated with this Dnn super resolution model. /// </summary> protected override void DisposeObject() { if (_ptr != IntPtr.Zero) { DnnSuperresInvoke.cveDnnSuperResImplRelease(ref _ptr); } }
/// <summary> /// Upsample via neural network. /// </summary> /// <param name="img">Image to upscale</param> /// <param name="result">Destination upscaled image</param> public void Upsample(IInputArray img, IOutputArray result) { using (InputArray iaImg = img.GetInputArray()) using (OutputArray oaResult = result.GetOutputArray()) { DnnSuperresInvoke.cveDnnSuperResImplUpsample(_ptr, iaImg, oaResult); } }
/// <summary> /// Read the model from the given path. /// </summary> /// <param name="weight">Path to the model weights file.</param> /// <param name="definition">Path to the model definition file.</param> public void ReadModel(String weight, String definition) { using (CvString csWeight = new CvString(weight)) using (CvString csDefinition = new CvString(definition)) { DnnSuperresInvoke.cveDnnSuperResImplReadModel2(_ptr, csWeight, csDefinition); } }
/// <summary> /// Set desired model. /// </summary> /// <param name="algorithm">String containing one of the desired models: "edsr", "espcn", "fsrcnn", "lapsrn"</param> /// <param name="scale">Integer specifying the upscale factor</param> public void SetModel(String algorithm, int scale) { using (CvString csAlgorithm = new CvString(algorithm)) DnnSuperresInvoke.cveDnnSuperResImplSetModel(_ptr, csAlgorithm, scale); }
/// <summary> /// Read the model from the given path. /// </summary> /// <param name="path">Path to the model file.</param> public void ReadModel(String path) { using (CvString csPath = new CvString(path)) DnnSuperresInvoke.cveDnnSuperResImplReadModel1(_ptr, csPath); }
/// <summary> /// Constructor which immediately sets the desired model. /// </summary> /// <param name="algorithm">String containing one of the desired models: "edsr", "espcn", "fsrcnn", "lapsrn"</param> /// <param name="scale">Integer specifying the upscale factor</param> public DnnSuperResImpl(String algorithm, int scale) { using (CvString csAlgorithm = new CvString(algorithm)) _ptr = DnnSuperresInvoke.cveDnnSuperResImplCreate2(csAlgorithm, scale); }
/// <summary> /// Empty constructor. /// </summary> public DnnSuperResImpl() { _ptr = DnnSuperresInvoke.cveDnnSuperResImplCreate(); }