Forums > Jitter

Clear out colours

April 27, 2007 | 9:55 pm

Hi community,
I have problems with clear colour-tracking! In my patch I would like to track two colours, red and blue, and draw a line with these two informations (maybe this exlanation seems familiar to somebody, because I already posted some questions on it in earlier times, but still problems exist :$ …).
The short video is an example of the colour-informations i get with my camera. ("video_320_240_15.mov" attached)
Unfortunately the line I get isn’t very "homogeneous". It is very wiggly and sometimes the colour is totally lost so the line is somewhere else in the window.
* Is the resolution too small (already tried 640*480, but still problems and the CPU is not very happy ;) )?
* Are there better ways to track the colours instead of "jit.findbounds" (already looked a little bit on "cv.jit"-tracking, but most of they seem to work only in greyscale)?
* Is there a better way to clear out the colours maybe?
* Or is it just a calculation, that could help me to get a more proper line (don’t know exactly how, just brain-storming…)

And a last question: everytime I switch on the camera, the CPU rashes up close to his limit! I already tried "displaylist" enabled on "jit.gl.sketch", or "depthbuffer" and "sync" on the "jit.window", but nothing really helped me…
Honestly I have to say, that only my laptop has hard problems with that, because he is already an older generation. But maybe something in my patch could be improved to "protect" a little bit my CPU…

