Window selection is the main challenge for local stereo matching methods based on the rank transform and it involves two aspects: the rank window selection and the match window selection. Most recent methods only focus on how to select the match window but pay little attention to the selection of the rank window. In this paper, we propose a novel matching method based on adaptive rank transform. Differing with the existing rank-based matching methods, the proposed method can deal with the rank and match window selection at the same time. The experimental results are evaluated on the Middlebury dataset as well as real images, showing that our method performs better than the recent rank-based stereo matching methods.