In [ ]:
import dhanushka

In [ ]:
%matplotlib inline
from matplotlib import pyplot as plt
from matplotlib import cm
import cv2
img = cv2.imread('F.png')
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
imgcrop = img_rgb[40:210,70:250]
plt.imshow(imgcrop)
plt.show()

In [ ]:
img_gray = cv2.cvtColor(imgcrop, cv2.COLOR_RGB2GRAY)
plt.imshow(img_gray, cmap = cm.gray)
plt.show()

In [ ]:
D = 12

rows, cols = img_gray.shape
radius = cols//2 if rows > cols else rows//2

reconst = dhanushka.zernike_reconstruct(img_gray, radius, D, (rows/2., cols/2.))

reconst = reconst.reshape(img_gray.shape)

plt.figure(1)
plt.imshow(img_gray, cmap=cm.jet, origin = 'upper')
plt.figure(2)    
plt.imshow(reconst.real, cmap=cm.jet, origin = 'upper')
plt.show()

In [ ]: