Advertisement
rozman50

Untitled

Apr 1st, 2020
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. # risanje histograma
  2. y_pos = numpy.arange(len(histogram))
  3. f = plt.figure(1)
  4. plt.bar(y_pos, histogram, color="r")
  5. plt.title("naslov")
  6. plt.xlim([0, 256])
  7.  
  8. # izračunan po formuli iz predavanj
  9. Q = len(histogram)
  10. velikost = len(histogram)
  11. novi_histogram = numpy.zeros(velikost)
  12. for y in range(velikost):
  13. sum = 0
  14. for x in range(y+1):
  15. sum += histogram[x]
  16.  
  17. novi_histogram[i] = (Q / img.shape[0] * img.shape[1]) * sum
  18.  
  19. # apply histogram
  20. for i in range(dimenzija[0]):
  21. for j in range(dimenzija[1]):
  22. img[i,j] = hisogram[img[i,j]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement