OpenCV  4.3.0
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | List of all members
cv::dnn_superres::DnnSuperResImpl Class Reference

A class to upscale images via convolutional neural networks. The following four models are implemented: More...

#include <opencv2/dnn_superres.hpp>

Public Member Functions

 DnnSuperResImpl ()
 Empty constructor. More...
 
 DnnSuperResImpl (const String &algo, int scale)
 Constructor which immediately sets the desired model. More...
 
String getAlgorithm ()
 Returns the scale factor of the model: More...
 
int getScale ()
 Returns the scale factor of the model: More...
 
void readModel (const String &path)
 Read the model from the given path. More...
 
void readModel (const String &weights, const String &definition)
 Read the model from the given path. More...
 
void setModel (const String &algo, int scale)
 Set desired model. More...
 
void upsample (InputArray img, OutputArray result)
 Upsample via neural network. More...
 
void upsampleMultioutput (InputArray img, std::vector< Mat > &imgs_new, const std::vector< int > &scale_factors, const std::vector< String > &node_names)
 Upsample via neural network of multiple outputs. More...
 

Static Public Member Functions

static Ptr< DnnSuperResImplcreate ()
 Empty constructor for python. More...
 

Detailed Description

A class to upscale images via convolutional neural networks. The following four models are implemented:

Constructor & Destructor Documentation

cv::dnn_superres::DnnSuperResImpl::DnnSuperResImpl ( )

Empty constructor.

cv::dnn_superres::DnnSuperResImpl::DnnSuperResImpl ( const String algo,
int  scale 
)

Constructor which immediately sets the desired model.

Parameters
algoString containing one of the desired models:
  • edsr
  • espcn
  • fsrcnn
  • lapsrn
scaleInteger specifying the upscale factor

Member Function Documentation

static Ptr<DnnSuperResImpl> cv::dnn_superres::DnnSuperResImpl::create ( )
static

Empty constructor for python.

String cv::dnn_superres::DnnSuperResImpl::getAlgorithm ( )

Returns the scale factor of the model:

Returns
Current algorithm.
int cv::dnn_superres::DnnSuperResImpl::getScale ( )

Returns the scale factor of the model:

Returns
Current scale factor.
void cv::dnn_superres::DnnSuperResImpl::readModel ( const String path)

Read the model from the given path.

Parameters
pathPath to the model file.
void cv::dnn_superres::DnnSuperResImpl::readModel ( const String weights,
const String definition 
)

Read the model from the given path.

Parameters
weightsPath to the model weights file.
definitionPath to the model definition file.
void cv::dnn_superres::DnnSuperResImpl::setModel ( const String algo,
int  scale 
)

Set desired model.

Parameters
algoString containing one of the desired models:
  • edsr
  • espcn
  • fsrcnn
  • lapsrn
scaleInteger specifying the upscale factor
void cv::dnn_superres::DnnSuperResImpl::upsample ( InputArray  img,
OutputArray  result 
)

Upsample via neural network.

Parameters
imgImage to upscale
resultDestination upscaled image
void cv::dnn_superres::DnnSuperResImpl::upsampleMultioutput ( InputArray  img,
std::vector< Mat > &  imgs_new,
const std::vector< int > &  scale_factors,
const std::vector< String > &  node_names 
)

Upsample via neural network of multiple outputs.

Parameters
imgImage to upscale
imgs_newDestination upscaled images
scale_factorsScaling factors of the output nodes
node_namesNames of the output nodes in the neural network

The documentation for this class was generated from the following file: