Notify if person is looking through my window, ignore if just passing by

Hello, I just moved into a ground floor flat in a city center. I have windows directly next to a road with lots of people passing by.

I would really like to record and notify if a by passer stops in front of my window, but if they just passes by which 99% does, I would like to ignore it.

Is this possible?

(I am using the indoor pan and tilt camera, it is placed on a shelf pointing to the window)