To address the problem of segmenting an image into sizeable homogeneous regions, this paper proposes an efficient agglomerative algorithm on the basis of modularity optimization. Given an oversegmented image that consists of many small regions, our algorithm automatically merges those neighboring regions that produce the largest increase in modularity index. When the modularity of the segmented image is maximized, the algorithm stops merging and produces the final segmented image. To preserve the repetitive patterns in a homogeneous region, we propose a feature on the basis of the histogram of states of image gradients and use it together with the color feature to characterize the similarity of two regions.
By constructing the similarity matrix in an adaptive manner, the oversegmentation problem can be effectively avoided. Our algorithm is tested on the publicly available Berkeley Segmentation Data Set as well as the semantic segmentation data set and compared with other popular algorithms. Experimental results have demonstrated that our algorithm produces sizablesegmentation, preserves repetitive patterns with appealing time complexity, and achieves object-levelsegmentation to some extent.