find below the .txt of my patch it is to be used to track real life objects then relay them in a 3d world rendered. i have been able to track a red ball and replicate the movement but its not acurate you can try it with the redball move. mov or use camera in and a red ball on white background
I eventually want to track several objects, i.e red ball, green square, yellow triangle etc and when i move these real life objects the max patch renders out the same but in 3d. ok confussed probly but any help woul;d be great, ok patch here>>>
max v2;#N vpatcher 26 37 940 672;#P origin 0 102;#P window setfont "Sans Serif" 9.;#P window linecount 1;#P message 782 525 87 9109513 read greencube.obj;#P newex 875 268 40 9109513 / 0.51;#P newex 919 254 40 9109513 / 0.51;#P window setfont "Proportional Serif" 10.;#P comment 952 295 13 9175050 z;#P comment 914 293 13 9175050 y;#P comment 881 292 13 9175050 x;#P window setfont "Fixedwidth Serif" 10.;#P flonum 953 313 35 10 -2.3 -2.3 3 141 0 0 0 221 221 221 222 222 222 0 0 0;#P flonum 915 311 35 10 -2. 2. 3 141 107 131 255 166 54 0 222 222 222 0 0 0;#P flonum 876 311 35 10 0 0 0 141 255 255 255 7 41 225 222 222 222 0 0 0;#P newex 820 362 134 9240586 pak position 0. 0. 0.;#P window linecount 2;#P newex 759 311 110 9240586 jit.gl.handle ml @auto_rotate 1;#B color 5;#P window setfont "Sans Serif" 9.;#P window linecount 1;#P message 74 535 295 9109513 position 1.63525 -0.16056 0.831935;#P newex 74 507 60 9109513 prepend set;#P message 801 416 71 9109513 read redball.obj;#P window setfont "Fixedwidth Serif" 10.;#P number 917 572 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;#P button 898 513 15 0;#P message 898 595 84 9240586 drawgroup \$1;#N counter 1 10;#X flags 0 0;#P newobj 898 543 84 9240586 counter 1 10;#P message 550 322 103 9240586 material_mode \$1;#P number 550 302 35 10 0 2 3 141 0 0 0 221 221 221 222 222 222 0 0 0;#P message 909 616 73 9240586 drawgroup 0;#P toggle 863 156 15 0;#P message 863 177 110 9240586 smooth_shading \$1;#P message 98 402 113 9240586 texture grid 64 64;#P message 775 437 113 9240586 read mushrooms.obj;#P message 878 230 80 9240586 texgroup 1 0;#P message 860 209 98 9240586 texgroup 1 grid;#P message 682 236 14 9240586 0;#P message 645 236 32 9240586 grid;#P newex 654 265 98 9240586 prepend texture;#P message 772 231 68 9240586 tex_map \$1;#P number 772 211 35 10 0 3 3 141 0 0 0 221 221 221 222 222 222 0 0 0;#P toggle 736 159 15 0;#P message 736 179 113 9240586 lighting_enable \$1;#P toggle 628 167 15 0;#P message 628 188 68 9240586 verbose \$1;#P message 771 281 50 9240586 reset;#P user jit.pwindow 384 358 347 233 0 1 0 0 1 1;#X name ml;#P message 383 319 140 9240586 name ml \, depthbuffer 1;#P window setfont "Sans Serif" 12.;#P comment 608 132 149 9109516 Draw a Model;#P comment 1 333 115 9109516 OpenGL Renderer;#P window setfont "Fixedwidth Serif" 10.;#P newex 11 401 73 9240586 t b b erase;#P newex 748 611 128 9240586 jit.gl.model ml;#B color 5;#P window setfont "Proportional Serif" 10.;#P comment 26 357 70 9175050 Start Rendering;#P window setfont "Fixedwidth Serif" 10.;#P newex 11 377 62 9240586 qmetro 50;#P toggle 11 356 15 0;#P newex 11 446 272 9240586 jit.gl.render ml @erase_color 0.5 0.3 0.2 1.;#B color 5;#P user panel 3 344 346 129;#X brgb 247 99 169;#X frgb 0 0 0;#X border 0;#X rounded 0;#X shadow 0;#X done;#P window setfont "Sans Serif" 9.;#P newex 580 0 132 9109513 jit.dx.grab 320 240 @unique 1;#P message 679 -25 44 9109513 settings;#P comment 602 -68 105 9109513 Use live camera input;#P message 664 -45 31 9109513 close;#P message 633 -45 28 9109513 open;#P toggle 580 -69 15 0;#P newex 580 -45 40 9109513 metro 2;#P user panel 572 -80 164 145;#X brgb 140 140 140;#X frgb 0 0 0;#X border 0;#X rounded 0;#X shadow 0;#X done;#P window setfont "Proportional Serif" 10.;#P comment 26 -78 36 9175050 On/Off;#P window setfont "Sans Serif" 12.;#P comment 349 -69 181 9109516 Tracking the Location of a Color;#P window setfont "Proportional Serif" 10.;#P comment 297 305 36 9175050 vertical;#P comment 48 305 48 9175050 horizontal;#P window setfont "Fixedwidth Serif" 10.;#P newex 154 -78 53 9240586 loadbang;#P flonum 13 305 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;#P flonum 333 305 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;#P newex 333 284 43 9240586 / 239.;#P newex 13 284 43 9240586 / 319.;#P number 344 255 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;#P number 13 266 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;#P user hslider 13 246 13 305 320 1 0 0;#P user uslider 333 5 13 225 240 1 0 0;#P window setfont "Proportional Serif" 10.;#P comment 520 147 36 9175050 bottom;#P comment 482 147 27 9175050 right;#P comment 444 147 21 9175050 top;#P window setfont "Fixedwidth Serif" 10.;#P newex 401 169 140 9240586 expr $i1+(($i2-$i1)/2);#P newex 67 -78 80 9240586 sel 0 1;#P newex 439 190 173 9240586 expr 239-($i1+(($i2-$i1)/2));#P number 515 132 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;#P number 477 132 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;#P number 439 132 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;#P number 401 132 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;#P newex 477 111 48 9240586 unpack;#P newex 401 111 48 9240586 unpack;#P user jit.pwindow 12 5 322 242 0 1 0 0 1 0;#P newex 418 63 326 9240586 jit.findbounds @min 0. 0.80.75. 0. @max 1. 1. 1. 0.25;#B color 5;#P message 154 -56 103 9240586 read redball.mov;#P message 67 -56 32 9240586 stop;#P message 102 -56 38 9240586 start;#P newex 11 -57 53 9240586 metro 50;#P toggle 11 -79 15 0;#P newex 11 -32 128 9240586 jit.qt.movie 320 240;#P window setfont "Proportional Serif" 10.;#P comment 406 147 20 9175050 left;#P user panel 375 94 218 154;#X brgb 127 255 255;#X frgb 0 0 0;#X border 0;#X rounded 0;#X shadow 0;#X done;#P user panel 8 302 365 23;#X brgb 255 255 127;#X frgb 0 0 0;#X border 0;#X rounded 0;#X shadow 0;#X done;#P connect 4 0 5 0;#P connect 5 0 3 0;#P fasten 6 0 3 0 107 -36 16 -36;#P fasten 7 0 3 0 72 -36 16 -36;#P fasten 8 0 3 0 159 -36 16 -36;#P connect 46 0 47 0;#P connect 47 0 50 0;#P fasten 50 2 45 0 78 429 16 429;#P connect 50 0 45 0;#P fasten 68 0 45 0 103 437 16 437;#P connect 3 0 10 0;#P connect 43 0 10 0;#P fasten 19 0 24 0 406 343 9 343 9 323 18 323;#P connect 24 0 25 0;#P connect 25 0 27 0;#P connect 27 0 30 0;#P fasten 4 0 18 0 16 -61 63 -61 63 -82 72 -82;#P connect 18 0 7 0;#P connect 79 0 80 0;#P connect 18 1 6 0;#P connect 31 0 8 0;#P fasten 17 0 23 0 444 236 349 236 349 83 338 83;#P connect 26 0 28 0;#P connect 28 0 29 0;#P connect 23 0 26 0;#P connect 53 0 54 0;#P connect 9 0 11 0;#P connect 11 0 13 0;#P connect 13 0 19 0;#P connect 43 0 9 0;#P fasten 3 0 9 0 16 -12 423 -12;#P connect 11 1 14 0;#P connect 14 0 17 0;#P connect 9 1 12 0;#P connect 12 0 15 0;#P connect 12 1 16 0;#P fasten 15 0 19 1 482 165 536 165;#P connect 72 0 73 0;#P connect 38 0 37 0;#P connect 37 0 43 0;#P hidden connect 42 0 43 0;#P fasten 39 0 43 0 638 -23 585 -23;#P fasten 40 0 43 0 669 -23 585 -23;#P fasten 16 0 17 1 520 161 607 161;#P connect 57 0 56 0;#P fasten 64 0 62 0 687 259 659 259;#P fasten 63 0 62 0 650 259 659 259;#P connect 59 0 58 0;#P fasten 91 0 49 0 787 576 753 576;#P fasten 81 0 49 0 764 481 753 481;#P fasten 78 0 49 0 806 469 753 469;#P fasten 75 0 49 0 903 492 753 492;#P fasten 73 0 49 0 555 333 753 333;#P fasten 71 0 49 0 914 495 753 495;#P fasten 66 0 49 0 883 264 753 264;#P fasten 65 0 49 0 865 261 753 261;#P fasten 69 0 49 0 868 267 753 267;#P fasten 58 0 49 0 741 261 753 261;#P fasten 61 0 49 0 777 258 753 258;#P fasten 62 0 49 0 659 334 753 334;#P fasten 56 0 49 0 633 306 753 306;#P fasten 67 0 49 0 780 487 753 487;#P fasten 82 0 49 0 825 496 753 496;#P connect 55 0 81 0;#P connect 60 0 61 0;#P connect 83 0 82 1;#P connect 70 0 69 0;#P connect 30 0 90 0;#P connect 90 0 83 0;#P connect 76 0 74 0;#P connect 74 0 75 0;#P connect 84 0 82 2;#P connect 89 0 84 0;#P fasten 74 0 77 0 903 566 922 566;#P connect 29 0 89 0;#P connect 85 0 82 3;#P pop;