1. An image processing apparatus comprising: a detection unit operative to detect binary and label values of pixels adjacent to a target pixel in a binary image where the target pixel and the adjacent pixels are defined by a transformation matrix; and a labeling unit operative to assign a label value to the target pixel wherein: if none of the adjacent pixels have been assigned a label value, then the target pixel is assigned a new label value, and if any of the adjacent pixels has been assigned a label value, then the target pixel is assigned the same label value.