Code Monkey home page Code Monkey logo

image-zooming-using-directional-cubic-convolution-interpolation's Introduction

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

image-zooming-using-directional-cubic-convolution-interpolation's People

Contributors

janspiry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

image-zooming-using-directional-cubic-convolution-interpolation's Issues

Were picture gamma correct calculations done?

Hi Janspiry,
As an IT- and algorithm engineer, I understand the "directional cubic interpolation" very well.

So, when I saw the examples "zoomed pictures" what you thankfully also published, I could not believe, that the algorithm does really work so distractingly bad: darker lines (between hairs strands e.g.) seems darkend jaggy staircaselike and diagonalcaselike far too much and additional extra jaggy "staircases" seems to be done amplified imprinted in the resulted demo-pictures. Thats what I saw.
...
My first tough was:

http://www.ericbrasseur.org/gamma.html

problem is that "the computations are performed as if the scale of brightnesses was linear while in fact it is a power scale." In mathematical terms: "a gamma of 1.0 is assumed while it is 2.2." Lots of filters, plug-ins and scripts make the same error.

Awaiting your thoughs
Johannes

I did not check the original Matlab code, but I think, the inventors of this "zooming" algorithm had fooled themself with not ensuring to have linear brightness scalings for their pixel in the loaded images, which by definition have nonlinear scaled pixelbrightness numbers in their imagefiles.

AND ! ?
maybe, this would explain, why the proposed "directional cubic interpolation" had no successful recognition in this 11 years since publication:
Because wrong implemented and not considering the nonlinear brightness to pixelvalue scalings (again: which are inherent in nearly every picture format definitions).

Note:
I also contacted one of the papers authors and the Matlab implempentation providers
Dengwen Zhou via [email protected]
https://de.mathworks.com/matlabcentral/fileexchange/38570-image-zooming-using-directional-cubic-convolution-interpolation
about this subject.
Hoping for some response.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.