Perceptual grouping, or perceptual organization, is the process of grouping local image features, such as line segments and regions, into groups (`perceptual chunks') that are likely to have come from the same object. Such an operation is essential to reliable and robust object recognition since the local features are often fragmented and cannot be matched directly to object models. In this paper, a novel approach to the problem of perceptual grouping is described. In this approach, perceptual grouping is accomplished in two steps. First, connections between local features are established or rejected according to which such connections would lead to good global groupings. This is done by performing a tree search of all the possible global groups associated with each potential connection. Second, perceptual groups are generated by propagating local connections and by local competition. The efficacy of this approach is demonstrated on the grouping of line segments in synthetic and real-world images.