Detect N Largest Rectangles in Mask