I am sorry for posing so many problems at once, but any hints or tips are very useful for me as a "fresh" Jitter-User ;) !
Thank you very much indeed for your help!
Johannes

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 294 753 27 9109513 f;
#P newex 254 753 27 9109513 f;
#P message 254 799 66 9109513 moveto $1 $2;
#P newex 254 775 50 9109513 pack 0. 0.;
#P flonum 393 515 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 232 514 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 393 484 112 9109513 expr ($f4+$f3-$f2+$f1)/2;
#P newex 232 484 112 9109513 expr ($f1+$f2+$f3-$f4)/2;
#P message 101 38 26 9109513 read;
#P newex 17 81 91 9109513 jit.qt.movie 320 240;
#P message 58 39 26 9109513 stop;
#P message 17 38 27 9109513 start;
#P user jit.pwindow 453 200 122 92 0 0 0 0 1 0;
#P window setfont "Fixedwidth Serif" 10.;
#P message 758 117 83 9240586 saturation $1;
#P flonum 758 99 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname saturation[1];
#P message 672 117 73 9240586 contrast $1;
#P flonum 672 99 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname contrast[1];
#P message 586 117 83 9240586 brightness $1;
#P flonum 586 99 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname brightness[1];
#P newex 454 141 68 9240586 jit.brcosa;
#P user panel 581 92 265 46;
#X brgb 127 255 127;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 9.;
#P comment 581 77 188 9109513 settings for color-management;
#N vpatcher 749 545 1062 856;
#P inlet 119 47 15 0;
#P inlet 41 48 15 0;
#P outlet 218 238 15 0;
#P outlet 41 238 15 0;
#P window setfont "Sans Serif" 9.;
#P flonum 41 217 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 66 237 48 9109513 horizontal;
#P comment 175 238 41 9109513 vertical;
#P comment 160 128 34 9109513 bottom;
#P comment 123 128 24 9109513 right;
#P comment 86 128 24 9109513 top;
#P comment 47 128 24 9109513 left;
#P window setfont "Fixedwidth Serif" 10.;
#P number 218 216 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 41 155 140 9240586 expr $i1+(($i2-$i1)/2);
#P newex 80 181 173 9240586 expr 239-($i1+(($i2-$i1)/2));
#P window setfont "Sans Serif" 9.;
#P number 158 102 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 119 102 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 80 102 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 41 102 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 119 69 38 9109513 unpack;
#P newex 41 70 38 9109513 unpack;
#P user panel 39 67 219 192;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P comment 40 28 137 9109513 Calculation for center of region;
#P connect 20 0 2 0;
#P connect 2 0 4 0;
#P connect 4 0 9 0;
#P connect 9 0 17 0;
#P connect 17 0 18 0;
#P fasten 2 1 5 0 74 95 85 95;
#P connect 5 0 8 0;
#P connect 21 0 3 0;
#P connect 3 0 6 0;
#P fasten 3 1 7 0 152 95 163 95;
#P fasten 6 0 9 1 124 126 176 126;
#P fasten 8 0 10 0 85 206 223 206;
#P connect 10 0 19 0;
#P fasten 7 0 8 1 163 121 248 121;
#P pop;
#P newobj 617 387 111 9109513 patcher calculation bleue;
#P window setfont "Proportional Serif" 10.;
#P comment 701 347 96 9175050 Show Tracked Region;
#P comment 662 152 78 9175050 Track Color Blue;
#P user jit.pwindow 620 335 42 32 0 0 0 0 1 0;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 621 313 68 9240586 jit.matrix;
#P newex 684 259 110 9240586 prepend srcdimend;
#P toggle 708 309 15 0;
#P objectname usesrcdim[1];
#P message 708 327 80 9240586 usesrcdim $1;
#P newex 631 284 122 9240586 prepend srcdimstart;
#P window linecount 3;
#P newex 631 172 122 9240586 jit.findbounds @min 0. 0. 0.9 0.9 @max 1. 0. 1. 1.;
#B color 5;
#P user panel 616 172 182 205;
#X brgb 127 255 255;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 748 190 1061 501;
#P inlet 119 47 15 0;
#P inlet 41 48 15 0;
#P outlet 218 238 15 0;
#P outlet 41 238 15 0;
#P window setfont "Sans Serif" 9.;
#P flonum 41 217 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 66 237 48 9109513 horizontal;
#P comment 175 238 41 9109513 vertical;
#P comment 160 128 34 9109513 bottom;
#P comment 123 128 24 9109513 right;
#P comment 86 128 24 9109513 top;
#P comment 47 128 24 9109513 left;
#P window setfont "Fixedwidth Serif" 10.;
#P number 218 216 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 41 155 140 9240586 expr $i1+(($i2-$i1)/2);
#P newex 80 181 173 9240586 expr 239-($i1+(($i2-$i1)/2));
#P window setfont "Sans Serif" 9.;
#P number 158 102 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 119 102 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 80 102 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 41 102 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 119 69 38 9109513 unpack;
#P newex 41 70 38 9109513 unpack;
#P user panel 39 67 219 192;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P comment 40 28 137 9109513 Calculation for center of region;
#P connect 20 0 2 0;
#P connect 2 0 4 0;
#P connect 4 0 9 0;
#P connect 9 0 17 0;
#P connect 17 0 18 0;
#P fasten 2 1 5 0 74 95 85 95;
#P connect 5 0 8 0;
#P connect 21 0 3 0;
#P connect 3 0 6 0;
#P fasten 3 1 7 0 152 95 163 95;
#P fasten 6 0 9 1 124 126 176 126;
#P fasten 8 0 10 0 85 206 223 206;
#P connect 10 0 19 0;
#P fasten 7 0 8 1 163 121 248 121;
#P pop;
#P newobj 232 385 112 9109513 patcher calculation rouge;
#P flonum 393 613 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 232 610 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 377 731 52 9109513 bondo 2 1;
#P window setfont "Sans Serif" 14.;
#P comment 79 610 128 9109518 Create the lines;
#P window setfont "Sans Serif" 9.;
#P number 393 564 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 377 754 52 9109513 pack 0. 0.;
#P message 377 776 56 9109513 lineto $1 $2;
#P toggle 45 772 15 0;
#P message 45 792 76 9109513 depth_enable $1;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 543 481 182 9240586 jit.window etcha 5 41 645 501;
#B color 5;
#P user panel 538 475 193 32;
#X brgb 149 197 161;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 9.;
#P window linecount 3;
#P comment 139 703 62 9109513 turn antialiasing on/off;
#P toggle 139 749 15 0;
#P window linecount 2;
#P message 139 775 79 9109513 antialias $1 , blend_enable $1;
#P window linecount 1;
#P newex 254 727 22 9109513 t b;
#P newex 393 582 32 9109513 / 512.;
#P newex 232 579 32 9109513 / 512.;
#P user jit.fpsgui 69 740 60 9109513 0;
#P newex 25 712 55 9109513 t b erase b;
#P newex 254 826 158 9109513 jit.gl.sketch etcha @color 0. 0. 0. 1.;
#P newex 25 825 199 9109513 jit.gl.render etcha @erase_color 0.7 0.7 0.7 1.;
#P window setfont "Sans Serif" 18.;
#P message 230 694 61 9109522 reset;
#P window setfont "Sans Serif" 9.;
#P newex 393 539 67 9109513 expr ($f1-120);
#P newex 232 538 67 9109513 expr ($f1-160);
#P toggle 24 302 15 0;
#P newex 24 330 45 9109513 metro 33;
#P window setfont "Proportional Serif" 10.;
#P comment 316 345 96 9175050 Show Tracked Region;
#P comment 277 150 78 9175050 Track Color Red;
#P user jit.pwindow 235 333 42 32 0 0 0 0 1 0;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 236 311 68 9240586 jit.matrix;
#P newex 299 257 110 9240586 prepend srcdimend;
#P toggle 323 307 15 0;
#P objectname usesrcdim;
#P message 323 325 80 9240586 usesrcdim $1;
#P newex 246 282 122 9240586 prepend srcdimstart;
#P window linecount 3;
#P newex 246 170 116 9240586 jit.findbounds @min 0. 0.9 0. 0. @max 1. 1. 0. 0.;
#B color 5;
#P user jit.pwindow 16 199 122 92 0 0 0 0 1 0;
#P window linecount 1;
#P message 321 116 83 9240586 saturation $1;
#P flonum 321 98 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname saturation;
#P message 235 116 73 9240586 contrast $1;
#P flonum 235 98 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname contrast;
#P message 149 116 83 9240586 brightness $1;
#P flonum 149 98 35 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname brightness;
#P newex 17 140 68 9240586 jit.brcosa;
#P user panel 231 170 182 205;
#X brgb 127 255 255;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 144 91 265 46;
#X brgb 127 255 127;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 9.;
#P comment 144 76 188 9109513 settings for color-management;
#P number 232 561 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P user panel 10 602 426 252;
#X brgb 248 255 25;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 12.;
#P window linecount 2;
#P comment 135 29 152 9109516 read the movie "video_320_240_15.mov";
#P connect 68 0 69 0;
#P connect 51 1 55 0;
#P fasten 51 1 60 1 692 234 611 234 611 382 723 382;
#P connect 54 0 53 0;
#P connect 66 0 67 0;
#P fasten 51 0 60 0 636 234 611 234 611 382 622 382;
#P connect 51 0 52 0;
#P connect 63 0 70 0;
#P fasten 63 0 56 0 459 164 626 164;
#P fasten 63 0 51 0 459 164 636 164;
#P connect 56 0 57 0;
#P fasten 53 0 56 0 713 346 704 346 704 309 626 309;
#P fasten 55 0 56 0 689 280 626 280;
#P fasten 52 0 56 0 636 305 626 305;
#P connect 64 0 65 0;
#P connect 49 1 75 3;
#P fasten 49 1 76 3 339 461 500 461;
#P fasten 60 1 75 2 723 443 305 443;
#P fasten 60 1 76 2 723 443 466 443;
#P connect 73 0 6 0;
#P fasten 73 0 63 0 22 135 459 135;
#P fasten 69 0 63 0 763 137 459 137;
#P fasten 67 0 63 0 677 137 459 137;
#P fasten 65 0 63 0 591 137 459 137;
#P fasten 60 0 75 1 622 434 271 434;
#P fasten 60 0 76 1 622 434 432 434;
#P connect 46 1 43 1;
#P fasten 48 0 82 1 398 701 316 701;
#P fasten 48 0 46 1 398 701 424 701;
#P connect 33 0 48 0;
#P connect 44 0 33 0;
#P connect 26 0 44 0;
#P connect 78 0 26 0;
#P connect 76 0 78 0;
#P connect 49 0 75 0;
#P fasten 49 0 76 0 237 423 398 423;
#P connect 43 0 42 0;
#P connect 46 0 43 0;
#P fasten 47 0 81 1 237 685 296 685 296 746 276 746;
#P fasten 47 0 46 0 237 685 382 685;
#P connect 14 1 18 0;
#P fasten 14 1 49 1 304 232 226 232 226 380 339 380;
#P connect 17 0 16 0;
#P connect 11 0 12 0;
#P connect 82 0 79 1;
#P connect 34 0 81 0;
#P fasten 34 0 82 0 259 749 299 749;
#P fasten 42 0 29 0 382 820 259 820;
#P fasten 40 0 29 0 50 820 259 820;
#P fasten 35 0 29 0 144 820 259 820;
#P connect 80 0 29 0;
#P fasten 27 0 34 0 235 725 259 725;
#P fasten 27 0 29 0 235 820 259 820;
#P connect 79 0 80 0;
#P connect 81 0 79 0;
#P fasten 14 0 49 0 251 232 226 232 226 380 237 380;
#P connect 14 0 15 0;
#P connect 6 0 13 0;
#P fasten 6 0 19 0 22 161 241 161;
#P fasten 6 0 14 0 22 161 251 161;
#P connect 19 0 20 0;
#P fasten 15 0 19 0 251 303 241 303;
#P fasten 18 0 19 0 304 278 241 278;
#P fasten 16 0 19 0 328 344 319 344 319 307 241 307;
#P connect 9 0 10 0;
#P connect 32 0 47 0;
#P connect 2 0 32 0;
#P connect 25 0 2 0;
#P connect 77 0 25 0;
#P connect 75 0 77 0;
#P connect 7 0 8 0;
#P connect 36 0 35 0;
#P connect 30 2 31 0;
#P connect 41 0 40 0;
#P fasten 30 1 28 0 52 770 30 770;
#P connect 30 0 28 0;
#P fasten 23 0 73 0 29 359 8 359 8 71 22 71;
#P connect 23 0 30 0;
#P connect 24 0 23 0;
#P fasten 8 0 6 0 154 136 22 136;
#P fasten 10 0 6 0 240 136 22 136;
#P fasten 12 0 6 0 326 136 22 136;
#P connect 71 0 73 0;
#P connect 72 0 73 0;
#P connect 74 0 73 0;
#P window clipboard copycount 83;


April 28, 2007 | 1:05 pm

Hi,

I don’t quite understand what your final goal is. Do you want to see
one line drawn between one red and one blue blob? What do you want to
happen when one of them is not visible?

Anyway, concerning cpu optimizations:
- Get ridd of as much pwindow objects as you can(I would kill them
all, mwhaa ha ha ha).
- You probably do not need very high resolution input video to
analyze, I guess 80×60 would work. You could also add @unique 1
attribute to jit.qt.grab to avoid sending same frame to analysis.
- Use qmetro instead of metro(this is a religious statement, ignore
it if you’re atheist and want to burn in hell)
- Are you totally sure you need two brcosa objects?

CV jit is very recommended, and if you’re concerned about grayscale –
don’t worry, red and blue alone are grayscale anyway… open
jit.unpack help file, load your video in it and see what’s coming out.

best,
rev. nesa


April 28, 2007 | 2:09 pm

