The invention discloses an OpenCV-based automatic face recognition book sorting and shelving robot system. The invention relates to a library book automatic sorting and shelving robot which integratesthe work of borrowing, returning, checking, classifying, shelving and the like of books. An OpenCV-based face recognition technology is introduced for a reader to borrow or return books. The full name of OpenCV is an Open Source Computer Vision Library. OpenCV can easily process image output and input, memory allocation and conversion, matrix operation, linear operation, support for multiple dynamic data structures, basic image processing work, structure analysis algorithm, camera calibration algorithm, motion analysis of target objects, visualization, image labeling and the like of images.