In or Out ?

Possible for sure.
Detecting the dog passing through the door can be done in many ways - detecting in WHICH DIRECTION he's going is a much harder problem.