add two-pass connected-component labeling function