Pelco Developer Network (PDN)

Thermography Integration

One feature of the thermography-enabled camera is the ability to monitor zones for temperature changes. The thermography message is communicated through UPnP events. The Pelco API web service that provides this capabiilty is VideoAnalytics:2. Communication with a camera may be accomplished using web service proxy classes in a C# or C++ application.
 
This article discusses:
  • how to enable analytics on the camera
  • using the demo application to view temperature data
  • source code files included in the demo project
  • the XML data exchanged with the camera
Download the accompanying project and pre-built executable here.
 

Enabling Analytics on the Camera

The thermography camera first needs to have analytics enabled. Login to the camera as shown in Figure 1.
 
Figure 1. Camera login dialog.
 
Navigate to Events > Analytic Configuration as shown in Figure 2.
 
Figure 2. Navigate to Analytic Configuration.
 
Figure 3 illustrates the configuration of the Default profile. Select the Behavior > Thermography - Absolute Threshold behavior. Setup two zones, Zone 1 and Zone 2. Use the selection box to set the boundaries of each zone in the camera image box. The Zone Settings can be changed to measure and report the low/average/high temperature in each zone.
 
Figure 3. Configure the zones.
 
Once the zones have been established, click Select Profile > Default > Run to start the profile and its selected behavior.
 

Running the Demo Application

The thermography demo application connects to a camera and retrieves current data for the running profile. The download includes both a Visual Studio C# project and a pre-built executable. Figure 4 shows the folder containing the executable, TMDemo.exe. Launch the application.
 
Figure 4. Demo application folder.
 
The application displays a single window as shown in Figure 5.
 
Figure 5. Demo application at startup.
 
Enter the camera IP address and click Start to begin polling the camera. The current zone data appears in a list on the right side of the window. A line graph of recent values appears in the lower portion of the window. This allows you to spot trends and spikes in the data. See Figure 6.
 
Figure 6. Application receiving temperature data.
 
Click the Get JPEG button to fetch a thumbnail of the current camera image. See Figure 7.
 
Figure 7. JPEG shows current camera image.
 

Source Code

The download includes a Visual Studio C# project (shown in Figure 8) that builds the demo application.
 
Figure 8. Visual Studio project.
 
 
The application can both poll for updates and subscribe to analytic events on the camera for asynchronous notification. The project includes the following source code files:
  • Form1.cs: user interface and camera polling
  • LocalMachine.cs: establish local IP and listening port
  • TmDevice.cs: event subscription and handling
  • VideoAnalyticsV2.cs: proxy classes for the VideoAnalytics web service
The LocalMachine listener is initialized by the Form1 class. Both the polling and subscription mechanisms rely on this listener. Polling is asynchronous, using a timer and callback. The event subscription is also asynchronous, but does not rely on a timer: the camera notifies the listener when an event occurs. Both polling and event subscription use the VideoAnalyticsV2 proxy classes to communicate with the camera.
 

Exchanging XML Data with a Camera

The underlying communication uses XML to set and retrieve zone data. The XML shown here is an example of what is generated (and received) by the class VideoAnalyticsV2.Api.VideoAnalyticsPortType, which is defined in the VideoAnalyticsV2.cs file. Although the zone configuration used in this example does not match the camera setup discussed earlier in this article, the concepts are the same.
 
The function to get the current temperature of every zone (defined area) is GetActiveProfile. It returns 2 outputs:
  • profileId is the id (integer) of currently active/running profile
  • states is an XML-formatted string that has information of every zone
 
 The UPnP XML shown here was generated from camera firmware 20140409030009.9442-O4.10486. Sarix cameras should use 1.9.2.9 or later.
 
This trace shows the XML generated in response to GetActiveProfile. This camera has three defined zones or regions of interest (ROIs). Each region is assigned a temperature threshold. Two regions ("Zone 1" and "Zone 2") have a maximum temperature value assigned, and the third region ("Zone 3") has an average temperature value assigned.
 
Read 1522 bytes from socket. 
NOTIFY /uuid:42a869c2-602b-0d36-1c9f-fade81f0a500/urn:pelco-com:serviceId:VideoAnalytics-2 HTTP/1.1
CONTENT-LENGTH: 1251
CONTENT-TYPE: text/xml
HOST: 10.220.233.217:45678
NT: upnp:event
NTS: upnp:propchange
SEQ: 2
SID: uuid:d9c82fb9-184c-319b-bdf6-a297587407e4

<?xml version="1.0"?>
<e:propertyset 
    xmlns:e="urn:schemas-upnp-org:event-1-0" 
    osid="" 
    status="0" 
    isCombined="0" 
    requireAck="0" 
    eventURI="uuid:42a869c2-602b-0d36-1c9f-fade81f0a504/urn:pelco-com:serviceId:VideoAnalytics-2" 
    serviceType="urn:schemas-pelco-com:service:VideoAnalytics:2" 
    deviceType="urn:schemas-pelco-com:device:Camera:1">
    <e:property>
        <thermography>
            <thermography profileName="Default">
                <rois>
                    <roi type="urn:pelco-com:AlgorithmId:AbsoluteTemperatureThreshold:1" name="Zone 1 pwrbrick" alarmed="1">
                        <temperature max="34.0"/>
                        <vertices>
                            <vertex x="2042" y="4702"/>
                            <vertex x="2042" y="6395"/>
                            <vertex x="3263" y="6395"/>
                            <vertex x="3263" y="4702"/>
                        </vertices>
                    </roi>
                    <roi type="urn:pelco-com:AlgorithmId:AbsoluteTemperatureThreshold:1" name="Zone 2 ph" alarmed="0">
                        <temperature max="25.5"/>
                        <vertices>
                            <vertex x="5986" y="3103"/>
                            <vertex x="5986" y="4859"/>
                            <vertex x="7277" y="4859"/>
                            <vertex x="7277" y="3103"/>
                        </vertices>
                    </roi>
                    <roi type="urn:pelco-com:AlgorithmId:AbsoluteTemperatureThreshold:1" name="Zone 3 wall" alarmed="0">
                        <temperature avg="19.0"/>
                        <vertices>
                            <vertex x="6197" y="7524"/>
                            <vertex x="6197" y="9060"/>
                            <vertex x="7418" y="9060"/>
                            <vertex x="7418" y="7524"/>
                        </vertices>
                    </roi>
                </rois>
            </thermography>
        </thermography>
    </e:property>
</e:propertyset>
 
The application registers for events and receives a notification from the camera when the measured temperature within one or more of the zones exceeds the assigned threshold. In this example, an alarm triggered when the temperature in Zone 2 measured 26.2 degrees.
Read 1570 bytes from socket. 
NOTIFY /uuid:42a869c2-602b-0d36-1c9f-fade81f0a500/urn:pelco-com:serviceId:VideoAnalytics-2 HTTP/1.1
CONTENT-LENGTH: 1299
CONTENT-TYPE: text/xml
HOST: 10.220.233.217:45678
NT: upnp:event
NTS: upnp:propchange
SEQ: 3
SID: uuid:d9c82fb9-184c-319b-bdf6-a297587407e4

<?xml version="1.0"?>
<e:propertyset 
    xmlns:e="urn:schemas-upnp-org:event-1-0" 
    osid="" 
    status="0" 
    isCombined="0" 
    requireAck="0" 
    eventURI="uuid:42a869c2-602b-0d36-1c9f-fade81f0a504/urn:pelco-com:serviceId:VideoAnalytics-2" 
    serviceType="urn:schemas-pelco-com:service:VideoAnalytics:2" 
    deviceType="urn:schemas-pelco-com:device:Camera:1">
    <e:property>
        <analyticAlarm>
            <analyticAlarm type="urn:pelco-com:AlgorithmId:AbsoluteTemperatureThreshold:1" name="Default">
                <alarmState>1</alarmState>
                <roiAlarm>
                    <roiAlarmState alarmSeverity="0" roi="">1</roiAlarmState>
                    <alarmMsg>
                        <objGuid>85c840c7-9653-4c19-8386-bb2a7f3e10cc</objGuid>
                        <texts>
                            <entry>
                                <objGuid>3d047f46-5112-408b-aaa7-d8a19c4564f3</objGuid>
                                <mfi>Analytics/MsgAnalytics</mfi>
                                <msgId>838880800</msgId>
                            </entry>
                            <entry>
                                <objGuid>f77a3580-df8f-4498-adce-b51cb46bf434</objGuid>
                                <text>Thermography - Absolute Threshold</text>
                            </entry>
                            <entry>
                                <objGuid>f77a3580-df8f-4498-adce-b51cb46bf434</objGuid>
                                <text>Default</text>
                            </entry>
                            <entry>
                                <objGuid>f77a3580-df8f-4498-adce-b51cb46bf434</objGuid>
                                <text></text>
                            </entry>
                        </texts>
                    </alarmMsg>
                    <reason>
                        <vertices>
                            <vertex x="5986" y="3103"/>
                            <vertex x="5986" y="4859"/>
                            <vertex x="7277" y="4859"/>
                            <vertex x="7277" y="3103"/>
                        </vertices>
                        <temperature max="26.2"/>
                    </reason>
                </roiAlarm>
            </analyticAlarm>
        </analyticAlarm>
    </e:property>
</e:propertyset>

 

For More Information…

  • The attached archive includes source and executables for an application that subscribes to Thermography events.
  • Read the DeviceSpy tutorial to learn how to probe the services offered by a device.