How to antialias picture to get rid of the jerkiness in the image


I am trying to antialias a picture and tried few methods, with open CV and with matplotlib and also with PIL. But still can’t get rid of the jerkiness. enter image description here

This is the picture for antialiasing.
The first method I have tried is with opencv.

import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
img = cv.imread('LENS_MODEL.png')
kernel = np.ones((5,5),np.float32)/25
dst = cv.filter2D(img,-1,kernel)
plt.xticks([]), plt.yticks([])
plt.xticks([]), plt.yticks([]) 

But this seems not to give much improvement.
enter image description here

The second method I have tried with matplotlib but still can’t get rid of the jerkiness and the image quality is even worse.

fig, axs = plt.subplots(2, 2, figsize=(5, 6), constrained_layout=True)
axs[0, 0].imshow(img, interpolation='nearest')

for ax, interp in zip(axs.flat[1:],
                             ['nearest', 'antialiased', 'antialiased']):
    ax.imshow(img, interpolation=interp,

enter image description here

Any suggestions how can I use antialiasing for images to get rid of this sharp transistions in the image? I also tried PIL but still seems no improvements…


Apply a strong Gaussian filter to smooth out the "jaggies", then strongly increase the contrast to reduce the blur by causing saturation. This only works with binary images.

The sharp corners cannot be preserved by this method.

enter image description here

Answered By – Yves Daoust

Answer Checked By – Timothy Miller (AngularFixing Admin)

Leave a Reply

Your email address will not be published.