A robust RGB-D image alignment method is proposed for autonomously building 3D maps for a service robot equipped with inexpensive RGB-D cameras. The transformation between frames is calculated based on matched sets of feature points, and the RANdom SAmpling Consensus (RANSAC) algorithm is used to eliminate false matchings, and the algorithm's inlier counting policy is modified to adapt to spatial nonuniformity of feature points. Meanwhile, floor information is detected and the coplanar constraint is used to enhance alignment of point sets. Experiments are conducted on RGB-D image sequence collected by robot in a real indoor environment. The error rate of frame-to-frame alignment is zero, and the global floor error is less than 2 cm. The 3D mapping process can be implemented accurately and continuously. Results show that the floor information can effectively improve the global precision of the map, and the method is robust and accurate.