Virtual Fence Maker
It is often required for local cameras to detect objects when they are inside the speficic area which is already set like a fence. If this area is circle, this will be projected in local cameras as a ellipse shape. So, this area can be masked as an image for this kind of detection. However, the problem is that the center of circle is able to be not only on the ground but also over the ground. Therefore, the circle area should be projected on the ground because objects which are inside this fence go around on the ground.
Getting the Fence Mask
Given the center of fence which is cyan color, its height from the ground which is red color, and its radius, the fence mask can be rendered on the ground as above. The right mask image is extracted from the bottom blue ellipse of the left image. The other shapes like yellow cube and the top blue ellipse are supplements for visual aids. Once the center of fence in the camera view is defined, this point can be transformed in 3D world space and the four points - top, bottom, left, and right - of real circle fence in the world sapce are projected on the camera view again. These four projected points can be used to estimate the ellipse polygon in the camera view by a minimization algorithm.
For the More Accurate Ellipse Mask