Forums > Jitter

cv.jit.label: trouble with blob chosen by size rank

November 7, 2007 | 12:52 am

Dear list,

I’d like to track the largest blob (in a room using a camera).
Therefore I am exploring the cv.jit objects and I think cv.jit.label is the one I am looking for.

The problem I run into is that using it with charmode 1 and mode 1 I expected to see only the largest blob labelled 1. But instead I get the most top/left one. The example below is a stripped down version of the help-file and two moving circles, one bigger than the other.

I searched the list and read the help-files but it still don’t get it, what am I missing here?

Any help is much appreciated.
Best regards, Erik

running cv.jit_1.5_jit_1.6_OSX-Intel on a MBP with latest Max+Jitter

the patch:

#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P user com 271 214 215 196617 46;
#K set 0 22376 31008 25711 25971 8297 29728 26990 8291 26721 29293 28516 25888 12588 8301 28516 25888 12576 29544 28535 8308 26725 8294 26994 29556 8308 28528 12140 25958 29728 25196 28514 8297 28275 29797 24932 8303 26144 29800 25888 27745 29287 25971 29728 25196 28514 16128;
#K end;
#P user panel 1205 -49 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 1205 -57 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 1205 -65 148 4;
#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 389 129 836 437;
#P window setfont "Sans Serif" 9.;
#P message 275 229 57 196617 brgb 0 0 0;
#P newex 275 205 48 196617 loadbang;
#P newex 89 79 56 196617 t b b clear;
#N vpatcher 54 74 654 474;
#P window setfont "Sans Serif" 9.;
#P newex 50 50 30 196617 t b b;
#P newex 50 193 161 196617 pack paintoval 0 0 20 20 0 255 0;
#P newex 161 159 31 196617 + 20;
#P newex 148 125 67 196617 slide 15. 15.;
#P newex 148 96 71 196617 drunk 220 10;
#P newex 83 159 31 196617 + 20;
#P newex 70 125 67 196617 slide 15. 15.;
#P newex 70 96 71 196617 drunk 300 10;
#P inlet 50 30 15 0;
#P outlet 50 215 15 0;
#P connect 1 0 9 0;
#P connect 9 0 8 0;
#P connect 8 0 0 0;
#P connect 9 1 2 0;
#P connect 2 0 3 0;
#P connect 3 0 8 1;
#P connect 3 0 4 0;
#P connect 6 0 8 2;
#P connect 4 0 8 3;
#P connect 7 0 8 4;
#P connect 9 1 5 0;
#P connect 5 0 6 0;
#P connect 6 0 7 0;
#P pop;
#P newobj 112 155 43 196617 p green;
#N vpatcher 54 74 654 474;
#P window setfont "Sans Serif" 9.;
#P newex 50 50 30 196617 t b b;
#P newex 50 193 161 196617 pack paintoval 0 0 20 20 255 0 0;
#P newex 161 159 31 196617 + 50;
#P newex 148 125 67 196617 slide 15. 15.;
#P newex 148 96 71 196617 drunk 220 10;
#P newex 83 159 31 196617 + 50;
#P newex 70 125 67 196617 slide 15. 15.;
#P newex 70 96 71 196617 drunk 300 10;
#P inlet 50 30 15 0;
#P outlet 50 215 15 0;
#P connect 1 0 9 0;
#P connect 9 0 8 0;
#P connect 8 0 0 0;
#P connect 9 1 2 0;
#P connect 2 0 3 0;
#P connect 3 0 8 1;
#P connect 3 0 4 0;
#P connect 6 0 8 2;
#P connect 4 0 8 3;
#P connect 7 0 8 4;
#P connect 9 1 5 0;
#P connect 5 0 6 0;
#P connect 6 0 7 0;
#P pop;
#P newobj 63 154 33 196617 p red;
#P inlet 89 52 15 0;
#P outlet 112 245 15 0;
#P connect 4 1 2 0;
#P connect 1 0 4 0;
#P connect 4 1 3 0;
#P connect 6 0 0 0;
#P fasten 4 2 0 0 215 163;
#P fasten 4 0 0 0 28 159;
#P connect 3 0 0 0;
#P connect 2 0 0 0;
#P connect 5 0 6 0;
#P pop;
#P newobj 69 16 56 196617 p rgb flies;
#P toggle 69 -36 15 0;
#P newex 69 -15 50 196617 qmetro 5;
#P newex 69 41 111 196617 jit.lcd 4 char 320 240;
#P window linecount 2;
#P comment 527 46 110 196617 Institute of Advanced Media Arts & Sciences;
#B frgb 15 2 2;
#P window linecount 1;
#P comment 527 31 110 196617 support:;
#B frgb 15 2 2;
#P window linecount 3;
#P user com 525 -25 118 196617 30;
#K set 0 25209 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 518 -32 136 110;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P number 598 332 35 9 1 255 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user jit.fpsgui 290 427 60 196617 0;
#P window linecount 2;
#P comment 613 356 124 196617 < - Pick only the largest blob.;
#B frgb 15 2 2;
#P window linecount 1;
#P comment 311 387 144 196617 Charmode 1 , Mode 1:;
#B frgb 247 247 247;
#P comment 311 402 144 196617 Blob chosen by size rank;
#B frgb 247 247 247;
#P user jit.pwindow 289 261 162 122 0 1 0 0 1 0;
#P user panel 278 255 183 165;
#X brgb 140 140 140;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 505 353 103 196617 jit.op @op == @val 1;
#P newex 514 308 164 196617 cv.jit.label @charmode 1 @mode 1;
#P window linecount 11;
#P user com 526 152 242 196617 193;
#K set 0 22376 25966 8291 26721 29293 28516 25888 26995 8308 30066 28261 25632 28526 11296 28533 29808 30068 8301 24948 29289 30752 29817 28773 8297 29472 25448 24946 11789 3401 28192 8813 28516 25888 12322 11296 28526 27769 8308 26725 8294 26994 29556 8242 13621 8290 27759 25203 11296 25455 30062 29801 28263 8294 29295 27936 29800 25888 29807 28704 27749 26228 8291 28530 28261 29299 8289 29285 8306 25972 30066 28261 25646 3341 8813 28516 25888 12578 8311 28530 27507 8292 26982 26213 29285 28276 27769 8308 26721 28192 26223 29216 8300 28526 26400 28533 29808 30068 11808 17004 28514;
#K set 100 29472 24946 25888 27745 25189 27749 25632 24931 25455 29284 26990 26400 29807 8308 26725 26994 8307 27002 25888 29281 28267 11808 21608 25888 27745 29287 25971 29728 25196 28514 8297 28192 29800 25888 26989 24935 25888 30569 27756 8290 25888 27745 25189 27749 25632 30569 29800 8308 26725 8310 24940 30053 8241 11296 29800 25888 29541 25455 28260 8300 24946 26469 29556 8311 26996 26656 12844 8289 28260 8307 28448 28526 11808 20334 27769 8308 26725 8300 24946 26469 29556 8242 13621 8290 27759 25203 8289 29285 8306 25972 30066 28261 25646;
#K end;
#P user panel 499 143 279 245;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 1;
#P comment 163 236 65 196617 Binary image;
#B frgb 247 247 247;
#P user jit.pwindow 67 251 162 122 0 1 0 0 1 0;
#P comment 561 439 163 196617 Single-plane long or char matrix.;
#P window linecount 2;
#P comment 559 404 163 196617 Single-plane char matrix. All non-zero pixels are assumed to be ON.;
#P window linecount 3;
#P comment 247 86 105 196617 Change thresholding value to obtain a binary image;
#P number 205 92 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 68 117 103 196617 jit.op @op > @val 10;
#P newex 68 90 64 196617 jit.rgb2luma;
#P comment 512 439 41 196617 Output:;
#B frgb 247 247 247;
#P comment 512 404 34 196617 Input:;
#B frgb 247 247 247;
#P user panel 508 433 51 28;
#X brgb 140 140 140;
#X frgb 198 198 198;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 508 397 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 508 397 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 508 432 218 29;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P hidden newex 620 494 104 196617 bgcolor 210 210 195;
#P window setfont "Sans Serif" 24.;
#P comment 18 -88 646 196632 cv.jit.label: Connected Components;
#B frgb 129 71 36;
#P user panel 201 79 157 49;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 56 230 184 152;
#X brgb 140 140 140;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 260 206 237 40;
#X brgb 248 82 0;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P fasten 22 0 24 0 510 247 295 247;
#P fasten 21 0 22 0 519 339 510 339;
#P connect 34 0 11 0;
#P connect 37 0 34 0;
#P connect 35 0 37 0;
#P connect 36 0 35 0;
#P connect 29 0 22 1;
#P connect 24 0 28 0;
#P connect 11 0 12 0;
#P fasten 13 0 12 1 210 112 166 112;
#P fasten 12 0 21 0 73 170 519 170;
#P connect 12 0 17 0;
#P window clipboard copycount 42;


