This paper studies the leader-following formation control problem for a group of nonholonomic mobile robots. Different from existing literature, the orientation of each robot is not required to be known, whose accurate value is usually difficult or expensive to obtain via direct measurement. A nonlinear observer is proposed to estimate the orientation of each robot, based on which an obstacle-avoidance constraint using observer-based control barrier function (CBF) is presented, such that the formation problem is converted into a constrained quadratic program (QP), and the desired formation is guaranteed with both static and dynamic obstacles being around. In addition, in order to make the state information of the leader be available to each follower, a new adaptive distributed observer is developed, which eliminates the requirement for leader's acceleration, and avoids the system chattering. Finally, simulation examples and comparisons are provided to validate the effectiveness of the proposed method.