Using KlvOverlay WPF control

In this article I’ll show how to use a KlvOverlay control  as an important building block for an advanced situational awareness application.

KlvOverlay WPF control is a .NET library that implements an overlay functionality for On-Demand / Live FMV  applications that use a geo-spatial STANAG metadata.  KlvOverlay WPF Control provides the functionality similar to StanagOnDemand Server overlay (online demo of the control).

Let’s assume we have to create an application capable of playing back STANAG files and live streams, extract MISB 0601.X and 0903 (VMTI) information, present it as video overlay and control a map using available geo information.
We’ll create a simple application, going over points of interest blow by blow. First, let’s see how to use the control with an arbitrary video player (for example WPF MediaElement) and then, in more details, how to use it with KlvPlayer SDK and real MISB data. 
Let’s dive in and get started. We’ll start simple and build a skeleton application, then we can take our basic application and refine it.
1. Create a simple WPF application and add a MediaElement to it.

Add some video source to the Media Element.

We should now see something like this.

If  LoadedBehavior of the MediaElement is set to Manual, we can wire the buttons to control our simple player.

Next, add a reference to the KlvOverlay control.

Make the following changes to the XAML, placing control over the video.

Now, if we run our application, we can play video and see an overlay, which is not that useful yet as it only shows some static info. As it is impossible to receive any Klv metadata from the MediaElement, let’s assume we get it in a some magic way (out of band)  just to verify everything is working as it supposed to.

I’ll use a KlvInspector’s Monitor to extract a MISB metadata into json file.

Assuming the json data is saved as Resource in our application, all we have to do is to call

Note, you can provide a raw klv packet instead of json. In that case, it will be decoded internally.

Now, our overlay is updated with the metadata present in json and it becomes a “geo aware” overlay. You can see some basic telemetry presentation, a compass, etc.

Next step will be adding events to KlvOverlay control, so we could get functionality needed for our basic Situational awareness application.

For example, let’s add an event that will fire when we move a mouse over the video and provide us with both mouse coordinates and corresponding  lat / long.

Here is the event handling implementation:

If we run the application and move a mouse over the video, we’ll get mouse coordinates and  lat / long printed. Replace the printout with a map control functionality, and you get something pretty useful… Could not be easier than that 🙂

We can add a very similar functionality to get a special marker coordinates. This time, in order to actually see a marker and be able to move it, we must enable it using KlvOverlay’s control property.

Of course, what we see is not accurate (if the video is playing) as our metadata is static, but you got the point…

You can use internal control tools and select some area on your video.

When you finish drawing the area, the GeoJsonFeatureCreated event will fire and you’ll get it as GeoJson.

There are more features, like setting the Annotation layers, measuring distances directly on your video, etc.

KlvOverlay control comes with 2 sample projects. The first one, which we just went through, shows how to use the control.

The second project (KlvPlayerDemoWpf) uses KlvPlayer SDK, so it is capable of STANAG files / streams playback and video frame / decoded metadata packet synchronization, so it has all the building blocks for the real application.

 

No Comments

Post a Comment