We present an algorithm that extracts curves from a set of edgels within a specific class in a decreasing order of their ``length''. The algorithm inherits the perceptual grouping approaches. But, instead of using only local cues, a global constraint is imposed to each extracted subset of edgels, that the underlying curve belongs to a specific class. In order to reduce the complexity of the solution, we work with a linearly parameterized class of curves, function of one image coordinate. This allows, first, to use a recursive Kalman based fitting and, second, to cast the problem as an optimal path search in an directed graph. Experiments on finding lane-markings on roads demonstrate that real-time processing is achievable.