[Client]动检参数讨论与ONVIF

[问题]客户端访问ONVIF设备动检

客户端要访问ONVIF设备(IPC)的动检,一是事件,二是设置;

此处就是讨论如何设置动检区域的。

通过Video Analytics/Cell Motion Detection可以了解到关于动检的一些ONVIF配置。

参考Video Analytics.–    -34- Annex B. Cell Motion Detection

Video Analytics/Cell Motion Detection

 

参考Video Analytics.Annex B

 

Cell Motion Detector

 规则定义

<tt:RuleDescription Name="tt:CellMotionDetector">
<tt:Parameters>
<tt:SimpleItemDescription Name="MinCount" Type="xs:integer"/>
<tt:SimpleItemDescription Name="AlarmOnDelay" Type="xs:integer"/>
<tt:SimpleItemDescription Name="AlarmOffDelay" Type="xs:integer"/>
<tt:SimpleItemDescription Name="ActiveCells" Type="xs:base64Binary"/>
</tt:Parameters>
<tt:MessageDescription IsProperty="true">
<tt:Source>
<tt:SimpleItemDescription
Name="VideoSourceConfigurationToken" 
Type="tt:ReferenceToken"/>
<tt:SimpleItemDescription 
Name="VideoAnalyticsConfigurationToken" 
Type="tt:ReferenceToken"/>
<tt:SimpleItemDescription Name="Rule" Type="xs:string"/>
</tt:Source>
<tt:Data>
<tt:SimpleItemDescription Name="IsMotion" Type="xs:boolean"/>
</tt:Data>
<tt:ParentTopic>
tns1:RuleEngine/CellMotionDetector/Motion
</tt:ParentTopic>
</tt:MessageDescription>
</tt:RuleDescription>

Cell Motion Analytics Engine

<tt:AnalyticsModuleDescription Name="tt:CellMotionEngine">
<tt:Parameters>
<tt:SimpleItemDescription Name="Sensitivity"
Type="xs:integer"/>
<tt:ElementItemDescription Name="Layout" Type="tt:CellLayout"/>
</tt:Parameters>
</tt:AnalyticsModuleDescription>
<xs:complexType name="CellLayout">
<xs:sequence>
<xs:element name="Transformation" type="tt:Transformation"/> 
<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="Columns" type="xs:integer" use="required"/>
<xs:attribute name="Rows" type="xs:integer" use="required"/>
<xs:anyAttribute processContents="lax"/>
</xs:complexType>


 

参考示例

example for CellMotionEngine

Cell Motion Detector rule configuration

<tt:VideoAnalyticsConfiguration>
<tt:RuleEngineConfiguration>
<tt:Rule Name="MyMotionDetector" Type="tt:CellMotionDetector">
<tt:Parameters>
<tt:SimpleItem Name="MinCount" Value="4"/>
<tt:SimpleItem Name="AlarmOnDelay" Value="1000"/>
<tt:SimpleItem Name="AlarmOffDelay" Value="1000"/>
<tt:SimpleItem Name="ActiveCells" Value="/v/+8A=="/>
</tt:Parameters>
</tt:Rule>
</tt:RuleEngineConfiguration>
</tt:VideoAnalyticsConfiguration>

 

ActiveCells : 灰色表示已选单元格,图示对其按位掩码表示的十六进制表示为: "ff ff ff f0 f0 f0".  再应用Packbit 算法压缩则得到的字节序列为: "fe ff fe f0". 最后,通过base64Binary编码该序列则得到这样一串值: "/v/+8A==";

提示:

  1. 已知掩码字节序列,然后需要应用Packbit算法来进行压缩,参见 ISO 12369 (TIFF, Revision 6.0).
  2. base64编码,gsoap已经提供非常有益的支持;

CellMotionEngine configuration

<tt:VideoAnalyticsConfiguration>
<tt:AnalyticsEngineConfiguration>
<tt:AnalyticsModule Name="MyCellMotion" Type="tt:CellMotionEngine">
<tt:Parameters>
<tt:SimpleItem Name="Sensitivity" Value="90"/>
<tt:ElementItem Name=”Layout”>
<tt:CellLayout Columns="8" Rows="6">
<tt:Transformation>
<tt:Translate x="-0.66666" y="-0.6" />
<tt:Scale x="0.1666666" y="-0.2" />
</tt:Transformation>
</tt:CellLayout>
</tt:ElementItem>
</tt:Parameters>
</tt:AnalyticsModule>
</tt:AnalyticsEngineConfiguration>


我们主要需要理解的是Transformation信息。关键是这个数据是如何度量的。

ONVIF默认参考系是原点设在画面中央,参考5.1.2.2  Spatial Relation 的example, 所举例详述是将320*240分割成2*2形式,原点置中央,其中比例与原尺寸关系为

Image.Size*Scale = [2,2];

现在再来看当前举例,此时并非2*2,而是8*6,不过我们可以抓住上例关系。可以得知到,Image.Size*[Scale] = 2*Cell.Size.

此时,我们发现[Scale]和5.1.2.2中例是有差异的这个[Scale]是坐标单位转换的缩放尺度,我们需要从单元格的尺度来来度量这个坐标转换关系,因此,

Translate >平移

这个向量是平移的缩放度量,

因此,通过这个向量我们可以计算出原点在默认参考系中的坐标值;即Translate/Scale 得到原点在默认参考系的是坐标是(-4,3);

Scale >缩放

这个向量是比例的缩放度量。

根据Image.Size,通过该向量可以计算出单元格的像素大小。

原文地址:https://www.cnblogs.com/qianwen36/p/3967455.html