# -*- coding: utf-8 -*-
"""Dataset.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1N3x3B1l8ZtKga1SgBM87Bq753-cX-qLf
"""

#In the following examples, we provide the calculations of Zernike moments for a Face (Hossein Safari) image.
#we reconstructed images in different orders of Zernike maximum orders.
import numpy as np
import matplotlib.pyplot as plt
from ZEMO import zemo
import wget
def Face_Data():
  url = 'https://github.com/hmddev1/ZEMO/raw/main/ZEMO/Data/Hossein_Safari.png'
  file_name = wget.download(url)
  img = plt.imread(file_name)
  fig, axes = plt.subplots(nrows=4, ncols=1,figsize=(6,6))
  plt.subplot(1,4,1)
  plt.imshow(img,  interpolation='nearest',cmap='bone')
  plt.title('Original Image', fontsize=9)
  plt.axis('off')
  SZ=np.shape(img)
  Order=[10,45,46]
  for i in range(3):
    ZBFSTR=zemo.zernike_bf(SZ[0],Order[i],1)
    Z=zemo.zernike_mom(np.double(img),ZBFSTR)
    I=zemo.zernike_rec(Z,SZ[0],ZBFSTR)
    plt.subplot(1,4,i+2)
    plt.imshow(I,interpolation='nearest',cmap='bone')
    plt.title('$P_{max}$='+ str(Order[i]), fontsize=9)
    plt.axis('off')
  plt.show()