Changeset 20 for liacs/mss/project
- Timestamp:
- Dec 2, 2009, 4:44:00 PM (15 years ago)
- Location:
- liacs/mss/project
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
liacs/mss/project/Makefile
r19 r20 4 4 5 5 tracking: colour-tracking 6 ./colour-tracking 1 `xrandr | awk '/\*/ {print $$1}' | tr 'x' ' '` 6 # ./colour-tracking 1 `xrandr | awk '/\*/ {print $$1}' | tr 'x' ' '` 7 ./colour-tracking 1 1400 900 7 8 8 9 colour-tracking: xdo.o -
liacs/mss/project/colour-tracking.c
r19 r20 87 87 int retval; 88 88 char arg1[4], arg2[4]; 89 int keycode; 90 // Actually move the pointer to it's location 91 int mouse_flag = 1; 92 // XXX: Hack to have the pointer posted on the second screen. 93 int ex_screen_flag = 0; 89 94 90 95 … … 169 174 cvCopy(output,filter, NULL); 170 175 cvCircle(target, cvPoint(xmax, ymax), 10, CV_RGB(255,0,0),4, 8, 0); 171 xdo_mousemove(xdo, ratio(xmax,width,screen_width), 172 ratio(ymax,height,screen_height)); 176 // Set to pointer to new location 177 if (mouse_flag) { 178 if (ex_screen_flag) { 179 xdo_mousemove(xdo, ratio(xmax,width,screen_width) + screen_width - 250, 180 ratio(ymax,height,screen_height)); 181 } else { 182 xdo_mousemove(xdo, ratio(xmax,width,screen_width), 183 ratio(ymax,height,screen_height)); 184 } 185 } 173 186 174 187 … … 181 194 182 195 183 // wait for any to press to quit 184 // Eeks! also HACK to make it refresh properly 185 if (cvWaitKey(20) != -1) { 186 break; 187 } 196 // Process some keyboard input for handy selection 197 // Eeks! also HACK to make it refresh properly 198 keycode = cvWaitKey(20); 199 if (keycode != -1) { 200 printf("Keycode: %i\n", keycode); 201 if (keycode == 'q') { 202 break; 203 } else if (keycode == 'm') { 204 mouse_flag = (mouse_flag == 1) ? 0 : 1; 205 } else if (keycode == 'e') { 206 ex_screen_flag = (ex_screen_flag == 1) ? 0 : 1; 207 208 } 209 } 188 210 } //for each frame ... 189 211
Note:
See TracChangeset
for help on using the changeset viewer.