Optimized Block-based Connected Components Labeling with Decision Trees