HI nesa!
thanks for your reply! Jeah, thats quite what I want. Red gives x,y-coordonates and also Blue. When I calculate them together, they should give me the coordinates of a new point between them. So when the two points are moved, also the new point moves and draws the line.
The two coloured points are always visible in my project! I just film a surface of 800*800mm, the points have a diameter of 40mm and are moved around on the surface.
With the resolution I will have to rest that high, I think, because the line should be very accurately defined (small turns, small displacement, a.s.o…)
Of course I will follow your instructions to optimize my CPU, thank you!
Do you have a proposition for which "cv.jit"-command will work best, maybe?
Greetings,
Johannes


April 30, 2007 | 3:27 pm

Hello J,

if the input video is what you’ve sent before, then maybe it will not
be necesarry to use cv.jit, but it is worth studying anyways.

I’ve posted example patch below, same concept like yours but with few
spices added, like smoothing the movement using msp(if input video is
at 15fps, rendered fps can be usually much higher and thus movements
can be much smoother), and I’ve also raised min threshold for
jit.findbounds, because blue dot is sometimes pinkish and therefore
present in red plane a bit(you can see that in preview window).

hth,
nesa

#P user ezdac~ 76 24 120 57 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 128 98 115 196617 rendering fps;
#P comment 257 200 115 196617 video input fps;
#P user jit.fpsgui 193 192 60 196617 0;
#N vpatcher 30 89 742 293;
#P window setfont "Sans Serif" 9.;
#P newex 49 83 83 196617 prepend position;
#P newex 49 152 339 196617 jit.gl.gridshape foo @shape plane @scale
0.05 0.05 0.1 @color 0. 1. 0. 1.;
#P inlet 49 23 15 0;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P pop;
#P newobj 407 455 48 196617 p square;
#N vpatcher 30 89 648 305;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 402 128 153 196617 to jit.gl.render;
#P comment 402 112 184 196617 see screentoworld message;
#P newex 50 111 183 196617 pack 0. 0.;
#P newex 223 85 170 196617 scale 0. 240. 0.828428 -0.828428;
#P newex 50 85 158 196617 scale 0. 320. -1.10457 1.10457;
#P newex 50 50 95 196617 unpack 0. 0.;
#P inlet 50 30 15 0;
#P outlet 50 133 15 0;
#P window linecount 0;
#P comment 402 80 153 196617 this maps pixel 320×240 to opengl
coordinates;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 1 0;
#P connect 3 1 5 0;
#P connect 5 0 6 1;
#P pop;
#P newobj 407 412 133 196617 p screentoworld(320×240);
#N vpatcher 30 89 581 469;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 90 305 161 196617 pack 0. 0.;
#P newex 90 278 55 196617 snapshot~;
#P newex 178 236 30 196617 t b b;
#P newex 90 182 66 196617 pack 0. 180.;
#P newex 90 209 32 196617 line~;
#P window linecount 0;
#P newex 90 127 64 196617 unpack 0. 0.;
#P window linecount 1;
#P newex 241 274 55 196617 snapshot~;
#P newex 178 213 31 196617 r r.b;
#P window linecount 0;
#P newex 90 50 317 196617 t l b b;
#N vpatcher 525 182 715 430;
#N comlet interval in ms is reported here;
#P outlet 66 173 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 96 104 46 196617 cpuclock;
#P newex 66 143 27 196617 – 0.;
#P newex 48 104 46 196617 cpuclock;
#N comlet bang stops timing and reports interval;
#P inlet 96 58 15 0;
#N comlet bang starts timing interval;
#P inlet 48 58 15 0;
#P connect 0 0 2 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 2 0 3 1;
#P connect 1 0 4 0;
#P pop;
#P newobj 297 121 55 196617 p cputimer;
#P newex 241 178 66 196617 pack 0. 180.;
#P newex 241 205 32 196617 line~;
#P inlet 90 30 15 0;
#P outlet 90 334 15 0;
#P connect 1 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P connect 9 0 12 0;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 0 0;
#P connect 4 0 10 1;
#P connect 6 0 11 0;
#P connect 8 1 3 0;
#P connect 3 0 2 0;
#P connect 2 0 7 0;
#P connect 11 1 7 0;
#P connect 7 0 13 1;
#P connect 5 1 4 0;
#P connect 4 0 3 1;
#P connect 5 2 4 1;
#P pop;
#P newobj 407 433 73 196617 p xy-smooth~;
#P newex 407 386 122 196617 vexpr $f1+($f2-$f1)/2.;
#P comment 253 420 110 196617 smooth the animation;
#P comment 25 389 149 196617 convert coordinates to opengl:;
#P comment 69 360 106 196617 find center of blob:;
#N vpatcher 30 89 520 238;
#P window setfont "Sans Serif" 9.;
#P newex 50 50 83 196617 prepend position;
#P newex 50 73 330 196617 jit.gl.gridshape foo @shape circle @scale
0.1 0.1 0.1 @color 0. 0. 1. 1.;
#P inlet 50 30 15 0;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P pop;
#P newobj 597 449 44 196617 p circle;
#N vpatcher 30 89 648 305;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 402 128 153 196617 to jit.gl.render;
#P comment 402 112 184 196617 see screentoworld message;
#P newex 50 111 183 196617 pack 0. 0.;
#P newex 223 85 170 196617 scale 0. 240. 0.828428 -0.828428;
#P newex 50 85 158 196617 scale 0. 320. -1.10457 1.10457;
#P newex 50 50 95 196617 unpack 0. 0.;
#P inlet 50 30 15 0;
#P outlet 50 133 15 0;
#P window linecount 0;
#P comment 402 80 153 196617 this maps pixel 320×240 to opengl
coordinates;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 1 0;
#P connect 3 1 5 0;
#P connect 5 0 6 1;
#P pop;
#P newobj 597 386 133 196617 p screentoworld(320×240);
#P newex 597 357 122 196617 vexpr $f1+($f2-$f1)/2.;
#P newex 597 306 158 196617 jit.findbounds @min 0.9 @max 1.;
#N vpatcher 30 89 581 469;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 90 305 161 196617 pack 0. 0.;
#P newex 90 278 55 196617 snapshot~;
#P newex 178 236 30 196617 t b b;
#P newex 90 182 66 196617 pack 0. 180.;
#P newex 90 209 32 196617 line~;
#P window linecount 0;
#P newex 90 127 64 196617 unpack 0. 0.;
#P window linecount 1;
#P newex 241 274 55 196617 snapshot~;
#P newex 178 213 31 196617 r r.b;
#P window linecount 0;
#P newex 90 50 317 196617 t l b b;
#N vpatcher 525 182 715 430;
#N comlet interval in ms is reported here;
#P outlet 66 173 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 96 104 46 196617 cpuclock;
#P newex 66 143 27 196617 – 0.;
#P newex 48 104 46 196617 cpuclock;
#N comlet bang stops timing and reports interval;
#P inlet 96 58 15 0;
#N comlet bang starts timing interval;
#P inlet 48 58 15 0;
#P connect 0 0 2 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 2 0 3 1;
#P connect 1 0 4 0;
#P pop;
#P newobj 297 121 55 196617 p cputimer;
#P newex 241 178 66 196617 pack 0. 180.;
#P newex 241 205 32 196617 line~;
#P inlet 90 30 15 0;
#P outlet 90 334 15 0;
#P connect 1 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P connect 9 0 12 0;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 0 0;
#P connect 4 0 10 1;
#P connect 6 0 11 0;
#P connect 8 1 3 0;
#P connect 3 0 2 0;
#P connect 2 0 7 0;
#P connect 11 1 7 0;
#P connect 7 0 13 1;
#P connect 5 1 4 0;
#P connect 4 0 3 1;
#P connect 5 2 4 1;
#P pop;
#P newobj 597 421 73 196617 p xy-smooth~;
#N vpatcher 30 89 520 238;
#P window setfont "Sans Serif" 9.;
#P newex 50 50 83 196617 prepend position;
#P newex 50 73 336 196617 jit.gl.gridshape foo @shape circle @scale
0.1 0.1 0.1 @color 1. 0. 0. 1.;
#P inlet 50 30 15 0;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P pop;
#P newobj 175 446 44 196617 p circle;
#N vpatcher 30 89 339 254;
#P window setfont "Sans Serif" 9.;
#P comment 50 94 141 196617 coordinates to avoid ‘jumps’);
#P comment 50 79 207 196617 is too big , you could use last known good;
#P comment 50 65 186 196617 f.e. if there’s nothing found , or rect;
#P comment 50 50 186 196617 add some special cases checking:;
#P pop;
#P newobj 192 328 65 196617 p suggestion;
#N vpatcher 30 89 648 305;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 402 128 153 196617 to jit.gl.render;
#P comment 402 112 184 196617 see screentoworld message;
#P newex 50 111 183 196617 pack 0. 0.;
#P newex 223 85 170 196617 scale 0. 240. 0.828428 -0.828428;
#P newex 50 85 158 196617 scale 0. 320. -1.10457 1.10457;
#P newex 50 50 95 196617 unpack 0. 0.;
#P inlet 50 30 15 0;
#P outlet 50 133 15 0;
#P window linecount 0;
#P comment 402 80 153 196617 this maps pixel 320×240 to opengl
coordinates;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 1 0;
#P connect 3 1 5 0;
#P connect 5 0 6 1;
#P pop;
#P newobj 175 386 133 196617 p screentoworld(320×240);
#P newex 175 357 122 196617 vexpr $f1+($f2-$f1)/2.;
#P newex 175 303 158 196617 jit.findbounds @min 0.9 @max 1.;
#P newex 193 272 193 196617 jit.window preview @sync 0 @floating 1;
#P newex 476 149 62 196617 cv.jit.track;
#P user jit.fpsgui 64 90 60 196617 0;
#P newex 175 228 123 196617 jit.unpack 2 @offset 1 3;
#P newex 52 225 82 196617 jit.gl.render foo;
#P newex 5 272 170 196617 jit.window foo @sync 0 @floating 1;
#P newex 52 121 134 196617 t b b erase b;
#P message 200 138 145 196617 read video_320_240_15.mov;
#P newex 175 164 111 196617 jit.qt.movie @unique 1;
#P toggle 52 33 15 0;
#P newex 52 63 50 196617 qmetro 5;
#P newex 93 164 34 196617 s r.b;
#N vpatcher 30 89 581 469;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 90 305 161 196617 pack 0. 0.;
#P newex 90 278 55 196617 snapshot~;
#P newex 178 236 30 196617 t b b;
#P newex 90 182 66 196617 pack 0. 180.;
#P newex 90 209 32 196617 line~;
#P window linecount 0;
#P newex 90 127 64 196617 unpack 0. 0.;
#P window linecount 1;
#P newex 241 274 55 196617 snapshot~;
#P newex 178 213 31 196617 r r.b;
#P window linecount 0;
#P newex 90 50 317 196617 t l b b;
#N vpatcher 525 182 715 430;
#N comlet interval in ms is reported here;
#P outlet 66 173 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 96 104 46 196617 cpuclock;
#P newex 66 143 27 196617 – 0.;
#P newex 48 104 46 196617 cpuclock;
#N comlet bang stops timing and reports interval;
#P inlet 96 58 15 0;
#N comlet bang starts timing interval;
#P inlet 48 58 15 0;
#P connect 0 0 2 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 2 0 3 1;
#P connect 1 0 4 0;
#P pop;
#P newobj 297 121 55 196617 p cputimer;
#P newex 241 178 66 196617 pack 0. 180.;
#P newex 241 205 32 196617 line~;
#P inlet 90 30 15 0;
#P outlet 90 334 15 0;
#P connect 1 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P connect 11 0 12 0;
#P connect 9 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 0 0;
#P connect 4 0 10 1;
#P connect 6 0 11 0;
#P connect 8 1 3 0;
#P connect 3 0 2 0;
#P connect 11 1 7 0;
#P connect 2 0 7 0;
#P connect 7 0 13 1;
#P connect 5 1 4 0;
#P connect 4 0 3 1;
#P connect 5 2 4 1;
#P pop;
#P newobj 175 418 73 196617 p xy-smooth~;
#P comment 302 231 115 196617 get Red and Blue planes;
#P comment 334 305 162 196617 find only ‘very red’ pixels;
#P connect 5 0 4 0;
#P connect 4 0 8 0;
#P fasten 8 2 10 0 139 191 57 191;
#P fasten 8 0 10 0 57 201 57 201;
#P connect 4 0 12 0;
#P connect 8 1 3 0;
#P connect 7 0 6 0;
#P connect 8 3 6 0;
#P connect 6 0 11 0;
#P connect 11 0 15 0;
#P connect 15 0 16 0;
#P connect 16 0 17 0;
#P connect 17 0 2 0;
#P connect 2 0 19 0;
#P fasten 6 0 32 0 180 187;
#P connect 11 0 14 0;
#P connect 15 1 16 1;
#P fasten 16 0 28 0 180 380 412 380;
#P connect 28 0 30 0;
#P connect 30 0 29 0;
#P connect 29 0 31 0;
#P fasten 22 0 28 1 602 380 524 380;
#P fasten 11 1 21 0 236 259 602 259;
#P connect 21 0 22 0;
#P connect 22 0 23 0;
#P connect 23 0 20 0;
#P connect 20 0 24 0;
#P connect 21 1 22 1;
#P window clipboard copycount 36;


April 30, 2007 | 9:52 pm

Hi Nesa!
Thanks a lot for your patch! Haha, the line is getting more and more clear and perfect!! Great, really!
I go on working now on the final patch, but for the moment here is your patch, a little bit changed to draw the line.
Changes:
* the line attribute
* "gllinewidth" for a "fatter" line
* "antialias", smooths also quite a bit
* and I multiplied the calculation of "xy_smooth~" in the subpatch. With that I am not quite sure, if finally that won’t be too much, but we will see…

So far, so good. I will see the next days, if this will give the result I need…
Thanks again, Nesa! Wish you all the best!
Johannes

#P toggle 312 554 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P message 312 580 79 9109513 antialias $1 , blend_enable $1;
#P flonum 616 526 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 615 559 63 9109513 gllinewidth $1;
#P newex 454 546 27 9109513 f;
#P newex 414 546 27 9109513 f;
#P message 414 592 66 9109513 moveto $1 $2;
#P newex 414 568 50 9109513 pack 0. 0.;
#P newex 537 524 52 9109513 bondo 2 1;
#P newex 537 547 52 9109513 pack 0. 0.;
#P message 537 569 56 9109513 lineto $1 $2;
#P newex 414 520 22 9109513 t b;
#P newex 416 619 149 9109513 jit.gl.sketch foo @color 0. 0. 0. 1.;
#P window setfont "Sans Serif" 18.;
#P message 390 487 61 9109522 reset;
#P window setfont "Sans Serif" 9.;
#P flonum 518 498 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 468 498 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 337 113 26 9109513 read;
#P user ezdac~ 142 22 186 55 0;
#P comment 188 105 115 9109513 rendering fps;
#P comment 317 207 115 9109513 video input fps;
#P user jit.fpsgui 253 199 60 9109513 0;
#N vpatcher 562 34 1180 250;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 402 128 153 9109513 to jit.gl.render;
#P comment 402 112 184 9109513 see screentoworld message;
#P newex 50 111 183 9109513 pack 0. 0.;
#P newex 223 85 170 9109513 scale 0. 240. 0.828428 -0.828428;
#P newex 50 85 158 9109513 scale 0. 320. -1.10457 1.10457;
#P newex 50 50 95 9109513 unpack 0. 0.;
#P inlet 50 30 15 0;
#P outlet 50 133 15 0;
#P window linecount 0;
#P comment 402 80 153 9109513 this maps pixel 320×240 to opengl coordinates;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 1 0;
#P connect 3 1 5 0;
#P connect 5 0 6 1;
#P pop;
#P newobj 467 419 133 9109513 p screentoworld(320×240);
#N vpatcher 1494 252 2045 632;
#P outlet 241 329 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 90 278 55 9109513 snapshot~;
#P newex 178 236 30 9109513 t b b;
#P newex 90 182 60 9109513 pack 0. 180.;
#P newex 90 209 32 9109513 line~;
#P window linecount 0;
#P newex 90 127 64 9109513 unpack 0. 0.;
#P window linecount 1;
#P newex 241 274 55 9109513 snapshot~;
#P newex 178 213 31 9109513 r r.b;
#P window linecount 0;
#P newex 90 50 317 9109513 t l b b;
#N vpatcher 1565 92 1755 340;
#P window setfont "Sans Serif" 9.;
#P newex 64 174 27 9109513 * 20;
#N comlet interval in ms is reported here;
#P outlet 66 203 15 0;
#P newex 96 104 46 9109513 cpuclock;
#P newex 66 143 27 9109513 – 0.;
#P newex 48 104 46 9109513 cpuclock;
#N comlet bang stops timing and reports interval;
#P inlet 96 58 15 0;
#N comlet bang starts timing interval;
#P inlet 48 58 15 0;
#P connect 0 0 2 0;
#P connect 3 0 6 0;
#P connect 4 0 3 0;
#P connect 6 0 5 0;
#P connect 2 0 3 1;
#P connect 1 0 4 0;
#P pop;
#P newobj 297 121 55 9109513 p cputimer;
#P newex 241 178 60 9109513 pack 0. 180.;
#P newex 241 205 32 9109513 line~;
#P inlet 90 30 15 0;
#P outlet 90 334 15 0;
#P connect 1 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P connect 9 0 12 0;
#P connect 11 0 12 0;
#P connect 12 0 0 0;
#P connect 4 0 10 1;
#P connect 6 0 11 0;
#P connect 8 1 3 0;
#P connect 3 0 2 0;
#P connect 2 0 7 0;
#P connect 11 1 7 0;
#P connect 7 0 13 0;
#P connect 4 0 3 1;
#P connect 5 1 4 0;
#P connect 5 2 4 1;
#P pop;
#P newobj 467 440 73 9109513 p xy-smooth~;
#P newex 467 393 122 9109513 vexpr $f1+($f2-$f1)/2.;
#P comment 313 427 110 9109513 smooth the animation;
#P comment 85 396 149 9109513 convert coordinates to opengl:;
#P comment 129 367 106 9109513 find center of blob:;
#N vpatcher 1337 117 1827 266;
#P window setfont "Sans Serif" 9.;
#P newex 50 50 83 9109513 prepend position;
#P newex 50 73 330 9109513 jit.gl.gridshape foo @shape circle @scale 0.1 0.1 0.1 @color 0. 0. 1. 1.;
#P inlet 50 30 15 0;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P pop;
#P newobj 657 456 44 9109513 p circle;
#N vpatcher 585 473 1203 689;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 402 128 153 9109513 to jit.gl.render;
#P comment 402 112 184 9109513 see screentoworld message;
#P newex 50 111 183 9109513 pack 0. 0.;
#P newex 223 85 170 9109513 scale 0. 240. 0.828428 -0.828428;
#P newex 50 85 158 9109513 scale 0. 320. -1.10457 1.10457;
#P newex 50 50 95 9109513 unpack 0. 0.;
#P inlet 50 30 15 0;
#P outlet 50 133 15 0;
#P window linecount 0;
#P comment 402 80 153 9109513 this maps pixel 320×240 to opengl coordinates;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 1 0;
#P connect 3 1 5 0;
#P connect 5 0 6 1;
#P pop;
#P newobj 657 393 133 9109513 p screentoworld(320×240);
#P newex 657 364 122 9109513 vexpr $f1+($f2-$f1)/2.;
#P newex 657 313 158 9109513 jit.findbounds @min 0.9 @max 1.;
#N vpatcher 1519 198 2070 578;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 90 305 161 9109513 pack 0. 0.;
#P newex 90 278 55 9109513 snapshot~;
#P newex 178 236 30 9109513 t b b;
#P newex 90 182 66 9109513 pack 0. 180.;
#P newex 90 209 32 9109513 line~;
#P window linecount 0;
#P newex 90 127 64 9109513 unpack 0. 0.;
#P window linecount 1;
#P newex 241 274 55 9109513 snapshot~;
#P newex 178 213 31 9109513 r r.b;
#P window linecount 0;
#P newex 90 50 317 9109513 t l b b;
#N vpatcher 525 182 715 430;
#N comlet interval in ms is reported here;
#P outlet 66 173 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 96 104 46 9109513 cpuclock;
#P newex 66 143 27 9109513 – 0.;
#P newex 48 104 46 9109513 cpuclock;
#N comlet bang stops timing and reports interval;
#P inlet 96 58 15 0;
#N comlet bang starts timing interval;
#P inlet 48 58 15 0;
#P connect 0 0 2 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 2 0 3 1;
#P connect 1 0 4 0;
#P pop;
#P newobj 297 121 55 9109513 p cputimer;
#P newex 241 178 66 9109513 pack 0. 180.;
#P newex 241 205 32 9109513 line~;
#P inlet 90 30 15 0;
#P outlet 90 334 15 0;
#P connect 1 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P connect 9 0 12 0;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 0 0;
#P connect 4 0 10 1;
#P connect 6 0 11 0;
#P connect 8 1 3 0;
#P connect 3 0 2 0;
#P connect 2 0 7 0;
#P connect 11 1 7 0;
#P connect 7 0 13 1;
#P connect 5 1 4 0;
#P connect 4 0 3 1;
#P connect 5 2 4 1;
#P pop;
#P newobj 657 428 73 9109513 p xy-smooth~;
#N vpatcher 510 58 1000 207;
#P window setfont "Sans Serif" 9.;
#P newex 50 50 83 9109513 prepend position;
#P newex 50 73 336 9109513 jit.gl.gridshape foo @shape circle @scale 0.1 0.1 0.1 @color 1. 0. 0. 1.;
#P inlet 50 30 15 0;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P pop;
#P newobj 235 453 44 9109513 p circle;
#N vpatcher 628 238 937 403;
#P window setfont "Sans Serif" 9.;
#P comment 50 94 141 9109513 coordinates to avoid ‘jumps’);
#P comment 50 79 207 9109513 is too big , you could use last known good;
#P comment 50 65 186 9109513 f.e. if there’s nothing found , or rect;
#P comment 50 50 186 9109513 add some special cases checking:;
#P pop;
#P newobj 252 335 65 9109513 p suggestion;
#N vpatcher 577 251 1195 451;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 402 128 153 9109513 to jit.gl.render;
#P comment 402 112 184 9109513 see screentoworld message;
#P newex 50 111 183 9109513 pack 0. 0.;
#P newex 223 85 170 9109513 scale 0. 240. 0.828428 -0.828428;
#P newex 50 85 158 9109513 scale 0. 320. -1.10457 1.10457;
#P newex 50 50 95 9109513 unpack 0. 0.;
#P inlet 50 30 15 0;
#P outlet 50 133 15 0;
#P window linecount 0;
#P comment 402 80 153 9109513 this maps pixel 320×240 to opengl coordinates;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 1 0;
#P connect 3 1 5 0;
#P connect 5 0 6 1;
#P pop;
#P newobj 235 393 133 9109513 p screentoworld(320×240);
#P newex 235 364 122 9109513 vexpr $f1+($f2-$f1)/2.;
#P newex 235 310 158 9109513 jit.findbounds @min 0.9 @max 1.;
#P newex 253 279 193 9109513 jit.window preview @sync 0 @floating 1;
#P newex 536 156 62 9109513 cv.jit.track;
#P user jit.fpsgui 124 97 60 9109513 0;
#P newex 235 235 123 9109513 jit.unpack 2 @offset 1 3;
#P newex 112 232 82 9109513 jit.gl.render foo;
#P newex 65 279 170 9109513 jit.window foo @sync 0 @floating 1;
#P newex 112 128 134 9109513 t b b erase b;
#P message 260 145 145 9109513 read video_320_240_15.mov;
#P newex 235 171 111 9109513 jit.qt.movie @unique 1;
#P toggle 112 40 15 0;
#P newex 112 70 50 9109513 qmetro 5;
#P newex 153 171 34 9109513 s r.b;
#N vpatcher 1681 208 2232 588;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 90 305 161 9109513 pack 0. 0.;
#P newex 90 278 55 9109513 snapshot~;
#P newex 178 236 30 9109513 t b b;
#P newex 90 182 66 9109513 pack 0. 180.;
#P newex 90 209 32 9109513 line~;
#P window linecount 0;
#P newex 90 127 64 9109513 unpack 0. 0.;
#P window linecount 1;
#P newex 241 274 55 9109513 snapshot~;
#P newex 178 213 31 9109513 r r.b;
#P window linecount 0;
#P newex 90 50 317 9109513 t l b b;
#N vpatcher 708 44 898 292;
#N comlet interval in ms is reported here;
#P outlet 66 173 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 96 104 46 9109513 cpuclock;
#P newex 66 143 27 9109513 – 0.;
#P newex 48 104 46 9109513 cpuclock;
#N comlet bang stops timing and reports interval;
#P inlet 96 58 15 0;
#N comlet bang starts timing interval;
#P inlet 48 58 15 0;
#P connect 0 0 2 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 2 0 3 1;
#P connect 1 0 4 0;
#P pop;
#P newobj 297 121 55 9109513 p cputimer;
#P newex 241 178 66 9109513 pack 0. 180.;
#P newex 241 205 32 9109513 line~;
#P inlet 90 30 15 0;
#P outlet 90 334 15 0;
#P connect 1 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P connect 11 0 12 0;
#P connect 9 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 0 0;
#P connect 4 0 10 1;
#P connect 6 0 11 0;
#P connect 8 1 3 0;
#P connect 3 0 2 0;
#P connect 11 1 7 0;
#P connect 2 0 7 0;
#P connect 7 0 13 1;
#P connect 5 1 4 0;
#P connect 4 0 3 1;
#P connect 5 2 4 1;
#P pop;
#P newobj 235 425 73 9109513 p xy-smooth~;
#P comment 362 238 115 9109513 get Red and Blue planes;
#P comment 394 312 162 9109513 find only ‘very red’ pixels;
#P connect 5 0 4 0;
#P connect 4 0 8 0;
#P fasten 8 2 10 0 199 198 117 198;
#P fasten 8 0 10 0 117 208 117 208;
#P connect 4 0 12 0;
#P connect 8 1 3 0;
#P connect 7 0 6 0;
#P connect 8 3 6 0;
#P connect 35 0 6 0;
#P connect 6 0 11 0;
#P connect 11 0 15 0;
#P connect 15 0 16 0;
#P connect 16 0 17 0;
#P connect 17 0 2 0;
#P connect 2 0 19 0;
#P fasten 6 0 31 0 240 194;
#P connect 11 0 14 0;
#P connect 51 0 50 0;
#P connect 15 1 16 1;
#P fasten 38 0 40 0 395 518 419 518;
#P connect 40 0 46 0;
#P connect 46 0 44 0;
#P connect 44 0 45 0;
#P connect 50 0 39 0;
#P connect 48 0 39 0;
#P fasten 38 0 39 0 395 613 421 613;
#P fasten 41 0 39 0 542 613 421 613;
#P connect 45 0 39 0;
#P connect 36 0 46 1;
#P fasten 40 0 47 0 419 542 459 542;
#P connect 47 0 44 1;
#P fasten 16 0 28 0 240 387 472 387;
#P connect 28 0 30 0;
#P connect 30 0 29 0;
#P connect 29 0 36 0;
#P connect 37 0 47 1;
#P connect 29 1 37 0;
#P connect 36 0 43 0;
#P connect 43 0 42 0;
#P connect 42 0 41 0;
#P fasten 22 0 28 1 662 387 584 387;
#P connect 37 0 43 1;
#P connect 43 1 42 1;
#P connect 49 0 48 0;
#P fasten 11 1 21 0 296 266 662 266;
#P connect 21 0 22 0;
#P connect 22 0 23 0;
#P connect 23 0 20 0;
#P connect 20 0 24 0;
#P connect 21 1 22 1;
#P window clipboard copycount 52;


May 3, 2007 | 5:53 pm

hello,

Sorry for adding to the confusion, but did you check the frame-rate
with my patch drawing the lines? It drops significantly, very fast,
because with the (time)smoothing technique you get more lines drawn
in less time, not neceseraly resulting in smoother line.
For example, with your last modification, you could be drawing very
short lines from (1.0001 1.0001)->(1.0002 1.0002)->(1.0003 1.003),
all up to (2. 2), instead of drawing one line from 1.0001 1.0001 to
2. 2. So you might be needing some kind of data-reduction technique.
Or, even better, drop xy-smooth~ from line drawing chain.

If you have time, you should check js_jitterspline-example.pat in
jitter examples/render folder and see if drawing curves instead of
straight lines might be better for you.

The patch pasted below shows one method of data reduction, something
like ‘if the current point of line is very close to the previous,
don’t draw it’.

best,
nesa

p.s.. After all this shooting in the dark, I can feel the trouble
computer feels trying to do ‘vision’, without knowing anything about
what’s it looking at…

#P window setfont "Sans Serif" 9.;
#P flonum 561 465 46 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P comment 665 585 63 196617 reduction;
#P comment 665 572 63 196617 after;
#P comment 596 585 63 196617 reduction;
#N vpatcher 30 89 268 276;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 156 61 21 196617 t 0;
#P window linecount 1;
#P newex 50 45 32 196617 sel 1;
#P newex 50 78 20 196617 t b;
#N counter;
#X flags 0 0;
#P newobj 50 100 66 196617 counter;
#N counter;
#X flags 0 0;
#P newobj 120 101 66 196617 counter;
#P inlet 156 36 15 0;
#P inlet 50 25 15 0;
#P outlet 120 123 15 0;
#P outlet 50 122 15 0;
#P connect 2 0 7 0;
#P connect 7 1 6 0;
#P connect 7 0 6 0;
#P connect 6 0 5 0;
#P connect 5 0 0 0;
#P connect 8 0 5 2;
#P fasten 7 0 4 0 55 70 125 70;
#P connect 4 0 1 0;
#P connect 8 0 4 2;
#P connect 3 0 8 0;
#P pop;
#P newobj 595 523 80 196617 p counters;
#P number 595 554 65 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 665 555 65 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 117 181 668 561;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 90 305 161 196617 pack 0. 0.;
#P newex 90 278 55 196617 snapshot~;
#P newex 178 236 30 196617 t b b;
#P newex 90 182 66 196617 pack 0. 180.;
#P newex 90 209 32 196617 line~;
#P window linecount 0;
#P newex 90 127 64 196617 unpack 0. 0.;
#P window linecount 1;
#P newex 241 274 55 196617 snapshot~;
#P newex 178 213 31 196617 r r.b;
#P window linecount 0;
#P newex 90 50 317 196617 t l b b;
#N vpatcher 708 44 898 292;
#N comlet interval in ms is reported here;
#P outlet 66 173 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 96 104 46 196617 cpuclock;
#P newex 66 143 27 196617 – 0.;
#P newex 48 104 46 196617 cpuclock;
#N comlet bang stops timing and reports interval;
#P inlet 96 58 15 0;
#N comlet bang starts timing interval;
#P inlet 48 58 15 0;
#P connect 0 0 2 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 2 0 3 1;
#P connect 1 0 4 0;
#P pop;
#P newobj 297 121 55 196617 p cputimer;
#P newex 241 178 66 196617 pack 0. 180.;
#P newex 241 205 32 196617 line~;
#P inlet 90 30 15 0;
#P outlet 90 334 15 0;
#P connect 1 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P connect 9 0 12 0;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 0 0;
#P connect 4 0 10 1;
#P connect 6 0 11 0;
#P connect 8 1 3 0;
#P connect 3 0 2 0;
#P connect 2 0 7 0;
#P connect 11 1 7 0;
#P connect 7 0 13 1;
#P connect 5 1 4 0;
#P connect 4 0 3 1;
#P connect 5 2 4 1;
#P pop;
#P newobj 657 424 73 196617 p xy-smooth~;
#N vpatcher 30 89 630 489;
#P window setfont "Sans Serif" 9.;
#P flonum 393 131 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 393 104 40 196617 / 100.;
#N comlet ‘(im)precision’;
#P inlet 393 78 15 0;
#P window linecount 1;
#P comment 202 218 290 196617 generate new line if x/y value crosses
this threshold;
#N vpatcher 30 89 173 261;
#P window setfont "Sans Serif" 9.;
#P newex 50 95 37 196617 abs 0.;
#P newex 50 50 27 196617 t f f;
#P newex 50 73 27 196617 – 0.;
#P inlet 50 30 15 0;
#P outlet 50 117 15 0;
#P connect 1 0 3 0;
#P connect 3 1 2 0;
#P connect 2 0 4 0;
#P connect 4 0 0 0;
#P connect 3 0 2 1;
#P pop;
#P newobj 59 90 82 196617 p abs.difference;
#P window linecount 0;
#N vpatcher 30 89 173 261;
#P window setfont "Sans Serif" 9.;
#P newex 50 95 37 196617 abs 0.;
#P newex 50 50 27 196617 t f f;
#P newex 50 73 27 196617 – 0.;
#P inlet 50 30 15 0;
#P outlet 50 117 15 0;
#P connect 1 0 3 0;
#P connect 3 1 2 0;
#P connect 2 0 4 0;
#P connect 4 0 0 0;
#P connect 3 0 2 1;
#P pop;
#P newobj 159 90 82 196617 p abs.difference;
#P window linecount 1;
#P comment 199 257 67 196617 y changed;
#P comment 33 266 63 196617 x changed;
#P toggle 183 256 15 0;
#P toggle 16 265 15 0;
#P toggle 140 332 36 0;
#P newex 105 279 27 196617 ||;
#P newex 59 219 39 196617 > 0.01;
#P flonum 82 131 80 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 159 216 39 196617 > 0.01;
#P flonum 182 128 80 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 59 60 110 196617 unpack 0. 0.;
#N comlet x y pair;
#P inlet 59 30 15 0;
#N comlet enough change detected(1/0);
#P outlet 105 367 15 0;
#P window linecount 0;
#P comment 134 281 89 196617 x OR y changed;
#P connect 7 0 10 0;
#P connect 2 0 3 0;
#P connect 3 0 15 0;
#P connect 15 0 7 0;
#P connect 15 0 6 0;
#P connect 19 0 7 1;
#P connect 7 0 8 0;
#P connect 8 0 1 0;
#P connect 5 0 8 1;
#P connect 8 0 9 0;
#P connect 3 1 14 0;
#P connect 14 0 5 0;
#P connect 14 0 4 0;
#P connect 5 0 11 0;
#P connect 19 0 5 1;
#P connect 17 0 18 0;
#P connect 18 0 19 0;
#P pop;
#P newobj 512 486 59 196617 p reduction;
#P newex 495 458 27 196617 t l l;
#P newex 476 514 29 196617 gate;
#P toggle 312 554 15 0;
#P window linecount 2;
#P message 312 580 79 196617 antialias $1 , blend_enable $1;
#P flonum 219 573 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 219 593 82 196617 gllinewidth $1;
#P message 476 538 70 196617 lineto $1 $2;
#P newex 416 619 168 196617 jit.gl.sketch foo @color 0. 0. 0. 1.;
#P window setfont "Sans Serif" 18.;
#P message 771 484 61 196626 reset;
#P window setfont "Sans Serif" 9.;
#P message 254 126 26 196617 read;
#P user ezdac~ 142 22 186 55 0;
#P comment 188 105 115 196617 rendering fps;
#P comment 317 207 115 196617 video input fps;
#P user jit.fpsgui 253 199 60 196617 0;
#N vpatcher 562 34 1180 250;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 402 128 153 196617 to jit.gl.render;
#P comment 402 112 184 196617 see screentoworld message;
#P newex 50 111 183 196617 pack 0. 0.;
#P newex 223 85 170 196617 scale 0. 240. 0.828428 -0.828428;
#P newex 50 85 158 196617 scale 0. 320. -1.10457 1.10457;
#P newex 50 50 95 196617 unpack 0. 0.;
#P inlet 50 30 15 0;
#P outlet 50 133 15 0;
#P window linecount 0;
#P comment 402 80 153 196617 this maps pixel 320×240 to opengl
coordinates;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 1 0;
#P connect 3 1 5 0;
#P connect 5 0 6 1;
#P pop;
#P newobj 467 419 133 196617 p screentoworld(320×240);
#P newex 467 393 122 196617 vexpr $f1+($f2-$f1)/2.;
#P comment 313 427 110 196617 smooth the animation;
#P comment 85 396 149 196617 convert coordinates to opengl:;
#P comment 129 367 106 196617 find center of blob:;
#N vpatcher 1230 117 1720 266;
#P window setfont "Sans Serif" 9.;
#P newex 50 50 83 196617 prepend position;
#P newex 50 73 330 196617 jit.gl.gridshape foo @shape circle @scale
0.1 0.1 0.1 @color 0. 0. 1. 1.;
#P inlet 50 30 15 0;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P pop;
#P newobj 657 447 44 196617 p circle;
#N vpatcher 585 473 1203 689;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 402 128 153 196617 to jit.gl.render;
#P comment 402 112 184 196617 see screentoworld message;
#P newex 50 111 183 196617 pack 0. 0.;
#P newex 223 85 170 196617 scale 0. 240. 0.828428 -0.828428;
#P newex 50 85 158 196617 scale 0. 320. -1.10457 1.10457;
#P newex 50 50 95 196617 unpack 0. 0.;
#P inlet 50 30 15 0;
#P outlet 50 133 15 0;
#P window linecount 0;
#P comment 402 80 153 196617 this maps pixel 320×240 to opengl
coordinates;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 1 0;
#P connect 3 1 5 0;
#P connect 5 0 6 1;
#P pop;
#P newobj 657 393 133 196617 p screentoworld(320×240);
#P newex 657 364 122 196617 vexpr $f1+($f2-$f1)/2.;
#P newex 657 313 158 196617 jit.findbounds @min 0.9 @max 1.;
#N vpatcher 510 58 1000 207;
#P window setfont "Sans Serif" 9.;
#P newex 50 50 83 196617 prepend position;
#P newex 50 73 336 196617 jit.gl.gridshape foo @shape circle @scale
0.1 0.1 0.1 @color 1. 0. 0. 1.;
#P inlet 50 30 15 0;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P pop;
#P newobj 235 453 44 196617 p circle;
#N vpatcher 628 238 937 403;
#P window setfont "Sans Serif" 9.;
#P comment 50 94 141 196617 coordinates to avoid ‘jumps’);
#P comment 50 79 207 196617 is too big , you could use last known good;
#P comment 50 65 186 196617 f.e. if there’s nothing found , or rect;
#P comment 50 50 186 196617 add some special cases checking:;
#P pop;
#P newobj 252 335 65 196617 p suggestion;
#N vpatcher 577 251 1195 451;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 402 128 153 196617 to jit.gl.render;
#P comment 402 112 184 196617 see screentoworld message;
#P newex 50 111 183 196617 pack 0. 0.;
#P newex 223 85 170 196617 scale 0. 240. 0.828428 -0.828428;
#P newex 50 85 158 196617 scale 0. 320. -1.10457 1.10457;
#P newex 50 50 95 196617 unpack 0. 0.;
#P inlet 50 30 15 0;
#P outlet 50 133 15 0;
#P window linecount 0;
#P comment 402 80 153 196617 this maps pixel 320×240 to opengl
coordinates;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 1 0;
#P connect 3 1 5 0;
#P connect 5 0 6 1;
#P pop;
#P newobj 235 393 133 196617 p screentoworld(320×240);
#P newex 235 364 122 196617 vexpr $f1+($f2-$f1)/2.;
#P newex 235 310 158 196617 jit.findbounds @min 0.9 @max 1.;
#P newex 253 279 193 196617 jit.window preview @sync 0 @floating 1;
#P newex 367 62 62 196617 cv.jit.track;
#P user jit.fpsgui 124 97 60 196617 0;
#P newex 235 235 123 196617 jit.unpack 2 @offset 1 3;
#P newex 112 232 82 196617 jit.gl.render foo;
#P newex 65 279 170 196617 jit.window foo @sync 0 @floating 1;
#P newex 112 128 134 196617 t b b erase b;
#P message 260 145 145 196617 read video_320_240_15.mov;
#P newex 235 171 111 196617 jit.qt.movie @unique 1;
#P toggle 112 40 15 0;
#P newex 112 70 50 196617 qmetro 5;
#P newex 153 171 34 196617 s r.b;
#N vpatcher 117 181 668 561;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 90 305 161 196617 pack 0. 0.;
#P newex 90 278 55 196617 snapshot~;
#P newex 178 236 30 196617 t b b;
#P newex 90 182 66 196617 pack 0. 180.;
#P newex 90 209 32 196617 line~;
#P window linecount 0;
#P newex 90 127 64 196617 unpack 0. 0.;
#P window linecount 1;
#P newex 241 274 55 196617 snapshot~;
#P newex 178 213 31 196617 r r.b;
#P window linecount 0;
#P newex 90 50 317 196617 t l b b;
#N vpatcher 708 44 898 292;
#N comlet interval in ms is reported here;
#P outlet 66 173 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 96 104 46 196617 cpuclock;
#P newex 66 143 27 196617 – 0.;
#P newex 48 104 46 196617 cpuclock;
#N comlet bang stops timing and reports interval;
#P inlet 96 58 15 0;
#N comlet bang starts timing interval;
#P inlet 48 58 15 0;
#P connect 0 0 2 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 2 0 3 1;
#P connect 1 0 4 0;
#P pop;
#P newobj 297 121 55 196617 p cputimer;
#P newex 241 178 66 196617 pack 0. 180.;
#P newex 241 205 32 196617 line~;
#P inlet 90 30 15 0;
#P outlet 90 334 15 0;
#P connect 1 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P connect 11 0 12 0;
#P connect 9 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 0 0;
#P connect 4 0 10 1;
#P connect 6 0 11 0;
#P connect 8 1 3 0;
#P connect 3 0 2 0;
#P connect 11 1 7 0;
#P connect 2 0 7 0;
#P connect 7 0 13 1;
#P connect 5 1 4 0;
#P connect 4 0 3 1;
#P connect 5 2 4 1;
#P pop;
#P newobj 235 425 73 196617 p xy-smooth~;
#P comment 362 238 115 196617 get Red and Blue planes;
#P comment 394 312 162 196617 find only ‘very red’ pixels;
#P comment 596 572 63 196617 before;
#P comment 609 466 100 196617 change threshold;
#P connect 7 0 6 0;
#P connect 6 0 10 0;
#P fasten 10 2 12 0 199 198 117 198;
#P fasten 10 0 12 0 117 208 117 208;
#P connect 6 0 14 0;
#P connect 10 1 5 0;
#P connect 40 0 39 0;
#P connect 9 0 8 0;
#P connect 10 3 8 0;
#P connect 35 0 8 0;
#P connect 8 0 13 0;
#P connect 13 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 19 0;
#P connect 19 0 4 0;
#P connect 4 0 21 0;
#P fasten 8 0 31 0 240 194;
#P connect 13 0 16 0;
#P connect 42 0 41 0;
#P connect 17 1 18 1;
#P fasten 36 0 37 0 776 613 421 613;
#P connect 41 0 37 0;
#P connect 39 0 37 0;
#P fasten 38 0 37 0 481 613 421 613;
#P fasten 18 0 29 0 240 387 472 387;
#P connect 29 0 30 0;
#P connect 45 0 43 0;
#P connect 43 0 38 0;
#P connect 30 0 44 0;
#P connect 44 0 43 1;
#P connect 44 1 45 0;
#P connect 53 0 45 1;
#P fasten 23 0 29 1 662 387 584 387;
#P connect 45 0 49 0;
#P connect 49 0 48 0;
#P fasten 13 1 22 0 296 266 662 266;
#P connect 22 0 23 0;
#P connect 23 0 24 0;
#P connect 24 0 46 0;
#P connect 46 0 25 0;
#P connect 36 0 49 1;
#P connect 49 1 47 0;
#P connect 22 1 23 1;
#P window clipboard copycount 54;


