Eyetracking
Work in progress
Allgemein
In unserem Eyetracking Projekt versuchen wir ein "Low cost mobile head monted eyetracking" zusammenzusetellen, um an der Hochschule Luzern ein Forschungslabor einzurichten.
The aim of the Eyetracking Project is to provide a "low cost mobile head monted eyetracking" system for use in a research loboratory.
Installation
This guide is for installation on OSX 10.4.x systems. (Installation on OSX 10.5 will need some modifications.) You'll need following software:
Install Apple XTools / XCode
Download and install svnX
Download and install InsomniaX
Download and install Darwinports and then in the Terminal:
- sudo port install pkgconfig
Download Openeyes (alternativ Link) and unpack in $HOME/devel/ .
To install libdc1394, open the Terminal and enter:
- cd $HOME/devel
- svn co https://libdc1394.svn.sourceforge.net/svnroot/libdc1394/trunk/libdc1394/ -r 537 libdc1394r537
- (I use the revision 537 for OSX 10.4.X, OSX 10.5.X should be able to work with head)
- cd libdc1394r537
- autoreconf -i -s
Download Opencv to $HOME/devel, apply the following patch (it permits you to see the value of a slider in the gui) and build the frameworks
- cd $HOME/opencv
- patch -p0 < window_carbon.patch
- ./make_frameworks.sh
window_carbon.patch :
--- otherlibs/highgui/window_carbon.cpp 2008-07-09 13:54:43.000000000 +0200 +++ otherlibs/highgui/window_carbon.new.cpp 2008-07-09 13:54:32.000000000 +0200 @@ -50,6 +50,7 @@ //#define MS_TO_TICKS(a) a*3/50 #define LABELWIDTH 64 +#define CELLWIDTH 32 #define INTERWIDGETSPACE 16 #define WIDGETHEIGHT 32 #define NO_KEY -1 @@ -62,6 +63,7 @@ ControlRef trackbar; ControlRef label; + ControlRef cell; char* name; CvTrackbar* next; @@ -447,22 +466,33 @@ __END__; } +/* TODO: Create Textbox to enter numerical value +void TrackbarCellActionProcPtr (ControlRef theControl, ControlPartCode partCode) +{ +} +*/ void TrackbarActionProcPtr (ControlRef theControl, ControlPartCode partCode) { CvTrackbar * trackbar = icvTrackbarByHandle (theControl); + char controlString[5]; if (trackbar == NULL) { fprintf(stderr,"Error getting trackbar\n"); return; } - else + else { - if ( trackbar->data ) + if ( trackbar->data ) *trackbar->data = GetControl32BitValue (theControl); if ( trackbar->notify ) trackbar->notify(GetControl32BitValue (theControl)); + if ( trackbar->cell ){ + sprintf( controlString, "%u", *trackbar->data ); + SetControlData( trackbar->cell, kControlEntireControl, kControlEditTextTextTag, strlen( controlString ), controlString ); + Draw1Control( trackbar->cell ); + } } } @@ -479,6 +509,7 @@ Rect stboundsRect; ControlRef outControl; ControlRef stoutControl; + ControlRef celloutControl; Rect bounds; if( !window_name || !trackbar_name ) @@ -527,26 +558,39 @@ stboundsRect.bottom = stboundsRect.top + WIDGETHEIGHT; stboundsRect.right = stboundsRect.left+LABELWIDTH; - fprintf(stdout,"create trackabar bounds (%d %d %d %d)\n",stboundsRect.top,stboundsRect.left,stboundsRect.bottom,stboundsRect.right); + //fprintf(stdout,"create trackbar static text bounds (%d %d %d %d)\n",stboundsRect.top,stboundsRect.left,stboundsRect.bottom,stboundsRect.right); CreateStaticTextControl (window->window,&stboundsRect,CFStringCreateWithCString(NULL,trackbar_name,kCFStringEncodingASCII),NULL,&stoutControl); stboundsRect.top = (INTERWIDGETSPACE +WIDGETHEIGHT)* (c-1)+INTERWIDGETSPACE; stboundsRect.left = INTERWIDGETSPACE*2+LABELWIDTH; stboundsRect.bottom = stboundsRect.top + WIDGETHEIGHT; + stboundsRect.right = INTERWIDGETSPACE*2+LABELWIDTH+CELLWIDTH; + +/* TODO: Create Textbox to enter numerical value + CreateEditUnicodeTextControl (window->window,&stboundsRect, CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%u"), trackbar->pos), false, NULL, &celloutControl); + SetControlAction(celloutControl,NewControlActionUPP(TrackbarCellActionProcPtr)); +*/ + CreateStaticTextControl (window->window,&stboundsRect,CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%u"), trackbar->pos), NULL, &celloutControl); + + stboundsRect.top = (INTERWIDGETSPACE +WIDGETHEIGHT)* (c-1)+INTERWIDGETSPACE; + stboundsRect.left = INTERWIDGETSPACE*3+LABELWIDTH+CELLWIDTH; + stboundsRect.bottom = stboundsRect.top + WIDGETHEIGHT; stboundsRect.right = bounds.right-INTERWIDGETSPACE; - - CreateSliderControl (window->window,&stboundsRect, trackbar->pos,0,trackbar->maxval,kControlSliderLiveFeedback,0,true,NewControlActionUPP(TrackbarActionProcPtr),&outControl); - + + CreateSliderControl (window->window,&stboundsRect,trackbar->pos,0,trackbar->maxval,kControlSliderLiveFeedback,10,true, NewControlActionUPP(TrackbarActionProcPtr),&outControl); + bounds.bottom += INTERWIDGETSPACE + WIDGETHEIGHT; SetControlVisibility (outControl,true,true); SetControlVisibility (stoutControl,true,true); + SetControlVisibility (celloutControl,true,true); trackbar->trackbar = outControl; trackbar->label = stoutControl; + trackbar->cell = celloutControl; if (c == 1) - window->trackbarheight = INTERWIDGETSPACE*2 + WIDGETHEIGHT; + window->trackbarheight = INTERWIDGETSPACE*2 + WIDGETHEIGHT/2; else - window->trackbarheight += INTERWIDGETSPACE + WIDGETHEIGHT; + window->trackbarheight += INTERWIDGETSPACE + WIDGETHEIGHT/2; icvUpdateWindowSize( window ); } __END__; @@ -702,7 +746,8 @@ Rect contentBounds = {100,100,320,440}; CvWindow* window; - UInt wAttributes = 0; + //UInt wAttributes = 0; + WindowAttributes wAttributes; int len; @@ -738,7 +783,8 @@ if( hg_windows ) hg_windows->prev = window; hg_windows = window; - wAttributes = kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute | kWindowLiveResizeAttribute; + //wAttributes = kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute | kWindowLiveResizeAttribute; + wAttributes = kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute | kWindowLiveResizeAttribute; err = CreateNewWindow ( kDocumentWindowClass,wAttributes,&contentBounds,&outWindow); if (err != noErr) @@ -753,6 +799,7 @@ err = InstallWindowEventHandler(outWindow, NewEventHandlerUPP(windowEventHandler), GetEventTypeCount(genericWindowEventHandler), genericWindowEventHandler, outWindow, NULL); ShowWindow( outWindow ); + InitCursor (); result = 1; __END__; @@ -863,7 +910,7 @@ Rect bounds; GetWindowBounds(window->window,kWindowContentRgn,&bounds); for ( t = window->toolbar.first; t != 0; t = t->next ) - SizeControl(t->trackbar,bounds.right - bounds.left - INTERWIDGETSPACE*3 - LABELWIDTH , WIDGETHEIGHT); + SizeControl(t->trackbar,bounds.right - bounds.left - INTERWIDGETSPACE*4 - LABELWIDTH - CELLWIDTH, WIDGETHEIGHT); } /* redraw the image */ icvDrawImage(window);
The OpenCV.framework will be located in $HOME/devel
Now it's time to create the xcode project for Openeyes.
- Project > New Build Phase > New Copy Files Build Phase
- (on the created Build Phase ) Apple-I and Destination Frameworks