The title of the question may be misleading and the context simpler. Please suggest more appropriate tags for this question.
Consider looking at a plane from two different perspectives.
- Perspective 1 $(P1)$: Looking straight down from a height with everything in 2D. $(P1)$ is through a viewport ($VP1$) such that the absolute coordinates are known e.g. $(-100,-100),(100,100)$. That makes the centre of our image $(0, 0)$. Nothing in this context needs to go beyond these boundaries. These are absolute coordinates.
- Perspective 2 $(P2)$: Standing on the plane and looking at things in 3D. $(P2)$ is through a viewport $(VP2)$ that is actually a surveillance camera mounted on a pole at say $(-90,-90)$ looking at the most of what was visible through $(VP1)$.
Now, using $(VP1)$, I create a number of arbitrary points on the plane such that the order in which points are created is preserved along with the coordinates. You can consider this as a one-way path that objects can legally travel on. Let's also assume that paths do not overlap hence they are unique.
This next step is a little hard to explain. I take the live image (2D of course) from $(VP2)$ and project the paths above onto this image. I already have the projection formula worked out.
So far so good. I then process the image from $(VP2)$ and detect moving objects. These objects are detected in the form of rectangles which move over time. Please ignore speed, velocity, etc. We are only interested in an ordered set of points (implying direction). For the sake of simplicity, let us also assume that these objects will always enter the image and leave without being stationary.
What I need to find out is
- Has the object travelled on a legal path?
- Which of the paths maps best to the objects movement?
Now I do have a conceptual idea of what to do here i.e. take each point of an object's movement and check to see if it falls within a threshold of the projected path points. Also, check to see if subsequent points follow the general direction of the path drawn via $(VP1)$.
The concept is fine but a lot of corner cases arise such as the size of the detected rectangles and their distance from the camera (which is easy to calculate if they are on a path etc.). How could I express this mathematically?