1 BTC puzzle image split python script


SUBMITTED BY: trior

DATE: Aug. 11, 2018, 2:11 a.m.

UPDATED: Aug. 11, 2018, 2:11 a.m.

FORMAT: Python 3

SIZE: 660 Bytes

HITS: 601

  1. #!/usr/bin/env python3
  2. import cv2
  3. import numpy as np
  4. from matplotlib import pyplot as plt
  5. #https://www.reddit.com/r/Bitcoin/comments/8kk0pa/1_btc_is_hidden_in_this_puzzle_good_luck/
  6. #https://i.redd.it/g4rbvtbiwry01.png
  7. img = cv2.imread("puzzule.png")
  8. gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  9. hist = cv2.calcHist([gray],[0],None,[256],[0,256])
  10. colors = np.where(hist>5000)
  11. img_number = 0
  12. for color in colors[0]:
  13. print(color)
  14. split_image = img.copy()
  15. split_image[np.where(gray != color)] = 0
  16. cv2.imwrite(str(img_number)+".jpg",split_image)
  17. img_number+=1
  18. plt.hist(gray.ravel(),256,[0,256])
  19. plt.savefig('plt')
  20. plt.show()

comments powered by Disqus