Skip to content

Instantly share code, notes, and snippets.

@marthall
Created October 29, 2014 18:23
Show Gist options
  • Save marthall/bded905a1bebd66f88de to your computer and use it in GitHub Desktop.
Save marthall/bded905a1bebd66f88de to your computer and use it in GitHub Desktop.
from scipy.misc.pilutil import imread, imsave
import numpy as np
def gamma_correction(img, correction):
img = np.multiply(img, 1.0/255)
img = np.power(img, correction)
return img
einstein = imread('TestImages/Question 4/einstein_lowcontrast.png')
final_image = gamma_correction(einstein, 1)
imsave('task04.png', final_image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment