Forums > Jitter

drawing lines between cv.jit.blob.centroids

June 23, 2007 | 3:57 am

I am trying to draw lines between all centroids. the pensize of the line would be related to the size of the blobs/centroids being connected.

I can get the values from cv.jit.blob.centroids and jit.iter them to use the values to draw things in the jit.lcd.

but I am stumped on how I would loop through the centroids list to get at the values to have lines drawn from each centroid to every other centroid.

basically do something like:

with i = 0 to length(centroidList) loop
with j = 0 to length(centroidList) loop
send linesegment xi,yi,xj,yj to jit.lcd
end
end

hope that made sense.

any help or small sample patch showing how to loop through the values would be of a great help.


June 24, 2007 | 3:13 pm

ye, you need a loop.
and you can store the centroid with max’s version of an array, coll.
then you can send a sequence of array[index] to the coll and slice them for
the segmentline you want to create.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P hidden newex 276 587 26 9109513 print;
#P hidden newex 164 225 35 9109513 t 172;
#P window linecount 2;
#P newex 65 348 129 9109513 cv.jit.label @charmode 1 @threshold 20;
#P window linecount 1;
#P message 142 133 81 9109513 read arrows.gif;
#P number 164 262 35 9 0 255 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 65 289 109 9109513 jit.op @op < @val 172;
#N vpatcher 239 23 939 694;
#P origin 0 16;
#P window setfont "Sans Serif" 9.;
#P newex 202 443 27 9109513 t b i;
#P newex 202 465 91 9109513 int;
#P newex 347 240 39 9109513 t clear i;
#N coll centroids 1;
#P newobj 241 288 71 9109513 coll centroids 1;
#P message 89 538 144 9109513 linesegment $1 $2 $3 $4 255 0 0;
#P newex 202 511 48 9109513 zl group 4;
#P newex 202 169 88 9109513 t b l 0;
#P newex 303 501 38 9109513 print fir;
#P newex 202 369 91 9109513 t b i;
#P newex 243 395 27 9109513 – 1;
#P newex 202 395 40 9109513 uzi 5;
#N counter;
#X flags 0 0;
#P newobj 202 420 66 9109513 counter;
#P newex 250 321 27 9109513 – 1;
#P newex 202 321 40 9109513 uzi 5;
#N counter;
#X flags 0 0;
#P newobj 202 346 66 9109513 counter;
#P newex 241 194 41 9109513 jit.iter;
#P newex 241 216 34 9109513 t b l;
#P newex 241 266 58 9109513 pack 0 0. 0.;
#N counter;
#X flags 0 0;
#P newobj 241 241 75 9109513 counter;
#N coll centroids 1;
#P newobj 202 490 71 9109513 coll centroids 1;
#P newex 343 501 44 9109513 print sec;
#P number 375 264 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 347 217 40 9109513 change;
#P newex 347 196 47 9109513 route dim;
#P newex 347 175 60 9109513 jit.matrixinfo;
#P window linecount 2;
#P comment 604 345 129 9109513 International Academy of Media Arts &
Sciences;
#B frgb 15 2 2;
#P window linecount 1;
#P comment 604 330 110 9109513 support:;
#B frgb 15 2 2;
#P window linecount 3;
#P user com 602 274 121 9109513 30;
#K set 0 17017 8266 25953 28205 19809 29283 8272 25964 27749 29801 25970
3434 28016 16489 24941 24947 11873 25390 27248 3395 28528 31090 26983 26740
8361 12848 12339 11570 12336 13824;
#K end;
#P user panel 595 267 140 111;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 597 272 142 110;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 1;
#N vpatcher 20 74 382 422;
#P outlet 117 267 15 0;
#P inlet 117 45 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 117 116 35 9109513 t b l;
#P newex 184 180 27 9109513 t b i;
#P newex 142 180 27 9109513 t b i;
#P newex 117 218 45 9109513 onebang;
#P newex 117 241 94 9109513 pack dim 320 240;
#P newex 184 160 40 9109513 change;
#P newex 142 160 40 9109513 change;
#P newex 142 140 52 9109513 unpack;
#P newex 117 94 53 9109513 route dim;
#P newex 117 71 72 9109513 jit.matrixinfo;
#P connect 10 0 0 0;
#P connect 0 0 1 0;
#P connect 1 0 9 0;
#P connect 9 0 6 0;
#P connect 6 0 5 0;
#P connect 5 0 11 0;
#P connect 9 1 2 0;
#P connect 2 0 3 0;
#P connect 3 0 7 0;
#P connect 8 0 6 1;
#P connect 7 0 6 1;
#P connect 7 1 5 1;
#P connect 2 1 4 0;
#P connect 4 0 8 0;
#P connect 8 1 5 2;
#P pop;
#P newobj 571 141 70 9109513 p adjust_size;
#P newex 533 111 49 9109513 t 0 l l;
#P message 75 131 14 9109513 1;
#P newex 456 160 47 9109513 gate 1 1;
#N comlet (matrix) Background;
#P inlet 533 83 15 0;
#P newex 75 460 48 9109513 loadbang;
#P newex 57 101 446 9109513 t b l l clear;
#P message 75 489 57 9109513 brgb 0 0 0;
#P newex 90 568 111 9109513 jit.lcd 4 char 320 240;
#N comlet (matrix) From cv.jit.blobs.centroids;
#P inlet 57 81 15 0;
#P outlet 90 590 15 0;
#P comment 375 281 92 9109513 number of centroids;
#P connect 2 0 5 0;
#P fasten 5 0 9 0 62 124 80 124;
#P connect 6 0 4 0;
#P fasten 36 0 37 0 207 533 94 533;
#P fasten 5 0 3 0 62 566 95 566;
#P connect 4 0 3 0;
#P fasten 8 0 3 0 461 201 461 201 461 562 95 562;
#P fasten 10 1 3 0 557 561 95 561;
#P fasten 11 0 3 0 576 564 95 564;
#P connect 37 0 3 0;
#P connect 3 0 1 0;
#P fasten 5 1 35 0 207 164 207 164;
#P connect 35 0 28 0;
#P connect 28 0 27 0;
#P fasten 27 0 33 0 207 366 207 366;
#P connect 33 0 31 0;
#P connect 31 0 30 0;
#P connect 30 0 41 0;
#P connect 41 0 40 0;
#P connect 40 0 22 0;
#P connect 41 1 22 0;
#P connect 22 0 36 0;
#P fasten 39 1 28 1 381 319 237 319;
#P fasten 39 1 31 1 381 392 237 392;
#P connect 35 1 26 0;
#P connect 26 0 25 0;
#P connect 25 0 23 0;
#P connect 23 0 24 0;
#P fasten 39 0 38 0 352 286 246 286;
#P connect 24 0 38 0;
#P fasten 39 1 32 0 381 392 248 392;
#P fasten 39 1 29 0 381 319 255 319;
#P fasten 29 0 27 4 255 341 263 341;
#P fasten 32 0 30 4 248 417 263 417;
#P connect 25 1 24 1;
#P fasten 35 2 23 2 285 236 278 236;
#P connect 33 1 40 1;
#P connect 5 2 17 0;
#P connect 17 0 18 0;
#P connect 18 0 19 0;
#P connect 19 0 39 0;
#P connect 39 1 20 0;
#P fasten 9 0 8 0 80 151 461 151;
#P fasten 10 0 8 0 538 141 461 141;
#P connect 5 3 8 1;
#P connect 7 0 10 0;
#P connect 10 2 11 0;
#P pop;
#P newobj 65 462 125 9109513 p cv.jit.blobs.centroids.draw;
#P newex 65 255 66 9109513 jit.rgb2luma;
#P user jit.fpsgui 65 634 60 9109513 0;
#P comment 539 380 163 9109513 3-plane single-row float32;
#P comment 537 345 163 9109513 Single-plane char;
#P comment 491 380 185 9109513 Output:;
#B frgb 247 247 247;
#P comment 491 345 185 9109513 Input:;
#B frgb 247 247 247;
#P user panel 487 338 51 37;
#X brgb 140 140 140;
#X frgb 198 198 198;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 487 338 218 36;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 12;
#P user com 353 145 350 9109513 242;
#K set 0 25462 11882 26996 11874 27759 25203 11875 25966 29810 28521 25715
8294 30062 25460 26991 28275 8301 30051 26656 27753 27493 8291 30254 27241
29742 25445 28276 29295 26980 29472 25976 25445 28788 8308 26721 29728 26996
8308 24939 25971 8294 28530 8297 28272 30068 8308 26725 8303 30068 28789
29728 28518 8291 30254 27241 29742 27745 25189 27680 24942 25632 25441 27747
30060 24948 25971 8308 26725 8291 25966 29797 29216 28518 8301 24947 29472
24942 25632 24946 25953 8303 26144 25953 25448 8291 28526 28261 25460 25956
8291 28525 28783 28261 28276 8297 28260 26998 26980 30049 27756;
#K set 100 31022 3341 21608 25888 28533 29808 30068 8303 26144 25462 11882
26996 11884 24930 25964 8301 30067 29728 25189 8303 26144 29817 28773 8291
26721 29230 3341 25462 11882 26996 11874 27759 25203 8303 30068 28789 29811
8289 8307 26990 26476 25901 29295 30508 8243 11632 27745 28261 8291 26721
29216 28001 29810 27000 8311 26725 29285 8308 26725 8302 30061 25189 29216
28518 8291 25964 27763 8297 29472 29800 25888 29537 28005 8289 29472 29800
25888 28277 28002 25970 8303 26144 27745 25189 27749 25632 25455 28016 28526
25966 29811 11808 21608 25888 25455 28276 25966 29811 8303 26144;
#K set 200 25953 25448 8304 27745 28261 8297 29472 24947 8294 28524 27759
30579 14861 20588 24942 25888 12602 8312 11619 28527 29284 26990 24948 25869
20588 24942 25888 12858 8313 11619 28527 29284 26990 24948 25869 20588 24942
25888 13114 8289 29285 24832;
#K end;
#P window linecount 3;
#P comment 209 260 102 9109513 Convert to greyscale and threshold to obtain
binary image.;
#P window linecount 1;
#P comment 84 110 135 9109513 Use movie file input;
#B frgb 255 255 255;
#P user jit.pwindow 64 504 162 122 0 1 0 0 1 0;
#P newex 65 412 95 9109513 cv.jit.blobs.centroids;
#P message 147 162 29 9109513 stop;
#P message 112 162 33 9109513 start;
#P message 80 162 30 9109513 read;
#P toggle 65 111 15 0;
#P newex 65 135 46 9109513 metro 2;
#P newex 65 190 105 9109513 jit.qt.movie 160 120;
#P window setfont "Sans Serif" 24.;
#P comment 57 34 684 9109528 cv.jit.blobs.centroids: locate labeled blobs;
#B frgb 14 51 69;
#P user panel 52 103 187 118;
#X brgb 111 127 126;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 57 246 274 80;
#X brgb 247 248 248;
#X frgb 149 55 55;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 52 403 131 34;
#X brgb 219 224 220;
#X frgb 255 255 255;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 487 372 51 37;
#X brgb 140 140 140;
#X frgb 198 198 198;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 487 373 218 36;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 57 63 600 4;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 57 62 600 5;
#X brgb 149 55 55;
#X frgb 149 55 55;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 60 249 275 81;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 490 341 218 72;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 339 140 368 171;
#X brgb 230 230 230;
#X frgb 255 255 255;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 343 145 368 171;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 313 160 148 4;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 313 152 148 4;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 313 144 148 4;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 595 283 4 98;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 586 283 4 98;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 577 283 4 98;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 201 337 102 9109513 You MUST label the image with "charmode" set
to 1 before processing!;
#P user panel 55 332 275 60;
#X brgb 247 248 248;
#X frgb 149 55 55;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 58 335 276 61;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 5;
#P comment 240 466 190 9109513 The utility abstraction
cv.jit.centroids.drawsuperimposes centroid and mass information on the
image sent to its right
inlet. The area of the green circles is the same as that of the underlying
blob.;
#P user panel 53 452 392 103;
#X brgb 247 248 248;
#X frgb 149 55 55;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 56 455 393 104;
#X brgb 182 192 184;
#X frgb 198 198 198;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user fpic 497 69 255 72 cvtitle.gif 0 0 0 0. 0 0 0;
#P connect 27 0 26 0;
#P fasten 47 0 25 0 147 154 185 154 185 183 70 183;
#P connect 26 0 25 0;
#P fasten 28 0 25 0 85 183 70 183;
#P fasten 29 0 25 0 117 183 70 183;
#P fasten 30 0 25 0 152 183 70 183;
#P fasten 25 0 43 0 70 235 70 235;
#P connect 43 0 45 0;
#P connect 45 0 48 0;
#P connect 48 0 31 0;
#P connect 31 0 44 0;
#P connect 44 0 32 0;
#P connect 32 0 42 0;
#P hidden connect 47 0 49 0;
#P hidden connect 49 0 46 0;
#P connect 46 0 45 1;
#P connect 45 0 44 1;
#P window clipboard copycount 51;