November 7, 2007 | 12:58 am

cv.jit.blobs.sort is your friend.

On Nov 6, 2007, at 7:52 PM, Erik Mijwaard wrote:

>
> Dear list,
>
> I’d like to track the largest blob (in a room using a camera).
> Therefore I am exploring the cv.jit objects and I think cv.jit.label
> is the one I am looking for.
>
> The problem I run into is that using it with charmode 1 and mode 1 I
> expected to see only the largest blob labelled 1. But instead I get
> the most top/left one. The example below is a stripped down version
> of the help-file and two moving circles, one bigger than the other.
>
> I searched the list and read the help-files but it still don’t get
> it, what am I missing here?
>
> Any help is much appreciated.
> Best regards, Erik
>
> running cv.jit_1.5_jit_1.6_OSX-Intel on a MBP with latest Max+Jitter
>
>
> the patch:
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 2;
> #P user com 271 214 215 196617 46;
> #K set 0 22376 31008 25711 25971 8297 29728 26990 8291 26721 29293
> 28516 25888 12588 8301 28516 25888 12576 29544 28535 8308 26725 8294
> 26994 29556 8308 28528 12140 25958 29728 25196 28514 8297 28275
> 29797 24932 8303 26144 29800 25888 27745 29287 25971 29728 25196
> 28514 16128;
> #K end;
> #P user panel 1205 -49 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 1205 -57 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 1205 -65 148 4;
> #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 389 129 836 437;
> #P window setfont "Sans Serif" 9.;
> #P message 275 229 57 196617 brgb 0 0 0;
> #P newex 275 205 48 196617 loadbang;
> #P newex 89 79 56 196617 t b b clear;
> #N vpatcher 54 74 654 474;
> #P window setfont "Sans Serif" 9.;
> #P newex 50 50 30 196617 t b b;
> #P newex 50 193 161 196617 pack paintoval 0 0 20 20 0 255 0;
> #P newex 161 159 31 196617 + 20;
> #P newex 148 125 67 196617 slide 15. 15.;
> #P newex 148 96 71 196617 drunk 220 10;
> #P newex 83 159 31 196617 + 20;
> #P newex 70 125 67 196617 slide 15. 15.;
> #P newex 70 96 71 196617 drunk 300 10;
> #P inlet 50 30 15 0;
> #P outlet 50 215 15 0;
> #P connect 1 0 9 0;
> #P connect 9 0 8 0;
> #P connect 8 0 0 0;
> #P connect 9 1 2 0;
> #P connect 2 0 3 0;
> #P connect 3 0 8 1;
> #P connect 3 0 4 0;
> #P connect 6 0 8 2;
> #P connect 4 0 8 3;
> #P connect 7 0 8 4;
> #P connect 9 1 5 0;
> #P connect 5 0 6 0;
> #P connect 6 0 7 0;
> #P pop;
> #P newobj 112 155 43 196617 p green;
> #N vpatcher 54 74 654 474;
> #P window setfont "Sans Serif" 9.;
> #P newex 50 50 30 196617 t b b;
> #P newex 50 193 161 196617 pack paintoval 0 0 20 20 255 0 0;
> #P newex 161 159 31 196617 + 50;
> #P newex 148 125 67 196617 slide 15. 15.;
> #P newex 148 96 71 196617 drunk 220 10;
> #P newex 83 159 31 196617 + 50;
> #P newex 70 125 67 196617 slide 15. 15.;
> #P newex 70 96 71 196617 drunk 300 10;
> #P inlet 50 30 15 0;
> #P outlet 50 215 15 0;
> #P connect 1 0 9 0;
> #P connect 9 0 8 0;
> #P connect 8 0 0 0;
> #P connect 9 1 2 0;
> #P connect 2 0 3 0;
> #P connect 3 0 8 1;
> #P connect 3 0 4 0;
> #P connect 6 0 8 2;
> #P connect 4 0 8 3;
> #P connect 7 0 8 4;
> #P connect 9 1 5 0;
> #P connect 5 0 6 0;
> #P connect 6 0 7 0;
> #P pop;
> #P newobj 63 154 33 196617 p red;
> #P inlet 89 52 15 0;
> #P outlet 112 245 15 0;
> #P connect 4 1 2 0;
> #P connect 1 0 4 0;
> #P connect 4 1 3 0;
> #P connect 6 0 0 0;
> #P fasten 4 2 0 0 215 163;
> #P fasten 4 0 0 0 28 159;
> #P connect 3 0 0 0;
> #P connect 2 0 0 0;
> #P connect 5 0 6 0;
> #P pop;
> #P newobj 69 16 56 196617 p rgb flies;
> #P toggle 69 -36 15 0;
> #P newex 69 -15 50 196617 qmetro 5;
> #P newex 69 41 111 196617 jit.lcd 4 char 320 240;
> #P window linecount 2;
> #P comment 527 46 110 196617 Institute of Advanced Media Arts &
> Sciences;
> #B frgb 15 2 2;
> #P window linecount 1;
> #P comment 527 31 110 196617 support:;
> #B frgb 15 2 2;
> #P window linecount 3;
> #P user com 525 -25 118 196617 30;
> #K set 0 25209 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 518 -32 136 110;
> #X brgb 198 198 198;
> #X frgb 140 140 140;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P number 598 332 35 9 1 255 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P user jit.fpsgui 290 427 60 196617 0;
> #P window linecount 2;
> #P comment 613 356 124 196617 < - Pick only the largest blob.;
> #B frgb 15 2 2;
> #P window linecount 1;
> #P comment 311 387 144 196617 Charmode 1 , Mode 1:;
> #B frgb 247 247 247;
> #P comment 311 402 144 196617 Blob chosen by size rank;
> #B frgb 247 247 247;
> #P user jit.pwindow 289 261 162 122 0 1 0 0 1 0;
> #P user panel 278 255 183 165;
> #X brgb 140 140 140;
> #X frgb 0 0 0;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P newex 505 353 103 196617 jit.op @op == @val 1;
> #P newex 514 308 164 196617 cv.jit.label @charmode 1 @mode 1;
> #P window linecount 11;
> #P user com 526 152 242 196617 193;
> #K set 0 22376 25966 8291 26721 29293 28516 25888 26995 8308 30066
> 28261 25632 28526 11296 28533 29808 30068 8301 24948 29289 30752
> 29817 28773 8297 29472 25448 24946 11789 3401 28192 8813 28516 25888
> 12322 11296 28526 27769 8308 26725 8294 26994 29556 8242 13621 8290
> 27759 25203 11296 25455 30062 29801 28263 8294 29295 27936 29800
> 25888 29807 28704 27749 26228 8291 28530 28261 29299 8289 29285 8306
> 25972 30066 28261 25646 3341 8813 28516 25888 12578 8311 28530 27507
> 8292 26982 26213 29285 28276 27769 8308 26721 28192 26223 29216 8300
> 28526 26400 28533 29808 30068 11808 17004 28514;
> #K set 100 29472 24946 25888 27745 25189 27749 25632 24931 25455
> 29284 26990 26400 29807 8308 26725 26994 8307 27002 25888 29281
> 28267 11808 21608 25888 27745 29287 25971 29728 25196 28514 8297
> 28192 29800 25888 26989 24935 25888 30569 27756 8290 25888 27745
> 25189 27749 25632 30569 29800 8308 26725 8310 24940 30053 8241 11296
> 29800 25888 29541 25455 28260 8300 24946 26469 29556 8311 26996
> 26656 12844 8289 28260 8307 28448 28526 11808 20334 27769 8308 26725
> 8300 24946 26469 29556 8242 13621 8290 27759 25203 8289 29285 8306
> 25972 30066 28261 25646;
> #K end;
> #P user panel 499 143 279 245;
> #X brgb 198 198 198;
> #X frgb 140 140 140;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P window linecount 1;
> #P comment 163 236 65 196617 Binary image;
> #B frgb 247 247 247;
> #P user jit.pwindow 67 251 162 122 0 1 0 0 1 0;
> #P comment 561 439 163 196617 Single-plane long or char matrix.;
> #P window linecount 2;
> #P comment 559 404 163 196617 Single-plane char matrix. All non-zero
> pixels are assumed to be ON.;
> #P window linecount 3;
> #P comment 247 86 105 196617 Change thresholding value to obtain a
> binary image;
> #P number 205 92 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 1;
> #P newex 68 117 103 196617 jit.op @op > @val 10;
> #P newex 68 90 64 196617 jit.rgb2luma;
> #P comment 512 439 41 196617 Output:;
> #B frgb 247 247 247;
> #P comment 512 404 34 196617 Input:;
> #B frgb 247 247 247;
> #P user panel 508 433 51 28;
> #X brgb 140 140 140;
> #X frgb 198 198 198;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 508 397 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 508 397 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 508 432 218 29;
> #X brgb 198 198 198;
> #X frgb 140 140 140;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P hidden newex 620 494 104 196617 bgcolor 210 210 195;
> #P window setfont "Sans Serif" 24.;
> #P comment 18 -88 646 196632 cv.jit.label: Connected Components;
> #B frgb 129 71 36;
> #P user panel 201 79 157 49;
> #X brgb 198 198 198;
> #X frgb 140 140 140;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 56 230 184 152;
> #X brgb 140 140 140;
> #X frgb 0 0 0;
> #X border 0;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 260 206 237 40;
> #X brgb 248 82 0;
> #X frgb 140 140 140;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P fasten 22 0 24 0 510 247 295 247;
> #P fasten 21 0 22 0 519 339 510 339;
> #P connect 34 0 11 0;
> #P connect 37 0 34 0;
> #P connect 35 0 37 0;
> #P connect 36 0 35 0;
> #P connect 29 0 22 1;
> #P connect 24 0 28 0;
> #P connect 11 0 12 0;
> #P fasten 13 0 12 1 210 112 166 112;
> #P fasten 12 0 21 0 73 170 519 170;
> #P connect 12 0 17 0;
> #P window clipboard copycount 42;
>
>


November 7, 2007 | 8:37 am

thank you, i will take closer look at that one.


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