How to limit movement angles in C#
This description demonstrates how the PTZ control angles limitation works theoretically and practically. To implement PTZ control angles limitation functionality, you need to have Ozeki Camera SDK installed, and a reference to OzekiSDK.dll should be added to your Visual Studio project.
Necessity of setting movement angles
Firstly it is worth to mention a few cases when it is useful to limit the movement angles of the camera. After setting the camera up in a corner of a ceiling you need to set the camera angles, because if it moves more than e.g. 50 degrees to right than the camera will hit the wall. Furthermore if you want to do automatic scanning but you don't want to see the unnecessary zones or private areas than you should limit the angles of the rotation.
How does the PTZ work?
As it was mentioned in the previous lectures PTZ supporting cameras, have a path where they can move. This path can be imagined like two circle plains, which are perpendicular on to each others (Figure 1). Technically when we add angles to limit the monitoring area, then these angles will be mapped into a coordinate system. The X axis represents the PAN, which is the horizontal movement. The Y axis represents the TILT, which is the vertical movement. If it would be a third Z axis, that would be the ZOOM, but it is not part of this description.
Mapping the angles
After the angles are given you can map them with trigonometric functions. In the below example (Figure 2) you can see if you want to monitor an 80 degrees area (30 degrees to left, 50 degress to right), than you need to set the minimum value to -0.5 and maximum value to 0.766 of the X (PAN) axis. This values came from sin(30) = 0.5 and sin(50) = 0.766. This example does not include the Y (TILT) axis.
NOTE: This mapping works at those cameras, which have a maximum of 180 degrees(90 degrees to left, 90 degrees to right) rotation. Those cameras which can rotate more have to handle what happens when they are given e.g. 150 degrees to left, because it would be equal with 30 degrees to right rotation.
sin(30) = sin(150) = 0.5
However practically there are cases when you can not reach this property, so you must limit the angles by limiting the scanning time with fixed camera speed. In this case for example a 1 second scan in one way monitors a 30 degrees area.
Below you can find the answers for the most frequently asked questions related to this topic:
Why can not I zoom?
Some cameras does not support it.
Why is the camera moving, when I am not using it?
It is possible that someone else is also using the camera.
Why can not I turn the camera in bigger angle than the current?
Because all cameras have a limit in rotation.