May 6, 2007 | 11:33 am

Hi nesa!
Sorry for posting that late, had a lot to do the last days…
Thanks for your new patch!! You’re right, I recognized the frame-rate decrease.
But the lines are much more like curves in the first patch. When I change the threshold in your new patch, it’s getting a bit better, but I prefer the result of the first patch for my work. Because in your new patch, the result is too "angled" for my presentation.
I will have a closer look on both patches again, maybe we could find a solution with both of them?
I already thought about js_jitterspline-example, but as I am not trained in javascript, I dont’t understand the command in the patch :$…
What would you think about jit.gl.nurbs? If I would give him just 3 control_points and that in 2 dimensions….
I will have a look and keep you in loop, ok?
Thanks a lot, nesa!!
Johannes


May 8, 2007 | 11:18 am

Hi Johannes,

I have to admit that I deliberatly choose to make new patch instead
of changing your original one, because I did not plan to offer you
solution(since I have no idea what is your final goal), but just some
hints that might help you achieve it. So I just showed you some
techniques, but it’s still up to you to choose the best ones to reach
your goal.

Here are even more distractions:

Andrew Benson’s recipe 17: twine ball

http://www.cycling74.com/story/2006/2/14/161736/108

hth,
nesa


May 8, 2007 | 4:41 pm

Hi nesa!
Thank you very much for your help, really!! Due to you, I got much, much forward in my project!
Of course I understand, that you want to create new patches, who doesn’t want to ;) ! After some time, I am quite sure to find the best solution for my patch.
If you want, I will send you my progress! In any case, I will go on posting to this forum, either to help with my (unfortunately) small experience or to ask for some ideas.
Thank you very much again for your help!!
Johannes


Viewing 9 posts - 1 through 9 (of 9 total)