Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Algorithm to zoom images clearly

I know images can be zoomed with the help of image pyramids. And I know opencv pyrUp() method can zoom images. But, after certain extent, the image gets non-clear. For an example, if we zoom a small image 15 times of its original size, it is definitely not clear.

Are there any method in OpenCV to zoom the images but keep the clearance as it is in the original one? Or else, any algorithm to do this?

like image 761
PeakGen Avatar asked Nov 29 '22 01:11

PeakGen


2 Answers

One thing to remember: You can't pull extra resolution out of nowhere. When you scale up an image, you can have either a blurry, smooth image, or you can have a sharp, blocky image, or you can have something in between. Better algorithms, that appear to have better performance with specific types of subjects, make certain assumptions about the contents of the image, which, if true, can yield higher apparent performance, but will mess up if those assumptions prove false; there you are trading accuracy for sharpness.

There are several good algorithms out there for zooming specific types of subjects, including pixel art, faces, or text. More general algorithms for sharpening images include unsharp masking, edge enhancement, and others, however all of these are assume specific things about the contents of the image, for instance, that the image contains text, or that a noisy area would still be noisy (or not) at a higher resolution.

A low-resolution polka-dot pattern, or a sandy beach's gritty pattern, will not go over very well, and the computer may turn your seascape into something more reminiscent of a mosh pit. Every zoom algorithm or sharpening filter has a number of costs associated with it.

In order to correctly select a zoom or sharpening algorithm, more context, including sample images, are absolutely necessary.

like image 154
AJMansfield Avatar answered Dec 04 '22 08:12

AJMansfield


OpenCV has the Super Resolution module. I haven't had a chance to try it yet so not too sure how well it works.

You should check out Super-Resolution From a Single Image:

Methods for super-resolution (SR) can be broadly classified into two families of methods: (i) The classical multi-image super-resolution (combining images obtained at subpixel misalignments), and (ii) Example-Based super-resolution (learning correspondence between low and high resolution image patches from a database). In this paper we propose a unified framework for combining these two families of methods.

like image 27
Zaw Lin Avatar answered Dec 04 '22 09:12

Zaw Lin