code: def frankotchellappa(dzdx, dzdy):
      from numpy.fft import ifftshift, fft2, ifft2
  
      rows, cols = dzdx.shape
      # The following sets up matrices specifying frequencies in the x and y
      # directions corresponding to the Fourier transforms of the gradient
      # data.  They range from -0.5 cycles/pixel to + 0.5 cycles/pixel.
      # The scaling of this is irrelevant as long as it represents a full
      # circle domain. This is functionally equivalent to any constant * pi
      pi_over_2 = np.pi / 2.0
      row_grid = np.linspace(-pi_over_2, pi_over_2, rows)
      col_grid = np.linspace(-pi_over_2, pi_over_2, cols)
      wy, wx = np.meshgrid(row_grid, col_grid, indexing="ij")
  
      # Quadrant shift to put zero frequency at the appropriate edge
      wx = ifftshift(wx)
      wy = ifftshift(wy)
  
      # Fourier transforms of gradients
      DZDX = fft2(dzdx)
      DZDY = fft2(dzdy)
  
      # Integrate in the frequency domain by phase shifting by pi/2 and
      # weighting the Fourier coefficients by their frequencies in x and y and
      # then dividing by the squared frequency
      denom = wx**2 + wy**2
      Z = (-1j * wx * DZDX - 1j * wy * DZDY) / denom
      Z = np.nan_to_num(Z)
      return np.real(ifft2(Z))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  import menpo.io
  from menpo.image import Image
  from menpo.shape import PointCloud
  import cv2
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.contrib.framework.python.ops import variables
  from tensorflow.python.training import optimizer
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import variables
  from menpo.transform import Translation, Scale
  from menpo.shape import PointCloud
label_desc: Use image node_id 5 for calling a global function with example usage: frankotchellappa(dzdx, dzdy) and returns: np