Skip to content

Instantly share code, notes, and snippets.

@sriharsha0806
Created September 13, 2016 03:19
Show Gist options
  • Save sriharsha0806/9eed97b2685330ceba747d17b1c929c7 to your computer and use it in GitHub Desktop.
Save sriharsha0806/9eed97b2685330ceba747d17b1c929c7 to your computer and use it in GitHub Desktop.
ECE5256
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 31 16:22:10 2016
@author: sriharsha
"""
import cv2
import numpy as np
# shading correction
img = cv2.imread('Fig0229(a)(tungsten_filament_shaded).tif')
cv2.imshow('Shaded_SEM_Image',img)
cv2.waitKey(100)
img1 = cv2.imread('Fig0229(b)(tungsten_sensor_shading).tif')
cv2.imshow('Shading_Pattern',img1)
cv2.waitKey(100)
#inverse = np.linalg.pinv(img1[:,:,1])
#result = cv2.multiply(img,inverse)
inv = np.reciprocal(img1)
result = cv2.multiply(img,inv)
cv2.imshow('result',result)
cv2.waitKey(100)
cv2.imwrite('result.tif',result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment