DNN used for super resolution#

This module contains functionality for upscaling an image via convolutional neural networks. The following four models are implemented:

Classes#

Name

Description

class cv::dnn_superres::DnnSuperResImpl

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

Class cv::dnn_superres::DnnSuperResImpl#

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

Collaboration diagram for cv::dnn_superres::DnnSuperResImpl:

Detailed Description#

class DnnSuperResImpl#

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

  • edsr

  • espcn

  • fsrcnn

  • lapsrn

Constructor & Destructor Documentation#

DnnSuperResImpl()#

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

Empty constructor.

DnnSuperResImpl()#

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

Constructor which immediately sets the desired model.

Parameters

  • algo — String containing one of the desired models:

    • edsr

    • espcn

    • fsrcnn

    • lapsrn

  • scale — Integer specifying the upscale factor

Member Function Documentation#

preprocess_YCrCb()#

void cv::dnn_superres::DnnSuperResImpl::preprocess_YCrCb(
InputArray inpImg,
OutputArray outpImg )

reconstruct_YCrCb()#

void cv::dnn_superres::DnnSuperResImpl::reconstruct_YCrCb(
InputArray inpImg,
InputArray origImg,
OutputArray outpImg,
int scale )

create()#

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

Python:

cv.dnn_superres.DnnSuperResImpl.create() -> retval
cv.dnn_superres.DnnSuperResImpl_create() -> retval

Empty constructor for python.

getAlgorithm()#

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

Python:

cv.dnn_superres.DnnSuperResImpl.getAlgorithm() -> retval

Returns the scale factor of the model:

Returns

Current algorithm.

getScale()#

int cv::dnn_superres::DnnSuperResImpl::getScale()

Python:

cv.dnn_superres.DnnSuperResImpl.getScale() -> retval

Returns the scale factor of the model:

Returns

Current scale factor.

readModel()#

void cv::dnn_superres::DnnSuperResImpl::readModel(const String & path)

Python:

cv.dnn_superres.DnnSuperResImpl.readModel(path)

Read the model from the given path.

Parameters

  • path — Path to the model file.

readModel()#

void cv::dnn_superres::DnnSuperResImpl::readModel(
const String & weights,
const String & definition )

Python:

cv.dnn_superres.DnnSuperResImpl.readModel(path)

Read the model from the given path.

Parameters

  • weights — Path to the model weights file.

  • definition — Path to the model definition file.

setModel()#

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

Python:

cv.dnn_superres.DnnSuperResImpl.setModel(algo, scale)

Set desired model.

Parameters

  • algo — String containing one of the desired models:

    • edsr

    • espcn

    • fsrcnn

    • lapsrn

  • scale — Integer specifying the upscale factor

setPreferableBackend()#

void cv::dnn_superres::DnnSuperResImpl::setPreferableBackend(int backendId)

Python:

cv.dnn_superres.DnnSuperResImpl.setPreferableBackend(backendId)

Set computation backend.

setPreferableTarget()#

void cv::dnn_superres::DnnSuperResImpl::setPreferableTarget(int targetId)

Python:

cv.dnn_superres.DnnSuperResImpl.setPreferableTarget(targetId)

Set computation target.

upsample()#

void cv::dnn_superres::DnnSuperResImpl::upsample(
InputArray img,
OutputArray result )

Python:

cv.dnn_superres.DnnSuperResImpl.upsample(img[, result]) -> result

Upsample via neural network.

Parameters

  • img — Image to upscale

  • result — Destination upscaled image

upsampleMultioutput()#

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 )

Python:

cv.dnn_superres.DnnSuperResImpl.upsampleMultioutput(img, imgs_new, scale_factors, 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

Member Data Documentation#

alg#

std::string cv::dnn_superres::DnnSuperResImpl::alg

net#

dnn::Net cv::dnn_superres::DnnSuperResImpl::net

Net which holds the desired neural network.

sc#

int cv::dnn_superres::DnnSuperResImpl::sc

Source file#

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