11.07.2015 Views

Binary Vision

Binary Vision

Binary Vision

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.3 Counting objects -- method 2Recursive_connected_components (B, LB) {LB := negate (B);Label := 0;Find_components (LB, label);Print (LB);}1 0 0 0 0 0 0 0 0 0 01 1 0 0 0 -1 -1 -1 0 0 0Find_components (LB, label) {0 0 0 0 0 -1 0 -1 0 -1 -1for L:= 0 to MaxRow - 1for P:= 0 to MaxCol - 10 0 0 0 0 -1 0 -1 0 0 0if LB[L,P] == -1 then {label := label + 1;0 0 -1 -1 0 -1 -1 -1 0 0 0search (LB, label, L, P);}}search (LB, label, L, P) {LB[L,P] := label;Nset := neighbors (L, P);For each [L’, P’] in Nset {000-100000-1-10000-100000-10000000-1000If LB[L’, P’] == -1 then search (LB, label, L’, P’);}}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!