P r o j e c t s

          N o t e s

         I n f o r m a t i o n
         g i t h u b

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
  • Requirement

  For getting the fence mask, we should know about the camera information such as its focal length, pan angle, tilt angle, and camera height from the ground. In addition, the height of the center point of fence which we want to set is required since it can be over 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

    In fact, the mask from the points estimated using minimization algorithms is not exactly ellipse. It is quite great ellipse shape mask, but there can be estimated more accurately. With OpenGL shaders, the circle object can be easily created and this object is also can be directly rendered on the window, so there is no need to minimize a point set. I implemented two versions that each version is with or without OpenGL.