Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 8th, 2020 140 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. import numpy as np
  3. import cv2
  4. import  matplotlib.pyplot as plt
  5.  
  6. URL = 'https://api.arstand-lab.ru'
  7.  
  8. token = 'Token 581314b5dc6db4dd928dc249bf390affbec4df75'
  9. HEADERS = {'Authorization': token,
  10.            'Content-Type': 'application/json'}
  11.  
  12.  
  13. def get_markers():
  14.     res = requests.get(f'{URL}/api/0/marker/get_markers/', headers=HEADERS)
  15.     if res.ok:
  16.         with open('file.npz', 'wb') as f:
  17.             f.write(res.content)
  18.         return True
  19.     else:
  20.         return False
  21.  
  22.  
  23. if __name__ == '__main__':
  24.     print('GET successful: ', get_markers())
  25.     Points = list()
  26.     a = np.load("file.npz")
  27.     for t in range(len(a['markers'])):
  28.         plt.imshow(a['markers'][t])
  29.         plt.show()
  30.         im_bw = cv2.medianBlur(a['markers'][t], 5)
  31.         ret, im_bw = cv2.threshold(im_bw, 127, 255, 0)
  32.         plt.imshow(im_bw,cmap='gray')
  33.         plt.show()
  34.         rows = im_bw.shape[0]
  35.         circles = cv2.HoughCircles(im_bw, cv2.HOUGH_GRADIENT, 1, rows / 8,
  36.                                    param1=100, param2=30,
  37.                                    minRadius=1, maxRadius=40)
  38.        
  39.         if circles is not None:
  40.             circles = np.uint16(np.around(circles))
  41.             for i in circles[0, :]:
  42.                 center = (i[0], i[1])
  43.                 # circle center
  44.                 cv2.circle(im_bw, center, 1, (0, 100, 100), 3)
  45.                 # circle outline
  46.                 radius = i[2]
  47.                 cv2.circle(im_bw, center, radius, (255, 0, 255), 3)
  48.             if center[0] > 150 and center[1] > 150:
  49.                 r = 180
  50.             elif center[0] < 150 and center[1] > 150:
  51.                 r = 270
  52.             elif center[0] < 150 and center[1] < 150:
  53.                 r = 0
  54.             else:
  55.                 r = 90
  56.         Points.append(list((a['coords'][t][0], a['coords'][t][1], r)))
  57.     print(len(Points))
  58.     content = {'markers': str(Points)}
  59.     print(content)
  60.     res = requests.post(f'{URL}/api/0/marker/check_markers/rotation/',
  61.                                headers=HEADERS,
  62.                                 json=content)
  63.     print(res.content)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top