Skip to content

Instantly share code, notes, and snippets.

@mmagnuski
Created March 4, 2016 18:07
Show Gist options
  • Save mmagnuski/7407ff2581eaeb8ec9e8 to your computer and use it in GitHub Desktop.
Save mmagnuski/7407ff2581eaeb8ec9e8 to your computer and use it in GitHub Desktop.
import PIL
import time
import numpy as np
import pyscreenshot as scr
# TODOs:
# - [ ] ctypes.windll.InpOut32 for LPT trigger
# - [ ] activate only on blank to non-blank change
# - [ ]
state = False
box = (1650, 280, 1800, 440)
elapsed = 0.
prev_time = time.time()
step_time = list()
while elapsed < 35:
im = np.array(scr.grab(bbox=box))
current_state = np.all(im == im[1,1,:])
if current_state != state:
print 'change!'
print elapsed
state = current_state
current_time = time.time()
time_diff = current_time - prev_time
prev_time = current_time
step_time.append(time_diff)
elapsed += time_diff
step_time = np.array(step_time)
print 'mean step time: ', np.mean(step_time)
print 'max step time: ', np.max(step_time)
print 'min step time: ', np.min(step_time)
@mmagnuski
Copy link
Author

http://share.inteliwise.com/client/demo/ i dalej wiadomo co

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment