Build Webcam and IP camera solutions efficiently in C#.Net
- Quick start
- Online manual
- Start Onvif programming
- C# Onvif.IP.Camera.Viewer
- C# Onvif IP Camera Viewer Git repository
- IP video camera viewer
- PTZ IP camera motion control
- Pan-Tilt-Zoom control
- Automatic movement
- Preset position
- Limit movement angles
- Pan,Tilt and Zoom speed
- Onvif network video recorder
- Motion detection and alarms
- IP camera to SIP video call
- Configure Onvif IP cam remotely
- Onvif IP camera video server
- Video stream on website
- Onvif Network Video Analytics
- Onvif IP Camera Manager
- Computer Vision Technology
- Motion recognition and analysis
- Object detection
- Object categorization
- Image Manipulation
- Ozeki SDK for Linux
- Commercial information
- Download the SDK
- Copy the C# code example into Visual Studio
- Build your IP Camera project
Did you know?
Did you know, that this SDK was used to build Ozeki Camera Recorder?
If you don't want to write code, it could be just what you need. Download it now from the follolwing page: Download Ozeki Camera Recorder.
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.
Figure 1 - Path of the camera in a coordinate system
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.
Figure 2 - Mapping the angles
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.