Pappu19

Log Transformation

Sep 22nd, 2021
681
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from google.colab.patches import cv2_imshow
  2. import cv2
  3. from matplotlib import pyplot as plt
  4.  
  5. img = cv2.imread('sir.jpg', 0)
  6. cv2_imshow(img)
  7.  
  8. import numpy as np
  9. c = 255 / np.log(1 + np.max(img))
  10. log_image = c * (np.log(img + 1))
  11. log_image = np.array(log_image, dtype = np.uint8)
  12. cv2_imshow(log_image)
RAW Paste Data