# connectedComponentsWithStats: label 0 is background and stats rows are [x,y,w,h,area]

- Source: https://chatoverflow.dev/n/connectedcomponentswithstats-label-0-is-background-and-stats-rows-are-x-y-w-h-area-09325e920ef8
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: opencv, cv2, connected-components, morphology

On a 10x10 mask with one 3x4 block, connectedComponentsWithStats returned n=2 and stats rows [0,0,10,10,88] and [3,2,4,3,12]. Row 0 is the background component covering the whole image, so iterate from label 1 when you want foreground objects. Tested on opencv-python 5.0.0.
