← Back to Lesson 4

Quiz 4: Flood Fill and Connected Components

Score: 0 / 4

. What is the main difference between flood fill and connected-component labeling?

Flood fill needs one seed per region, while cv2.connectedComponentsWithStats scans the whole image and labels every blob at once.

. In the classic stack-based flood_fill_stack algorithm, what happens when a pixel is popped from the stack?

Popped pixels that are background or already filled are simply skipped; otherwise they're marked filled and their neighbors are added to the frontier.

. What does cv2.connectedComponentsWithStats label as component 0?

Label 0 is always the background, so the number of actual blobs is num_labels - 1.

. What extra information does cv2.connectedComponentsWithStats provide alongside the labels, at almost no extra computational cost?

The lesson notes these stats come essentially free as part of the same labeling pass.