I am having a thesis right now regarding a robot. My research requires the robot to be attached to linear guide rail. A robot has to detect human in a very close range (of about 2 meters distance). What easiest and efficient method or components shall I use?
Following a human can be relatively easy, but it depends on your requirements and your sensors on how easy this is. If you use ROS there are some available packages:
- people_tracker which uses a Kinect.
- Person-following and Detection in an Indoor Environment: combines a face and leg detector.
- ppl-detection also uses a Kinect.
- lidar-tracking: lidar used to track people, but they say it is not robust.
- cyphy_people_mapping: other that uses Kinect. (See their paper)
We  use a boosting leg detector  which provides the position of potential people using horizontal front and rear range laser sensors. A Multiple Hypothesis Tracking For Multiple people  keeps the track of the people and assigns them identifiers. Since we also want to identify the person for large distances we use AR tags which has as advantage that it is robust and easy to install.
So depending on what sensors you have, I think, the easiest way might be to use a leg detection algorithm (using range lasers) or an AR tag (using a camera and tag).
 A. Goldhoorn, A. Garrell, A. Sanfeliu, and R. Alquézar, “Continuous real time pomcp to find-and-follow people by a humanoid service robot,” in Proceedings of the IEEE-RAS International Conference on Humanoid Robots, 2014, pp. 741–747.
 K. O. Arras, O. M. Mozos, and W. Burgard, “Using boosted features for the detection of people in 2d range data,” in Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), 2007, pp. 3402–3407.
 S. S. Blackman, “Multiple hypothesis tracking for multiple target tracking,” IEEE Aerospace and Electronic Systems Magazine, vol. 19, no. 1, pp. 5–18, 2004.
On the robotshop.com - how to make a robot guide they propose to use an ultrasonic or infrared distance sensor(s), a camera and GPS:
... the most appropriate sensors to allow a robot to follow a human may be ultrasonic or infrared distance sensor(s), a camera and GPS. A camera may be used to pick up a specific pattern placed on the shirt of the individual to follow while GPS units mounted on the robot and on the human would help the robot find the human if she cannot be seen visually. Distance sensors would ensure the robot does not get too close to the human. Therefore when choosing sensors to help your robot follow a human, the sensors listed above would be a good starting point.
The most reliable way to do this is using computer vision. If I were to do it, I would do middle mass detection on the color red, and wear a bright red shirt. As long as a Ferrari doesn't drive by, your robot will always follow you.
On norrislabs.com they explain how they made a robotic stool which is able to to follow a person using heat sensing. Which is based on their Follow Me Rover. They have all the schemas and source code on their page.
In the article A Study on Techniques of Person Following Robot they give a nice overview of different detection and tracking techniques and sensors used by several researchers: laser range finders, stereo cameras, Kinect.