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.
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
Bilinear | Bicubic | DCC |
---|---|---|
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