Dorsal hand vein recognition is a kind of biometric technique that has emerged in the last two decades. Owing to its safety, accuracy, and effectiveness, more and more researchers are involved in the study. Here, the authors presented a dorsal hand vein recognition system under uncontrolled environments based on biometric graph matching (BGM). Firstly, the authors establish two hand vein databases under natural indoor lighting conditions, i.e. XJTU-A and XJTU-B, with the hand not fixed. Secondly, the authors focus on optimising the image preprocessing steps in terms of region of interest (ROI) extraction, vein segmentation, and vein skeleton extraction. An 'open' operation with a large parameter is carried out to make the ROI extraction more abundant based on the maximum inscribed circle. In vein segmentation, the authors use the curvature point algorithm to better extract the vein skeleton. Thirdly, BGM algorithm is adopted to obtain distance measurements. The authors use single distance measure and multiple distance measures to obtain the threshold for recognition, respectively. Finally, the proposed dorsal hand vein recognition system is tested in three databases, and experiment results show that the improvement of the entire algorithms leads to high accuracy and strong robustness of the recognition system, whether under uncontrolled or controlled conditions.