Requirements for generic grouping in vision and an algorithm