code: def dft_optsize_same(im0, im1):
      
      im0 = np.asarray(im0)
      im1 = np.asarray(im1)
      # save shape
      shape0 = im0.shape
      shape1 = im1.shape
      # get optimal size
      ys = max(cv2.getOptimalDFTSize(shape0[0]),
               cv2.getOptimalDFTSize(shape1[0]))
      xs = max(cv2.getOptimalDFTSize(shape0[1]),
               cv2.getOptimalDFTSize(shape1[1]))
      shape = [ys, xs]
      f0 = dft_optsize(im0, shape=shape)
      f1 = dft_optsize(im1, shape=shape)
      return f0, f1
docs: Resize 2 image same size for optimal DFT and computes it
  
      Parameters
      ----------
      im0: 2d array
          First image
      im1: 2d array
          Second image
  
      Returns
      -------
      dft0: 2d array
          The dft of the first image
      dft1: 2d array
          The dft of the second image
  
      Notes
      -----
      dft0 and dft1 will have the same size