code: def estimate_skew(image):
      edges = auto_canny(image)
      lines = cv2.HoughLines(edges, 1, np.pi / 90, 200)
      new = edges.copy()
  
      thetas = []
  
      for line in lines:
          for rho, theta in line:
              a = np.cos(theta)
              b = np.sin(theta)
              x0 = a * rho
              y0 = b * rho
              x1 = int(x0 + 1000 * (-b))
              y1 = int(y0 + 1000 * (a))
              x2 = int(x0 - 1000 * (-b))
              y2 = int(y0 - 1000 * (a))
              if theta > np.pi / 3 and theta < np.pi * 2 / 3:
                  thetas.append(theta)
                  new = cv2.line(
                      new, (x1, y1), (x2, y2), (255, 255, 255), 1
                  )
  
      theta_mean = np.mean(thetas)
      theta = rad_to_deg(theta_mean) if len(thetas) > 0 else 0
  
      return theta
  
imports: import os
  import traceback
  import sys
  import cv2
  import numpy
  from PIL import Image
  from scipy.ndimage.filters import rank_filter
  import pytesseract
label_desc: Use image node_id 17 for calling a global function with example usage: estimate_skew(image) and returns: theta