Super Resolution in Opencv

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Super Resolution with Deep Learning

https://www.pyimagesearch.com/2020/11/09/opencv-super-resolution-with-deep-learning/

https://towardsdatascience.com/deep-learning-based-super-resolution-with-opencv-4fd736678066

https://learnopencv.com/super-resolution-in-opencv/ (Model can be downloaded from this link)

https://docs.opencv.org/4.5.2/dc/d69/tutorial_dnn_superres_benchmark.html

https://docs.opencv.org/4.5.2/d8/df8/tutorial_table_of_content_dnn_superres.html

Super Resolution in OpenCV

OpenCV is an open-source computer vision library that has an extensive collection of

great algorithms. Since one of the latest mergers, OpenCV contains an easy-to-use

interface for implementing Super Resolution (SR) based on deep learning methods.

The interface contains pre-trained models that can be used for inference very easily

and efficiently. In this post, I will explain what it can do and show step-by-step how to

use it. So far, it works with C++ and Python.

NOTE: You don’t need any knowledge about SR to use this code. I am running this on

an Ubuntu 16.04 machine, but it works for any other distributions (it also works on

Windows).

Steps

 1. Installing OpenCV with the contrib modules (containing dnn_superres).

 2. Downloading the pre-trained models.

 3. Upscaling the image.

1. Installing OpenCV with the contrib modules.

Our first step is to install OpenCV. Some features are released later, so be

careful with the version: 4.2.0 for C++, 4.3.0 adds Python wrap, 4.4.0
adds GPU inference. You can follow the instructions from the opencv

documentation. It is very important that you also install the contrib modules,

because that is where the SR interface code resides. You can choose to install all the

contrib modules or just the necessary SR one. The interface or module we will use is

called dnn_superres (dnn stands for Deep Neural Network; superres for Super

Resolution).

2. Downloading a pre-trained model.

We need to download the pre-trained models separately, because the OpenCV code-

base does not contain them. The reason is some of the models are quite big. So if they

were in the standard code-base, people who might not need them still would have to

download them. There are several models to choose from (see section Models in this

article). All of them are implementations of popular SR papers. For now, let’s choose a

small model. You can download it here. This pre-trained model can increase the

resolution of an image by 2. For more models and their explanations, see section

Models in this post.

You might also like