- Timestamp:
- Dec 7, 2009, 8:26:07 AM (15 years ago)
- Location:
- liacs/mms/project
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
liacs/mms/project/chessboard.pl
r19 r23 6 6 ($WIDTH, $HEIGHT) = split(' ',`xrandr | awk '/\\*/ {print $$1}' | tr 'x' ' '`); 7 7 print "Screen: ". $WIDTH . "x" . $HEIGHT . "\n"; 8 9 $HEIGHT=600; 10 $WIDTH=800; 8 11 9 12 $X_NUM=$HEIGHT/$BLOCK_SIZE; … … 58 61 print $CMD; 59 62 `$CMD`; 60 `display gif:$FILE`;61 -
liacs/mms/project/colour-tracking.c
r20 r23 85 85 int r, g, b; 86 86 int q; 87 int x_move, y_move; 88 87 89 int retval; 88 90 char arg1[4], arg2[4]; 89 91 int keycode; 90 92 // Actually move the pointer to it's location 91 int mouse_flag = 1; 93 int mouse_flag = 0; 94 int r_window_flag = 1; 95 int g_window_flag = 1; 96 int b_window_flag = 1; 92 97 // XXX: Hack to have the pointer posted on the second screen. 93 98 int ex_screen_flag = 0; 94 99 int x_ajust = -114; 100 int y_ajust = -95; 101 95 102 96 103 int cvalue = 0; … … 112 119 113 120 //cvCopy(image, output, NULL); 114 115 cvSmooth(image,output,CV_BLUR, 3, 3, 3,3);121 //Remove Noise from images 122 cvSmooth(image,output,CV_BLUR, 3, 3, 3,3); 116 123 cvCopy(image, routput, NULL); 117 124 cvCopy(image, goutput, NULL); … … 175 182 cvCircle(target, cvPoint(xmax, ymax), 10, CV_RGB(255,0,0),4, 8, 0); 176 183 // Set to pointer to new location 184 // Some Hacking to get the pointer synced 177 185 if (mouse_flag) { 186 x_move = ratio(xmax + x_ajust,width,screen_width); 187 y_move = ratio(ymax + y_ajust,height,screen_height); 178 188 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)); 189 x_move += screen_width; 184 190 } 191 xdo_mousemove(xdo, x_move, y_move); 185 192 } 186 193 … … 188 195 // Show all the images 189 196 cvShowImage("RGB_Image", output); 190 cvShowImage("R_Image", routput); 191 cvShowImage("B_Image", boutput); 192 cvShowImage("G_Image", goutput); 197 if (r_window_flag) 198 cvShowImage("R_Image", routput); 199 if (b_window_flag) 200 cvShowImage("B_Image", boutput); 201 if (g_window_flag) 202 cvShowImage("G_Image", goutput); 193 203 cvShowImage("F_Image", target); 194 204 … … 202 212 break; 203 213 } else if (keycode == 'm') { 204 mouse_flag = (mouse_flag == 1) ? 0 :1;214 mouse_flag ^= 1; 205 215 } else if (keycode == 'e') { 206 ex_screen_flag = (ex_screen_flag == 1) ? 0 : 1; 207 216 ex_screen_flag ^= 1; 217 // Hack to manually sync mouse pointer with laser pointer 218 } else if (keycode == 'w' || keycode == 's' || keycode == 'a' || \ 219 keycode == 'd') { 220 if (keycode == 'w') { 221 y_ajust--; 222 } else if (keycode == 's') { 223 y_ajust++; 224 } else if (keycode == 'a') { 225 x_ajust--; 226 } else if (keycode == 'd') { 227 x_ajust++; 228 } 229 printf("New x,y ajust: %i,%i\n",x_ajust,y_ajust); 230 } else if (keycode == 'r' || keycode == 'g' || keycode == 'b') { 231 printf("Toggle window: %c\n", keycode); 232 if (keycode == 'r') { 233 r_window_flag ^= 1; 234 } else if (keycode == 'g') { 235 g_window_flag ^= 1; 236 } else if (keycode == 'b') { 237 b_window_flag ^= 1; 238 } 208 239 } 209 240 } 210 241 } //for each frame ... 211 242 … … 226 257 int main(int argc, char *argv[]) { 227 258 int retval; 259 printf("=== INSTRUCTION == \n\ 260 Keybindings:\n\ 261 e = toggle mouse on external screen mouse pointer\n\ 262 m = toggle mouse tracking\n\ 263 q = quit\n\ 264 Mouse/laser pointer syncer:\n\ 265 w = up\n\ 266 s = down\n\ 267 a = left\n\ 268 f = right\n\ 269 "); 228 270 xdo = xdo_new(getenv("DISPLAY")); 229 271 retval = InitSystem(argc, argv);
Note:
See TracChangeset
for help on using the changeset viewer.