On 6/23/07, Russ wrote:
>
>
> I am trying to draw lines between all centroids. the pensize of the line
> would be related to the size of the blobs/centroids being connected.
>
> I can get the values from cv.jit.blob.centroids and jit.iter them to use
> the values to draw things in the jit.lcd.
>
> but I am stumped on how I would loop through the centroids list to get at
> the values to have lines drawn from each centroid to every other centroid.
>
>
> basically do something like:
>
> with i = 0 to length(centroidList) loop
> with j = 0 to length(centroidList) loop
> send linesegment xi,yi,xj,yj to jit.lcd
> end
> end
>
>
> hope that made sense.
>
>
> any help or small sample patch showing how to loop through the values
> would be of a great help.
>
>


June 24, 2007 | 3:14 pm

check the modified [p cv.jit.blobs.centroids.draw]
this is not ideal, but works

On 6/24/07, yair reshef wrote:
>
> ye, you need a loop.
> and you can store the centroid with max’s version of an array, coll.
> then you can send a sequence of array[index] to the coll and slice them
> for the segmentline you want to create.
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P hidden newex 276 587 26 9109513 print;
> #P hidden newex 164 225 35 9109513 t 172;
> #P window linecount 2;
> #P newex 65 348 129 9109513 cv.jit.label @charmode 1 @threshold 20;
> #P window linecount 1;
> #P message 142 133 81 9109513 read arrows.gif;
> #P number 164 262 35 9 0 255 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 65 289 109 9109513 jit.op @op < @val 172;
> #N vpatcher 239 23 939 694;
> #P origin 0 16;
> #P window setfont "Sans Serif" 9.;
> #P newex 202 443 27 9109513 t b i;
> #P newex 202 465 91 9109513 int;
> #P newex 347 240 39 9109513 t clear i;
> #N coll centroids 1;
> #P newobj 241 288 71 9109513 coll centroids 1;
> #P message 89 538 144 9109513 linesegment $1 $2 $3 $4 255 0 0;
> #P newex 202 511 48 9109513 zl group 4;
> #P newex 202 169 88 9109513 t b l 0;
> #P newex 303 501 38 9109513 print fir;
> #P newex 202 369 91 9109513 t b i;
> #P newex 243 395 27 9109513 – 1;
> #P newex 202 395 40 9109513 uzi 5;
> #N counter;
> #X flags 0 0;
> #P newobj 202 420 66 9109513 counter;
> #P newex 250 321 27 9109513 – 1;
> #P newex 202 321 40 9109513 uzi 5;
> #N counter;
> #X flags 0 0;
> #P newobj 202 346 66 9109513 counter;
> #P newex 241 194 41 9109513 jit.iter;
> #P newex 241 216 34 9109513 t b l;
> #P newex 241 266 58 9109513 pack 0 0. 0.;
> #N counter;
> #X flags 0 0;
> #P newobj 241 241 75 9109513 counter;
> #N coll centroids 1;
> #P newobj 202 490 71 9109513 coll centroids 1;
> #P newex 343 501 44 9109513 print sec;
> #P number 375 264 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 347 217 40 9109513 change;
> #P newex 347 196 47 9109513 route dim;
> #P newex 347 175 60 9109513 jit.matrixinfo;
> #P window linecount 2;
> #P comment 604 345 129 9109513 International Academy of Media Arts &
> Sciences;
> #B frgb 15 2 2;
> #P window linecount 1;
> #P comment 604 330 110 9109513 support:;
> #B frgb 15 2 2;
> #P window linecount 3;
> #P user com 602 274 121 9109513 30;
> #K set 0 17017 8266 25953 28205 19809 29283 8272 25964 27749 29801 25970
> 3434 28016 16489 24941 24947 11873 25390 27248 3395 28528 31090 26983 26740
> 8361 12848 12339 11570 12336 13824;
> #K end;
> #P user panel 595 267 140 111;
> #X brgb 198 198 198;
> #X frgb 140 140 140;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 597 272 142 110;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P window linecount 1;
> #N vpatcher 20 74 382 422;
> #P outlet 117 267 15 0;
> #P inlet 117 45 15 0;
> #P window setfont "Sans Serif" 9.;
> #P newex 117 116 35 9109513 t b l;
> #P newex 184 180 27 9109513 t b i;
> #P newex 142 180 27 9109513 t b i;
> #P newex 117 218 45 9109513 onebang;
> #P newex 117 241 94 9109513 pack dim 320 240;
> #P newex 184 160 40 9109513 change;
> #P newex 142 160 40 9109513 change;
> #P newex 142 140 52 9109513 unpack;
> #P newex 117 94 53 9109513 route dim;
> #P newex 117 71 72 9109513 jit.matrixinfo;
> #P connect 10 0 0 0;
> #P connect 0 0 1 0;
> #P connect 1 0 9 0;
> #P connect 9 0 6 0;
> #P connect 6 0 5 0;
> #P connect 5 0 11 0;
> #P connect 9 1 2 0;
> #P connect 2 0 3 0;
> #P connect 3 0 7 0;
> #P connect 8 0 6 1;
> #P connect 7 0 6 1;
> #P connect 7 1 5 1;
> #P connect 2 1 4 0;
> #P connect 4 0 8 0;
> #P connect 8 1 5 2;
> #P pop;
> #P newobj 571 141 70 9109513 p adjust_size;
> #P newex 533 111 49 9109513 t 0 l l;
> #P message 75 131 14 9109513 1;
> #P newex 456 160 47 9109513 gate 1 1;
> #N comlet (matrix) Background;
> #P inlet 533 83 15 0;
> #P newex 75 460 48 9109513 loadbang;
> #P newex 57 101 446 9109513 t b l l clear;
> #P message 75 489 57 9109513 brgb 0 0 0;
> #P newex 90 568 111 9109513 jit.lcd 4 char 320 240;
> #N comlet (matrix) From cv.jit.blobs.centroids;
> #P inlet 57 81 15 0;
> #P outlet 90 590 15 0;
> #P comment 375 281 92 9109513 number of centroids;
> #P connect 2 0 5 0;
> #P fasten 5 0 9 0 62 124 80 124;
> #P connect 6 0 4 0;
> #P fasten 36 0 37 0 207 533 94 533;
> #P fasten 5 0 3 0 62 566 95 566;
> #P connect 4 0 3 0;
> #P fasten 8 0 3 0 461 201 461 201 461 562 95 562;
> #P fasten 10 1 3 0 557 561 95 561;
> #P fasten 11 0 3 0 576 564 95 564;
> #P connect 37 0 3 0;
> #P connect 3 0 1 0;
> #P fasten 5 1 35 0 207 164 207 164;
> #P connect 35 0 28 0;
> #P connect 28 0 27 0;
> #P fasten 27 0 33 0 207 366 207 366;
> #P connect 33 0 31 0;
> #P connect 31 0 30 0;
> #P connect 30 0 41 0;
> #P connect 41 0 40 0;
> #P connect 40 0 22 0;
> #P connect 41 1 22 0;
> #P connect 22 0 36 0;
> #P fasten 39 1 28 1 381 319 237 319;
> #P fasten 39 1 31 1 381 392 237 392;
> #P connect 35 1 26 0;
> #P connect 26 0 25 0;
> #P connect 25 0 23 0;
> #P connect 23 0 24 0;
> #P fasten 39 0 38 0 352 286 246 286;
> #P connect 24 0 38 0;
> #P fasten 39 1 32 0 381 392 248 392;
> #P fasten 39 1 29 0 381 319 255 319;
> #P fasten 29 0 27 4 255 341 263 341;
> #P fasten 32 0 30 4 248 417 263 417;
> #P connect 25 1 24 1;
> #P fasten 35 2 23 2 285 236 278 236;
> #P connect 33 1 40 1;
> #P connect 5 2 17 0;
> #P connect 17 0 18 0;
> #P connect 18 0 19 0;
> #P connect 19 0 39 0;
> #P connect 39 1 20 0;
> #P fasten 9 0 8 0 80 151 461 151;
> #P fasten 10 0 8 0 538 141 461 141;
> #P connect 5 3 8 1;
> #P connect 7 0 10 0;
> #P connect 10 2 11 0;
> #P pop;
> #P newobj 65 462 125 9109513 p cv.jit.blobs.centroids.draw;
> #P newex 65 255 66 9109513 jit.rgb2luma;
> #P user jit.fpsgui 65 634 60 9109513 0;
> #P comment 539 380 163 9109513 3-plane single-row float32;
> #P comment 537 345 163 9109513 Single-plane char;
> #P comment 491 380 185 9109513 Output:;
> #B frgb 247 247 247;
> #P comment 491 345 185 9109513 Input:;
> #B frgb 247 247 247;
> #P user panel 487 338 51 37;
> #X brgb 140 140 140;
> #X frgb 198 198 198;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 487 338 218 36;
> #X brgb 198 198 198;
> #X frgb 140 140 140;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P window linecount 12;
> #P user com 353 145 350 9109513 242;
> #K set 0 25462 11882 26996 11874 27759 25203 11875 25966 29810 28521 25715
> 8294 30062 25460 26991 28275 8301 30051 26656 27753 27493 8291 30254 27241
> 29742 25445 28276 29295 26980 29472 25976 25445 28788 8308 26721 29728 26996
> 8308 24939 25971 8294 28530 8297 28272 30068 8308 26725 8303 30068 28789
> 29728 28518 8291 30254 27241 29742 27745 25189 27680 24942 25632 25441 27747
> 30060 24948 25971 8308 26725 8291 25966 29797 29216 28518 8301 24947 29472
> 24942 25632 24946 25953 8303 26144 25953 25448 8291 28526 28261 25460 25956
> 8291 28525 28783 28261 28276 8297 28260 26998 26980 30049 27756;
> #K set 100 31022 3341 21608 25888 28533 29808 30068 8303 26144 25462 11882
> 26996 11884 24930 25964 8301 30067 29728 25189 8303 26144 29817 28773 8291
> 26721 29230 3341 25462 11882 26996 11874 27759 25203 8303 30068 28789 29811
> 8289 8307 26990 26476 25901 29295 30508 8243 11632 27745 28261 8291 26721
> 29216 28001 29810 27000 8311 26725 29285 8308 26725 8302 30061 25189 29216
> 28518 8291 25964 27763 8297 29472 29800 25888 29537 28005 8289 29472 29800
> 25888 28277 28002 25970 8303 26144 27745 25189 27749 25632 25455 28016 28526
> 25966 29811 11808 21608 25888 25455 28276 25966 29811 8303 26144;
> #K set 200 25953 25448 8304 27745 28261 8297 29472 24947 8294 28524 27759
> 30579 14861 20588 24942 25888 12602 8312 11619 28527 29284 26990 24948 25869
> 20588 24942 25888 12858 8313 11619 28527 29284 26990 24948 25869 20588 24942
> 25888 13114 8289 29285 24832;
> #K end;
> #P window linecount 3;
> #P comment 209 260 102 9109513 Convert to greyscale and threshold to
> obtain binary image.;
> #P window linecount 1;
> #P comment 84 110 135 9109513 Use movie file input;
> #B frgb 255 255 255;
> #P user jit.pwindow 64 504 162 122 0 1 0 0 1 0;
> #P newex 65 412 95 9109513 cv.jit.blobs.centroids;
> #P message 147 162 29 9109513 stop;
> #P message 112 162 33 9109513 start;
> #P message 80 162 30 9109513 read;
> #P toggle 65 111 15 0;
> #P newex 65 135 46 9109513 metro 2;
> #P newex 65 190 105 9109513 jit.qt.movie 160 120;
> #P window setfont "Sans Serif" 24.;
> #P comment 57 34 684 9109528 cv.jit.blobs.centroids : locate labeled
> blobs;
> #B frgb 14 51 69;
> #P user panel 52 103 187 118;
> #X brgb 111 127 126;
> #X frgb 0 0 0;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 57 246 274 80;
> #X brgb 247 248 248;
> #X frgb 149 55 55;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 52 403 131 34;
> #X brgb 219 224 220;
> #X frgb 255 255 255;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 487 372 51 37;
> #X brgb 140 140 140;
> #X frgb 198 198 198;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 487 373 218 36;
> #X brgb 198 198 198;
> #X frgb 140 140 140;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 57 63 600 4;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 57 62 600 5;
> #X brgb 149 55 55;
> #X frgb 149 55 55;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 60 249 275 81;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 490 341 218 72;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 339 140 368 171;
> #X brgb 230 230 230;
> #X frgb 255 255 255;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 343 145 368 171;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 313 160 148 4;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 313 152 148 4;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 313 144 148 4;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 595 283 4 98;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 586 283 4 98;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 577 283 4 98;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 4;
> #P comment 201 337 102 9109513 You MUST label the image with "charmode"
> set to 1 before processing!;
> #P user panel 55 332 275 60;
> #X brgb 247 248 248;
> #X frgb 149 55 55;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 58 335 276 61;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P window linecount 5;
> #P comment 240 466 190 9109513 The utility abstraction
> cv.jit.centroids.draw superimposes centroid and mass information on the
> image sent to its right inlet. The area of the green circles is the same as
> that of the underlying blob.;
> #P user panel 53 452 392 103;
> #X brgb 247 248 248;
> #X frgb 149 55 55;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 56 455 393 104;
> #X brgb 182 192 184;
> #X frgb 198 198 198;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user fpic 497 69 255 72 cvtitle.gif 0 0 0 0. 0 0 0;
> #P connect 27 0 26 0;
> #P fasten 47 0 25 0 147 154 185 154 185 183 70 183;
> #P connect 26 0 25 0;
> #P fasten 28 0 25 0 85 183 70 183;
> #P fasten 29 0 25 0 117 183 70 183;
> #P fasten 30 0 25 0 152 183 70 183;
> #P fasten 25 0 43 0 70 235 70 235;
> #P connect 43 0 45 0;
> #P connect 45 0 48 0;
> #P connect 48 0 31 0;
> #P connect 31 0 44 0;
> #P connect 44 0 32 0;
> #P connect 32 0 42 0;
> #P hidden connect 47 0 49 0;
> #P hidden connect 49 0 46 0;
> #P connect 46 0 45 1;
> #P connect 45 0 44 1;
> #P window clipboard copycount 51;
>
>
> On 6/23/07, Russ wrote:
> >
> >
> > I am trying to draw lines between all centroids. the pensize of the line
> > would be related to the size of the blobs/centroids being connected.
> >
> > I can get the values from cv.jit.blob.centroids and jit.iter them to
> > use the values to draw things in the jit.lcd.
> >
> > but I am stumped on how I would loop through the centroids list to get
> > at the values to have lines drawn from each centroid to every other
> > centroid.
> >
> >
> > basically do something like:
> >
> > with i = 0 to length(centroidList) loop
> > with j = 0 to length(centroidList) loop
> > send linesegment xi,yi,xj,yj to jit.lcd
> > end
> > end
> >
> >
> > hope that made sense.
> >
> >
> > any help or small sample patch showing how to loop through the values
> > would be of a great help.
> >
> >
>
>


June 24, 2007 | 4:59 pm

wow, thanks man.


June 25, 2007 | 12:22 am


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