Janspiry / Image-Zooming-Using-Directional-Cubic-Convolution-Interpolation

Unofficial Python implementation about Image Zooming Using Directional Cubic Convolution Interpolation (DCC) by Numpy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Zooming Using Directional Cubic Convolution Interpolation

Paper

Brief

This is a unofficial Python implementation about Image Zooming Using Directional Cubic Convolution Interpolation (DCC) by Numpy, which claims it can preserve the sharp edges and details of images with noticeable suppression of the artifacts that usually occur with cubic convolution interpolation.

Status

Compared to the open source MATLAB version, we are ready to do the following :

  • Python Version
  • RGB Image support
  • Multi Process support
  • Eliminate edge white points

Result

Bilinear Bicubic DCC
00000_bilinear 00000_bicubic 00000_dcc_numpy
00001_bilinear 00001_bicubic 00001_dcc_numpy
00002_bilinear 00002_bicubic 00002_dcc_numpy

Usage

We have integrated the open-source version of MATLAB and the manually implemented version of Python, which can be found in the corresponding folder. Take the python version for an example:

from DCC import DCC
img = Image.open(img_file).convert('RGB')
img = np.array(img).astype(np.float)/255
sr_img = DCC(img, level)

Note: DCC gets the low-resolution image first by interval sampling in the MATLAB version, which is not the same as the general method. You can change the following code to use different down-sample methods or just use the low-resolution image as input.

def DCC(img, level):
    # get the low resolution image by interval sampling
    lr_img = img[0:-1:2**level, 0:-1:2**level, :]
    sr_img = img

Acknowledges

  1. IET Digital Library: Image zooming using directional cubic convolution interpolation (theiet.org)
  2. https://www.mathworks.com/matlabcentral/fileexchange/38570-image-zooming-using-directional-cubic-convolution-interpolation

About

Unofficial Python implementation about Image Zooming Using Directional Cubic Convolution Interpolation (DCC) by Numpy.


Languages

Language:Python 100.0%