changed the return format to be in CV_32F. Boundary pixels have value 0, segments 1, 2, 3, ... etc