Advertisement
StevanovicMilan

10.2

Sep 18th, 2021
738
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. '''
  2. Učitati sliku chalk.tif i korigovati osvetljenje koristeći gama korekciju sa faktorom 1.5.
  3. '''
  4.  
  5. import plotly.express as px
  6. from skimage import io
  7.  
  8. img = io.imread('chalk.tif')
  9. fig = px.imshow(img)
  10. fig.show()
  11.  
  12. import numpy as np
  13.  
  14.  
  15. def gammaCorrection(input, gamma):
  16.     c = 255 ** (1 - gamma)
  17.     LUT = c * np.arange(0, 256) ** gamma
  18.     LUT = LUT.astype('uint8')
  19.     return LUT[input]
  20.  
  21.  
  22. img_gamma = gammaCorrection(img, 1.5)
  23. fig = px.imshow(img_gamma)
  24. fig.show()
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement