This will work fine. The easiest way to do this is using IR Sensor Module.
This will give you a digital output of weather there is someone in front of sensor or not. Use can use it as Edge Trigger to Humans passing by.
You can buy one. They are both cheap and easily available.
Or you can create your own.
