Region growing

reg_grow(M,x_gridsize,y_gridsize,num_regions) Performs the piecewise-constant energy-based region growing segmentation of M into num_regions regions, using initial grid spaced by x_gridsize along x and y_gridsize along y.

Arguments: