Skip to content

Instantly share code, notes, and snippets.

@RyanHope
Last active December 25, 2015 02:39
Show Gist options
  • Save RyanHope/6904576 to your computer and use it in GitHub Desktop.
Save RyanHope/6904576 to your computer and use it in GitHub Desktop.
A test of video stream on an SMI eyetracker using the PyViewX package.
#!/usr/bin/env python
import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)),"pyviewx.client"))
sys.path.insert(1, os.path.join(os.path.dirname(os.path.realpath(__file__)),"pyviewx.pygame"))
from pyviewx.client import iViewXClient, Dispatcher
from pyviewx.pygame import Calibrator
from twisted.internet import reactor
import pygame
d = Dispatcher()
client = iViewXClient('127.0.0.1', 4444)
calibrator = Calibrator(client, reactor = reactor)
def stream_video(a, calibration_results):
print a
print calibration_results
pygame.quit()
client.stopDataStreaming()
client.addDispatcher(d)
client.startEyeVideoStreaming()
@d.listen('ET_IMG')
def iViewXEvent(inResponse):
print inResponse
reactor.listenUDP(5555, client)
reactor.callLater(0, calibrator.start, stream_video)
reactor.run()
@RyanHope
Copy link
Author

RyanHope commented Oct 9, 2013

14:40:02 Scanning system...
14:40:02 Cpu clock 3066 Mhz SSE2
14:40:02 Number of CPU: 8 (Hyper Threaded)
14:40:02 Free disk space on C: 200987 MBytes
14:40:02 Scene Bitmap opened
14:40:10 memory load: 35%
14:40:10 RED 5 USB grabber found
14:40:10 Port opened for remote control Ethernet
14:40:10 Port opened for remote control Ethernet
14:40:18 Remote command executed: ET_FRM %TS %ET %SX %SY %DX %DY %EX %EY %EZ
14:40:18 Remote command executed: ET_STR
14:40:18 Remote command executed: ET_CSZ 1680 1050
14:40:18 Remote command executed: ET_CPA 1 1
14:40:18 Remote command executed: ET_CPA 2 0
14:40:18 Remote command executed: ET_CPA 3 1
14:40:18 Remote command executed: ET_LEV 3
14:40:18 Calibration started
14:40:18 Remote command executed: ET_CAL 9
14:40:19 Remote command executed: ET_ACC
14:40:20 Remote command executed: ET_ACC
14:40:21 Remote command executed: ET_ACC
14:40:22 Remote command executed: ET_ACC
14:40:23 Remote command executed: ET_ACC
14:40:24 Remote command executed: ET_ACC
14:40:25 Remote command executed: ET_ACC
14:40:26 Remote command executed: ET_ACC
14:40:27 Remote command executed: ET_ACC
14:40:27 Mapping 0: raw(1.544950, -5.018177) screen(841.772152,526.767677)
14:40:27 Mapping 1: raw(7.895664, -8.832725) screen(84.177215,52.676768)
14:40:27 Mapping 2: raw(-5.109132, -8.663181) screen(1599.367089,52.676768)
14:40:27 Mapping 3: raw(7.467827, -1.063876) screen(84.177215,1000.858586)
14:40:27 Mapping 4: raw(-5.101799, -1.032758) screen(1599.367089,1000.858586)
14:40:27 Mapping 5: raw(7.944160, -4.977688) screen(84.177215,526.767677)
14:40:27 Mapping 6: raw(1.266148, -9.051594) screen(841.772152,52.676768)
14:40:27 Mapping 7: raw(-4.877780, -5.123238) screen(1599.367089,526.767677)
14:40:27 Mapping 8: raw(0.980890, -1.029033) screen(841.772152,1000.858586)
14:40:27 Mapping 9: raw(3.948359, -5.461035) screen(841.772152,526.767677)
14:40:27 Mapping 10: raw(11.248611, -9.126750) screen(84.177215,52.676768)
14:40:27 Mapping 11: raw(-2.402462, -9.232428) screen(1599.367089,52.676768)
14:40:27 Mapping 12: raw(10.269679, -0.620202) screen(84.177215,1000.858586)
14:40:27 Mapping 13: raw(-2.244605, -1.216800) screen(1599.367089,1000.858586)
14:40:27 Mapping 14: raw(11.289192, -4.944811) screen(84.177215,526.767677)
14:40:27 Mapping 15: raw(4.289993, -9.283658) screen(841.772152,52.676768)
14:40:27 Mapping 16: raw(-2.678876, -4.964142) screen(1599.367089,526.767677)
14:40:27 Mapping 17: raw(4.242930, -0.852859) screen(841.772152,1000.858586)
14:40:31 Remote command executed: ET_RES
14:40:31 Calibration started
14:40:31 Remote command executed: ET_VLS
14:40:32 Remote command executed: ET_EST
14:40:32 Remote command executed: ET_SIM

14:40:02 Welcome to iView X 2.8.26
14:40:10 Grab started
14:40:18 Data Streaming enabled
14:40:27 Calibration finished successfully
14:40:32 Data Streaming disabled
14:40:32 Eye Video Streaming enabled

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