Tutorial 4 – Center Relative PTZing

Requirements:
Tutorial 3 – Relative PTZing


In the previous tutorial, we learned how to PTZ a camera relative to its current position in discrete units.

In this tutorial we’ll center relative PTZ. Let’s define what we mean by ‘center relative’. In this sense, we mean relative to the center of our field of view. The PTZ commands described below move a PTZ camera in discrete units, as opposed to the continuous motion one would expect while holding a joystick at an angle.

Like every PTZ action, a connection to the camera is required:

OCAdapter.OCCamera’s method GetDynamicLiveURL forces a connection to the NVR. A connection to the NVR is required prior to issuing PTZ commands.

Now that we’re connected, let’s do some panning:

Ocularis.ICamera’s method SetPanTiltCenter takes two floats, one representing the x (pan) axis, and the other representing the y (tilt) axis. Each axis has a range of 0.0 to 1.0, with 0.0 representing top and left of the field of view, and 1.0 representing bottom and right of the field of view, respectively.

Next, we’ll do some tilting:

Movie of the final program:
Series-6-Tutorial-4

That’s it, you can now PTZ relative to the center of the field of view.


Next:
Tutorial 5 – Joystick PTZing