[pixkit cv] labeling: Image labeling - yunfuliu/pixkit GitHub Wiki

twoPass

Label connected-components with two passes.

[Reference] http://en.wikipedia.org/wiki/Connected-component_labeling

[Developer] Cheng-Hsin Chang ([email protected])

C++: bool labeling::twoPass(const cv::Mat &src,cv::Mat &dst,const int offset=1)

Parameters:

  • src - The source image with CV_8UC1 format. Notably, this input image treats white color (w/ value 255) as components, and black color (w/ value 0) as background. Thus normally, input image is also a binary image, and this function will color each component with a same value.
  • dst - The destination image with CV_32SC1 format. In this output image, the first labelled component will be filled with the value at offset; otherwise, 1 will be assigned as default.
  • offset - The value for the first labelled components, and the Nth component will be filled with offset+N as its value. Value 1 is set as its default for the first component.

Example:

pixkit::labeling::twoPass(src,dst,100);