For segmentation method to be useful it must be fast, easy to use, and produce high quality segmentations, but few algorithms can offer this in various conditions and applications. In this paper, we propose a context dependent graph-based method for transition region extraction and thresholding. The graph-based approach is introduced into image thresholding, and context dependent graph is constructed from a given image, which can adaptively extract the pixel context and shape information because of the scalable neighborhood. Then an edge weight function is defined as the measure of possible transition pixels, and a robust fully automatic scheme for the optimal threshold is also presented. The proposed approach is validated both quantitatively and qualitatively. Compared with the traditional state-of-art algorithms on synthetic and real images, as well as laser cladding images, the experimental results suggest that the new proposal is efficient and effective.