How to detect the empty parking spots?
Object detection is a regression of the bounding box (rectangle) around the object. In this way, the two ways you suggest are equivalent.

What I suggest you to look at is lane detection for self-driving cars - a well studied problem. It seems that this is a very relevant task (if not the same), so its solution should work for you as well.