Tutorial 3 – Relative PTZing

Requirements:
Tutorial 2 – Getting Camera Information


In the previous tutorial, we learned how to get information about cameras in the system.

In this tutorial, we’ll do some basic, relative PTZing. Let’s define what we mean by ‘relative’— in this sense we mean relative to our current position and not absolute. 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.

Let’s begin by setting up our connection to the camera:

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 tilting:

To PTZ relative to the current position we use Ocularis.ICamera’s SetPanTiltRelative method. This method takes a Ocularis.PTZRelativeDirection. In our example, we tilt the camera down, then tilt it back up. You’ll notice that we can give it a direction but the magnitude is predefined.

Next, let’s try panning the camera:

And finally, let’s zoom in and out:

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

That’s it, you can now PTZ a camera relative to the current position.


Next:
Tutorial 4 – Center Relative PTZing