Upload
picameral
View
222
Download
0
Embed Size (px)
Citation preview
8/13/2019 The Pi Cameral Eyetracker
http://slidepdf.com/reader/full/the-pi-cameral-eyetracker 1/4
SKILL LEVEL : ADVANCED Jonathan Chetwynd
G u e s t W r i t e r
LOOK NO HANDSC o n n e c t i n g e y e m o t i o n t o c o m p u t e r c o n t r o l
The Picameral eye-tracker
T h e P i c a m e r a l e y e - t r a c k e r i s h o s t e d a t
h t t p : / / w w w . g n o t e . o r g a n d i s p a r t o f a l a r g e r p r o j e c t
s t u d y i n g h o w w e u n d e r s t a n d c o m p l e x s y s t e m s , m y
c u r r e n t v i s u a l i s a t i o n i s h t t p : / / w w w . p e e p o . c o m .
T h e R a s p b e r r y P i c o m p u t e r e n a b l e s , e n c o u r a g e s a n d
e m p o w e r s t h e i n d i v i d u a l t o e x p l o r e a n d c o n d u c t
i n d e p e n d e n t r e s e a r c h ; s o w h y m a k e a n e y e t r a c k e r ?
T h e e y e i s a c h a l l e n g e a s i t i s e a s i l y t h e f a s t e s t
h u m a n o r g a n , t r a c k i n g i t s m o t i o n p r o d u c e s m a s s e s o f
d a t a , a n d t h e r e a r e u s e f u l r u l e s o r h e u r i s t i c s t o b e
d e r i v e d f r o m t h e v a r i o u s m o t i o n s i n c l u d i n g s a c c a d e s ,
g l i s s a d e s a n d f i x a t i o n s , o r j e r k , t r a c k a n d d w e l l .
E a r l y e y e - t r a c k i n g r e s e a r c h t o o k p l a c e i n a l a b o r a t o r y
i n a s t r i c t l y c o n t r o l l e d e n v i r o n m e n t , p e r h a p s u s i n g a
f o r e h e a d a n d c h i n r e s t t o s t u d y r e a d i n g s k i l l s o r m o r e
r e c e n t l y w e b u s a b i l i t y . I t h a s o n l y v e r y r e c e n t l y
b e c o m e p o s s i b l e t o m a k e a c h e a p p o r t a b l e
e y e t r a c k e r . T h e t o t a l c o s t f o r t h i s p r o j e c t s h o u l d b e
~ £ 1 0 0 w h i c h i n c l u d e s 2 x R a s p b e r r y P i w i t h c a m e r a s ,
S D c a r d s , c a s e s , l e a d s , e t c . t h o u g h y o u m a y a l r e a d y
h a v e s o m e o f t h i s k i t .
A p o r t a b l e e y e t r a c k e r g r e a t l y b r o a d e n s p o s s i b l e
a p p l i c a t i o n s , p e r h a p s r e c o r d i n g a n d m o d e l l i n g s o c i a l
i n t e r a c t i o n s a t a p a r t y ? w h e t h e r s i d e a n d r e a r - v i e w
m i r r o r s a r e b e i n g o b s e r v e d r e g u l a r l y w h i l s t d r i v i n g ? I s
a s o l d i e r i n t h e f i e l d u s i n g a p p r o p r i a t e I E D s e a r c h
t e c h n i q u e s ? Y o u c a n e a s i l y i m a g i n e o t h e r s .
T h e r e a r e s o m e e x c e l l e n t r e s o u r c e s a v a i l a b l e , t h e
a p p r o a c h u s e d b u i l d s f r o m t h e e x c e l l e n t w o r k o f J o h n
P a u l i n H a n s e n a n d t h e t e a m a t I T U i n D e n m a r k w h o
d e v e l o p e d t h e W i n d o w s b a s e d G a z e T r a c k e r ; a n d t h e
b o o k E y e T r a c k i n g : b y H o l m q v i s t & N y s t r ö m 2 0 1 1
p r o v i d e s a t h o r o u g h i n t r o d u c t i o n , w i t h o u t b e i n g o v e r l y
a c a d e m i c .
8/13/2019 The Pi Cameral Eyetracker
http://slidepdf.com/reader/full/the-pi-cameral-eyetracker 2/49
C r e a t i n g a n e y e - t r a c k e r i s n o t i t s e l f a l a r g e p r o b l e m ,
t h e d i f f i c u l t y i s i n c o n s i d e r i n g t h e p u r p o s e s f o r w h i c h
y o u w i s h t o u s e y o u r d e v i c e , a n d h e n c e t h e p e r i p h e r a l
d e v i c e s a n d s o f t w a r e r e q u i r e d . F o r i n s t a n c e a n
8 5 0 m s d w e l l c o u l d b e s e t t o t a k e a h i g h q u a l i t y s t i l l
i m a g e u s i n g a s e c o n d c a m e r a , h e r e a c u t d o w n P S 3
e y e c a m i s c o n n e c t e d w i t h a n R P i v i e w c a m t o a s i n g l e
R P i . T h e s e t u p w a s t e s t e d a n d f o u n d t o c a p t u r e 2 0 0
i m a g e s m o s t l y o f m y c h o i c e , w h i l e c y c l i n g f r o m
V a u x h a l l t o K i n g s t o n i n a b o u t 4 5 m i n u t e s .
A n e a r l i e r p r o t o t y p e h a d s o m e l o a d b a l a n c i n g
p r o b l e m s t h a t w e r e i m p r o v e d i n t h e f i n a l d e s i g n .
C a m e r a s h a v e b e e n i m p r o v i n g f a s t , a n d t h e
R a s p b e r r y P i c a m e r a h a s m a n y e x c e l l e n t q u a l i t i e s
w h i c h w e r e l y o n . I t c a n e a s i l y b e a d a p t e d a s a
m a c r o , w h i c h h a p p e n s t o f o c u s a t a u s e f u l d i s t a n c e
w i t h g o o d q u a l i t y v i d e o i m a g e s . W h e n m o u n t e d
p e r p e n d i c u l a r t o t h e c a m e r a b o a r d , t h e s e n s o r i s o n l y
a s m a l l o b s t r u c t i o n a n d J a m e s H u g h e s
i m p l e m e n t a t i o n o f R e g i o n O f I n t e r e s t ( R O I ) e n a b l e s
d i g i t a l c r o p p i n g .
F o r m o r e s e r i o u s r e s e a r c h , f r a m e r a t e s f a s t e r t h a n 3 0
a r e d e s i r a b l e , a n d i t i s h o p e d t h a t f o r f o r m a t s
c o n s i d e r a b l y s m a l l e r t h a n 1 0 8 0 H D , 6 0 - 9 0 f p s m a y b e
a v a i l a b l e s h o r t l y . T h e s e n s o r i s c a p a b l e o f 5 0 0 f p s f o r
s o m e f o r m a t s , a n d t h i s w o u l d a l l o w o n e t o e s t i m a t e
a c c e l e r a t i o n s a s w e l l a s v e l o c i t i e s a n d l o c a t i o n s .
A s a p r o j e c t f o r o n e p e r s o n , i m p l e m e n t i n g a n
e y e t r a c k e r r e q u i r e s a v a r i e t y o f s k i l l s , h o w e v e r t h e
t a s k s m i g h t b e s p l i t a m o n g s t a c l a s s o f e n t h u s i a s t i c
a n d b r i g h t t e e n a g e r s !
Outline
T h e p h y s i c a l c o n s t r u c t i o n i s r e l a t i v e l y s i m p l e , a n d
e v i d e n t , i n a d d i t i o n y o u w i l l n e e d : a d a t a b a s e t o s t o r e
t h e d a t a , a g r a p h i c a l t o o l f o r c a l i b r a t i o n ,
c o m m u n i c a t i o n s i n c l u d i n g a w e b s e r v e r f o r e t h e r n e t
a n d u a r t f o r s e r i a l p o r t , p e r h a p s a u d i o f e e d b a c k , a n d
p o s s i b l y a p o r t a b l e d i s p l a y .
P o r t a b l e d i s p l a y s a r e u b i q u i t o u s , e v e n H D i s
c o m m o n , b u t H D M I i n p u t s a r e r a r e t o n o n - e x i s t e n t . I f
y o u r p r o j e c t n e e d s a p o r t a b l e i n t e r f a c e t h e K i n d l e i s
c h e a p , a n d c a n u s e e t h e r n e t o v e r u s b t o
c o m m u n i c a t e .
A s s u m i n g y o u i n t e n d t o v i s u a l i s e a n y r e s u l t s , w h i c h i s
n o t a r e q u i r e m e n t , I r e c o m m e n d h t m l 5 a n d N o d e J S ,
a s i m p l e a n d p o w e r f u l w e b s e r v e r , w i t h a n u p - t o - d a t e
v e r s i o n o f a w e b b r o w s e r s u c h a s M o z i l l a F i r e f o x ,
C h r o m e , S a f a r i o r O p e r a , o r p o s s i b l y I E 1 1 .
I t m a y s e e m c o u n t e r - i n t u i t i v e , b u t w h i l s t t h e R P i i s
c a p a b l e o f s e r v i n g t h e e y e t r a c k i n g d a t a , i n c l u d i n g
v i d e o , i t c a n n o t c u r r e n t l y r u n a n h t m l 5 b r o w s e r
e f f i c i e n t l y s o y o u m a y n e e d a n o t h e r b o x . I u s e a 5
y e a r o l d m a c - m i n i r u n n i n g D e b i a n W h e e z y f o r
c o n v e n i e n c e .
D u r i n g c o n s t r u c t i o n a n d d e v e l o p m e n t ,
c o m m u n i c a t i o n r e l i e s o n s s h o v e r e t h e r n e t . O n c e w e
n e e d t o b e p o r t a b l e , s t a r t a p p l i c a t i o n s i n S c r e e n a n d
d e t a c h , t o l e a v e o u r a p p l i c a t i o n r u n n i n g w h i l e w e
u n p l u g e t h e r n e t , a n d w i t h c a r e , l a t e r r e c o n n e c t a n d
c o n t i n u e ; m a g i c i n d e e d !
8/13/2019 The Pi Cameral Eyetracker
http://slidepdf.com/reader/full/the-pi-cameral-eyetracker 3/410
Software
I n a d d i t i o n t o v a r i o u s e a s y t o u s e a p p l i c a t i o n s s u c h
a s r a s p i v i d , a n a c q u a i n t a n c e w i t h a f e w s o f t w a r e
l a n g u a g e s i s h e l p f u l t o t h o s e w i s h i n g t o d e v e l o p t h e i r
o w n a p p l i c a t i o n ; s o m e j a v a s c r i p t , h t m l 5 a n d s v g w i l l
b e u s e f u l a n d p e r h a p s a l s o C a n d b a s h .
W h e n b u g h u n t i n g , a n d i n c a s e o f d i f f i c u l t i e s , c r e a t e a
r e d u c e d t e s t c a s e t o t e s t e a c h p a r t i n d e p e n d e n t l y .
T h e a c t u a l i r i s t r a c k i n g s o f t w a r e i s s i m p l e e n o u g h , w e
a s s u m e t h a t t h e i r i s c o v e r s a b o u t 3 0 % o f t h e i m a g e ,
a n d i s t h e d a r k e s t p a r t o f t h e i m a g e , s i m i l a r t o t h a t
i l l u s t r a t e d :
C u r r e n t c a m e r a s e n s o r s a d j u s t v e r y f a s t t o c h a n g e s
i n i l l u m i n a t i o n . A f i r s t r u n a s s e s s e s t h e o v e r a l l t o n e o f
e a c h f r a m e . I n t e s t s , t h e u p p e r b o u n d f o r t h i s d a r k e s t
3 0 % r a n g e d f r o m 2 7 t o 2 0 0 o u t o f a t o t a l p o s s i b l e
r a n g e o f 0 - 2 5 5 , o n e w o u l d n e e d t o c h e c k e a c h f r a m e
t o e v a l u a t e f u r t h e r . W e t h e n c a l c u l a t e t h e c e n t r e o f
t h i s d a r k n e s s , o u r s u p p o s e d i r i s .
S o a f e w l i n e s o f c o d e n e e d t o b e a d d e d t o t h e
e x c e l l e n t r p i - m m a l c a m e r a s o f t w a r e f r o m t a s a n a k o r n
b a s e d o n h i s m m a l s t u d i e s :
h t t p : / / g i t h u b . c o m / r a s p b e r r y p i / u s e r l a n d / t r e e / m a s t e r / i n t
e r f a c e / m m a l
T h e n t h e R a s p b e r r y P i w i t h e y e c a m c a n c a l c u l a t e
a n d d i s p l a y t h e o u t p u t i n r e a l t i m e a t 3 0 f p s .
T h i s x , y d a t a i s s t o r e d i n o u r R e d i s d a t a b a s e f o r l a t e r
v i s u a l i s a t i o n , t h o u g h i t m a y a l s o b e s e n t v i a e t h e r n e t
t o a w e b s i t e , f o r r e a l t i m e i n t e r a c t i v e g a m e p l a y , o r v i a
s e r i a l u a r t t o o u r s e c o n d R a s p b e r r y P i w i t h v i d e o
c a m e r a t o m a r k t h e u s e r ' s g a z e i n r e a l - t i m e .
U a r t o v e r s e r i a l i s u s e d t o s y n c t h e e y e c a m a n d
v i e w c a m , a s a c l a p p e r b o a r d i s u s e d t o s y n c a u d i o
a n d v i d e o . D r i f t i s b o u n d t o a r i s e , t h e r e i s n o e d i t o r ,
n o r c u t s , a n d i t i s a l m o s t e s s e n t i a l t o h a v e a v i d e o
t i m e s t a m p , t h o u g h o n e i s n o t c u r r e n t l y a v a i l a b l e .
Callibration
Y o u w i l l n e e d t o c a l l i b r a t e t h e e y e c a m ' s e y e t r a c k i n g
d a t a w i t h t h e R a s p b e r r y P i v i e w c a m ' s s e n s o r ' s F i e l d
O f V i e w . T h a t i s , w e n e e d t o a l i g n t h e m i n r e s p e c t o f
t i m e , a n d t o e s t i m a t e t h e u s e r ' s g a z e p o s i t i o n o n t h e
v i d e o f r a m e .
T h e u s e r s h o u l d b e d i r e c t l y i n f r o n t o f a 1 0 8 0 H D
s c r e e n w h i c h s h o u l d c o v e r p e r h a p s 2 0 % o f t h e i r t o t a l
v i s u a l f i e l d . T h e u s e r f o l l o w s a m o v i n g p o i n t w i t h t h e i r
e y e s , w e u s e a 4 x 4 g r i d w h i c h c o v e r s t h e w h o l e
s c r e e n a n d i s o r d e r e d r a n d o m l y , t o p r e v e n t t h e u s e r
g u e s s i n g t h e n e x t p o i n t . T h i s t a k e s a b o u t a m i n u t e t o
c o m p l e t e , f o r t h e m o m e n t a s s u m e c a l l i b r a t i o n i s
c o m p l e t e a n d s u c c e s s f u l .
R e a d y t o p l a y m y e y e t r a c k i n g g a m e ' T a k e t h e B o x '
a n d h o n e y o u r s k i l l s .
W h e n d e s i g n i n g a g a m e t h a t p r o v i d e s v i s u a l
f e e d b a c k o n e n e e d s t o b e c a r e f u l ; i t c a n g e t i n t h e
w a y . T h e a i m o f t h i s g a m e i s t o f i n d w h i c h o n e o f 1 6
b o x e s c o n t a i n s t h e h y p e r l i n k . T h e e y e m o v e s t h e
c u r s o r i n t h i s c a s e a t a r g e t , w h i c h i s s u r p r i s i n g l y
d i f f i c u l t t o s e e , f o r i t m o v e s e v e r s o s l i g h t l y o u t o f
s y n c . . A s y o u h o l d y o u r g a z e o v e r a b o x t h e h u e
c h a n g e s s l o w l y f r o m g r e y t o g r e e n , a n d a f t e r 2
s e c o n d s w h e n a g o l d e n h e a r t a p p e a r s , i t ' s t i m e t o t r y
a n o t h e r b o x .
8/13/2019 The Pi Cameral Eyetracker
http://slidepdf.com/reader/full/the-pi-cameral-eyetracker 4/411
S h o u l d y o u r g a z e w a n d e r s o o n e r , y o u s t a r t a g a i n .
E a c h t i m e y o u p l a y t h e g a m e t h e h y p e r l i n k i s i n a
d i f f e r e n t b o x , s o n o c h e a t i n g .
F o r n o w t h i s i s a s i n g l e p l a y e r h t m l 5 g a m e , j u s t p l u g
y o u r n e w e y e c a m i n t o y o u r b r o w s e r b o x a n d p l a y . I f
y o u ' v e b e e n f o l l o w i n g , y o u ' l l r e m e m b e r t h e R a s p b e r r y
P i c a n n o t r u n a n h t m l 5 b r o w s e r , s o f o r n o w m a y b e
u s e a P S 3 e y e c a m a n d g i v e n d e m a n d a n R a s p b e r r y
P i v e r s i o n u s i n g x , y c o o r d i n a t e s w i l l a p p e a r .
For the future
B r o w s e r s t a n d a r d s a r e b e i n g d e v e l o p e d w i t h t h e
n a t u r a l a s s u m p t i o n t h a t a b r o w s e r i s i n u s e . H o w e v e r
i n p u t d e v i c e s d o n o t g e n e r a l l y r e q u i r e o r n e e d a
b r o w s e r . F o r t h i s r e a s o n i t m a y b e h e l p f u l t o d e v e l o p
a r a n g e o f i n d e p e n d e n t i n p u t - d e v i c e s t a n d a r d s a n d
h e u r i s t i c s w h i c h w h i l s t n o t c o n s t r a i n e d b y b r o w s e r
s t a n d a r d s , m a y b e c o n s i d e r e d .
S o c i a l m e d i a h e a t m a p s t h a t i n d i c a t e w h e r e p e o p l e
a r e l o o k i n g d u r i n g s p o r t s e v e n t s , f i l m s , s o c i a l
i n t e r a c t i o n a n d o t h e r a c t i v i t i e s .
A s u i t a b l e c h e a p c o n f i g u r a b l e e y e t r a c k e r m a y
p r o v i d e t h e a f f o r d a n c e s t h a t m e e t m e d i c a l n e e d s a n d
t h u s h e l p u s b e t t e r u n d e r s t a n d t h e u n d e r l y i n g s o c i a l
m o d e l s o f d i s a b i l i t y .
A r e s u l t s p a g e i s u n d e r d e v e l o p m e n t t o h e l p t h e u s e r
e v a l u a t e a n d r e j e c t f a u l t y c a l l i b r a t i o n .
T h e m k 2 h a s t h e P S 3 e y e c a m i n t h e m i d d l e o f f i e l d o f
v i e w ( F O V ) , w h i c h o b s t r u c t s t h e v i e w , b u t c a l l i b r a t i o n
i s s i m p l e . T h e P i c a m e r a l e y e - t r a c k e r n e e d s a n e w
m a t r i x t r a n s f o r m a t i o n , w h i c h w i l l i m p r o v e a c c u r a c y o f
t h e i r i s c e n t r e . S o u n f o r t u n a t e l y , f o r n o w t h e
e y e t r a c k s i l l u s t r a t e d a r e f r o m t h e m k 2 d a t a ,
o v e r l a y i n g v i d e o f r o m t h e R P i v i e w c a m .
T h e r e a r e m a n y t h e o r i e s o f c o l o u r a n d p e r c e p t i o n .
T h e E c o l o g i c a l a p p r o a c h t o v i s u a l p e r c e p t i o n b y
J a m e s J G i b s o n ' s d e s c r i b e s t h e s i g h t e d a n i m a l
m o v i n g i n t h e n a t u r a l e n v i r o n m e n t . W e f o l l o w h i s
b e l i e f i n t h i s s t r a t e g y g u i d e d b y t h e p r i n c i p a l o f
G e s t a l t , a n d t h e R P i w i t h c a m e r a m a y a f f o r d t h e
o p p o r t u n i t y t o t e s t a n d d e v e l o p h i s h y p o t h e s i s .
C a r t o g r a p h y i n v o l v e s v i s u a l i s i n g c o m p l e x d a t a s e t s ,
t h a t m a y i n c l u d e f i n a n c e , e c o n o m i c s , e c o l o g y , g a m e
t h e o r y a n d i s n o t l i m i t e d t o g e o g r a p h y .
M y i n t r o d u c t o r y v i s u a l i s a t i o n i s m a i n t a i n e d a t
h t t p : / / w w w . p e e p o . c o m , w h e r e y o u c a n p l a y G o , t h e
a n c i e n t o r i e n t a l g a m e o f s t r a t e g y t h a t i s p l a y e d o n a
1 9 x 1 9 b o a r d . G o i s e a s y t o l e a r n b u t h a r d t o m a s t e r ,
a n d w h i l s t m o r e c o m p l e x t h a n c h e s s , c o m p u t e r s
u s i n g M o n t e C a r l o T r e e S e a r c h a r e m a k i n g p r o g r e s s .
T h e e y e - t r a c k e r d e s c r i b e d i s i n t e n d e d t o b e u s e d t o
c o n t r a s t a s t u d y i n t o h o w d i f f e r e n t u s e r s u n d e r s t a n d
a n d c o m m u n i c a t e u s i n g m a p s , w i t h G o a s t h e
m e t a p h o r , a g a i n s t a n o t h e r s t u d y o f e y e u s e i n v i v o . I
e n c o u r a g e o t h e r s t o c o n t r i b u t e t h e i r o w n i d e a s .
F o r n o w t h e P i c a m e r a l e y e - t r a c k e r i s a p r o o f o f
c o n c e p t .
M o r e d e t a i l s a n d v i d e o s o n t h e w e b s i t e
h t t p : / / w w w . g n o t e . o r g
c o n t a c t : J o n a t h a n C h e t w y n d j a y @ p e e p o . c o m