The task of robotic human-following requires a mobile robot to detect and follow the selected target person and maintain an appropriate distance to the person. In practical applications, the robot must continuously estimate the target location considering unexpected obstacles to keep stable human-following control. This paper proposes to combine human-following control with obstacle avoidance, so that the robot can avoid obstacles while simultaneously follow the target person. In this design, obstacle as well as human features are obtained by using a RGB-D camera. A deep neural network(DNN) model works to detect and identify the user in the environment. An improved artificial potential field (APF) is applied to robot motion planning by integrating the target human position and obstacle information. Practical experiments on a mobile robot verified the proposed method. The robot can follow the user stably while avoiding obstacles in an indoor environment.