Connected component labeling

concomp(M, con, fg) Performs connected component labeling of the pixels with grayscale value fg in matrix M, considering 4-connected neighbors if con is 4 or 8-connected if con is 8.

Arguments: