首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >带有图片Hikvision节点的ANPR事件

带有图片Hikvision节点的ANPR事件
EN

Stack Overflow用户
提问于 2022-03-16 12:01:38
回答 1查看 581关注 0票数 1

我订阅了Hikvision摄像机向/ISAPI/Event/notification/alertStream发出get请求的事件。我对ANPR事件感兴趣,这类事件返回一个包含事件信息的xml、车牌图片和车辆图片的多部分响应。所有这些信息都来自不同的缓冲区,因为有大量的信息,所以我将这些缓冲区转换成字符串,然后将它们放在一起,直到找到分隔符--边界--。现在,当我得到一个完整的事件时,我尝试处理这个事件,首先我得到了xml,在其中我有信息,我可以正确地得到我所需要的一切,但是我无法将图像保存在我的计算机中。下面是事件信息的一个示例:

代码语言:javascript
运行
复制
> Content-Disposition: form-data; name="anpr.xml"; filename="anpr.xml"
> Content-Type: text/xml Content-Length: 2230
> 
> <?xml version="1.0" encoding="UTF-8"?> <EventNotificationAlert
> version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
> <ipAddress>192.168.55.6</ipAddress>
> <ipv6Address>::ffff:192.168.55.6</ipv6Address> <portNo>80</portNo>
> <protocol>HTTP</protocol> <macAddress>08:a1:89:ff:6e:1a</macAddress>
> <channelID>1</channelID>
> <dateTime>2022-03-16T13:54:03+01:00</dateTime>
> <activePostCount>1</activePostCount> <eventType>ANPR</eventType>
> <eventState>active</eventState>
> <eventDescription>ANPR</eventDescription> <channelName> asdfg
> </channelName> <ANPR> <country>0</country>
> <licensePlate>unknown</licensePlate> <line>1</line>
> <direction>forward</direction> <confidenceLevel>0</confidenceLevel>
> <plateType>unknown</plateType> <plateColor>unknown</plateColor>
> <licenseBright>0</licenseBright> <dangmark>unknown</dangmark>
> <twoWheelVehicle>yes</twoWheelVehicle>
> <plateCharBelieve></plateCharBelieve>
> <vehicleType>nonmotorVehicle</vehicleType> <detectDir>8</detectDir>
> <detectType>5</detectType> <alarmDataType>0</alarmDataType>
> <vehicleInfo> <index>1344</index> <colorDepth>0</colorDepth>
> <color>unknown</color> <speed>0</speed> <length>0</length>
> <vehicleLogoRecog>0</vehicleLogoRecog>
> <vehileSubLogoRecog>0</vehileSubLogoRecog>
> <vehileModel>0</vehileModel> </vehicleInfo> <pictureInfoList>
> <pictureInfo> <fileName>nonMotorPicture.jpg</fileName>
> <type>nonMotorPicture</type> <dataType>0</dataType>
> <picRecogMode>0</picRecogMode> <absTime>20220316135403615</absTime>
> <pId>2022031613540382300NhqQD51oTGTYE</pId> </pictureInfo>
> <pictureInfo> <fileName>detectionPicture.jpg</fileName>
> <type>detectionPicture</type> <dataType>0</dataType>
> <picRecogMode>0</picRecogMode> <absTime>20220316135403615</absTime>
> <plateRect> <X>0</X> <Y>0</Y> <width>0</width> <height>0</height>
> </plateRect> <pId>2022031613540382300KBGZqPyyVYGta</pId>
> </pictureInfo> </pictureInfoList>
> <originalLicensePlate>unknown</originalLicensePlate>
> <CRIndex>0</CRIndex> </ANPR>
> <UUID>2022031613540382300Y3s6LFDQIWOfg73fuU9UVFguFLf40ucwK0ghCc8iVMPG</UUID>
> <picNum>2</picNum> <monitoringSiteID></monitoringSiteID>
> <isDataRetransmission>false</isDataRetransmission>
> </EventNotificationAlert>
> 
> 
> 
> Content-Disposition: form-data;
> name="2022031613540382300NhqQD51oTGTYE.jpg";
> filename="nonMotorPicture.jpg" Content-Type: image/jpeg
> Content-Length: 62407
> 
> ����►JFIF☺☺☺☺���☻☺☺☺☺☺☻☺☺☺☻☻☻☻☻♦♥☻☻☻☻♣♦♦♥♦♠♣♠♠♠♣♠♠♠    ♠        ♠♂
> 
> 
> 
> 
> ♂♀♂ ♀
> 
> 
> ☺☻☻☻☻☻☻♣♥♥♣ ♠ ....
> 
> Content-Disposition: form-data;
> name="2022031613540382300KBGZqPyyVYGta.jpg";
> filename="detectionPicture.jpg" Content-Type: image/jpeg
> Content-Length: 717259
> 
> ����� [ID = 1344 pr= type=0x60] [cur_frm_num=395344
> snap_frm_num=395344 ps_frm_num=0] [obj_rect = 0.023958x0.566667,
> 0.101562x0.292593] [plate_rect = 0.000000x0.000000, 0.000000x0.000000] �D☻�D☻�?�)♦↑⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂X��♥∟☻♣(=→♥♥☻‼☺
> ♥       ☻♦
> ⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂�☺�)♦↑♀♥♠☺�Q�☺�8♦☺♣♥♦☺☻�8�∟z?☻�?�∟z?♦9��>V♫->♦'1h?♦���>�I�>?5�>d;⌂?♦�K↨?333>☻�?�(<?TDD�<◄◄◄?☻�=�Ε>⌂⌂2☺G.☺d☻�☺�♥⌂
> 6778KZ5↓�♥☻6778KZ5↓�♥☻6778KZ5↓�♥☻6778KZ5↓�♥⌂⌂⌂⌂⌂c6778KZ5↓¶#♣⌂⌂⌂⌂⌂j♠⌂▲6778KZ5↓¶#♣⌂⌂⌂⌂⌂j♠⌂▲6778KZ5↓¶#♣⌂⌂⌂⌂⌂j♠⌂▲6778KZ5↓¶#♣⌂⌂⌂⌂⌂j♠⌂▲6778KZ5↓¶#♣⌂⌂⌂⌂⌂♠⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂♠♥♥
> K.☺d☻�☺�♥♦☺�☺C♥7♦☻♣�☺⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂⌂5♂�������♠♦♣♠♣♦♠♠♣♠♠ ►
> 
> 
> ¶♫☼♀►↨¶↑↑↨¶▬▬→↔%▼→∟▬▬↓▼-(0%()(☺
> 
> ‼
> 
> ‼(→▬→((((((((((((((((((((((((((((((((((((((((((((((((((☻
> 
> ‼
> 
> ‼(→▬→((((((((((((((((((((((((((((((((((((((((((((((((((��♦��♥☺"☻◄☺♥◄☻��☺�☺♣☺☺☺☺☺☺☺☻♥♦♣♠
> ♂►☻☺♥♥☻♦♥♣♣♦♦☺}☺☻♥♦◄♣↕!1A♠‼Qa"q¶2��#B��§R��$3br�
> ▬↨↑↓→%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������☺♥☺☺☺☺☺☺☺☺☺☺☻♥♦♣♠
> ♂◄☻☺☻♦♦♥♦♣♦♦☺☻w☺☻♥◄♦♣!1♠↕AQaq‼"2¶B����  #3R�§br�
> ▬$4�%�↨↑↓→&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������♦x��♀♥☺☻◄♥◄?���N�H�R���r♫☻��☻�j
> ▼�ͱ�♫�◄jijc5♥¶�T�Q榈U!‼�*�x���X��4�0�74��3OZ�→�*�L�)��wݐ§7����⌂�1j;�v��>����A'��☻d���
> ��I�-�ʳ[�4d��E�I↑�#"���8▲���]�‼��_���☻~��صm>�K�7:����P�e♣�☺��\�6Z4�T}�H!z���:����6���;D↨���RW
> 6=W�zU♂]_I�����♀Я�l��B�♣��Y����:♀IzdK���d�M�F&@�p=�z��.�GZgKk�-n��'9�&f☺dC�i>��>�J�\�����▼��.‼��8↓n���sY�~�⌂-���→5�ݔR����→0�N
> �♫F�9�♠j��s↔����♫�lo��O%ͪH�!�z��C☼�▲�z�w↓Ң4i§Φ�%�q↨f��♫G�►v�rz�Yo(��Ķ�]�ڭ�v�eUg��G&��NB6223Y��)d�►�7→����R������↓[��n�OZ׬[WӯⅥ�d◄O♦��o,��'i�u攛�I∟���It.t�#V��qnLA��
> ʌ���♥W��$Վ�$�O��k��hg�\��>����♠��▲՝�☺g�,�↕5��O�D7�♫��n
> ���q�*���a�u;$�/4���.�♥�9E]��T‼��↔;P��3��Ҡ�B��-��↕�§
> ��o�ӣ�c:m���g��-���>�Ժ]�1Gl0Q�uK�►☺�O�m� ⌂��z�o�U�f�#za����pj 
> N�Z�s�p�)���?��n�Xna�u↑I͌��o .....
EN

Stack Overflow用户

发布于 2022-09-25 09:22:49

伙计,前面还有很长的路。忍受我吧。

当您获得

  1. 时,我想您已经正确地配置了摄像机中的ANPR侦听端口。现在,它的<<Listening_Server>>:<<Listening_Port>>/test
  2. Create
  3. 安装PHP8.0(到现在为止没有web服务器需要测试)
  4. 默认情况下,照相机应该在

中发布一个名为php_anpr的文件夹,在它内部创建一个文件夹测试

  1. ,在测试文件夹中创建另一个文件夹,在名为index.php的测试文件夹中创建一个文件,并粘贴下面的代码

G 216

代码语言:javascript
运行
复制
<?php
//php -S SERVER:PORT -t test

$id = '_'. date('Ymd_hmis');


//file_put_contents('images/LPR_JSON'.$id.'.json', json_encode($_FILES));

function WriteSingleFile($xid) {
    
    foreach ($_FILES as $file) {
        $key = $file['name'];
        $info = pathinfo($file['name']);
        $tempfilename = $file['tmp_name'];
        $extension = $info['extension'];
        $newname = 'LPR'.$xid.'_'.$key;
        $target = 'images/'.$newname;
        move_uploaded_file( $tempfilename, $target);
    }
}

WriteSingleFile($id);

?>

  1. 现在打开windows终端中的php_anpr文件夹,并在替换您的pc和端口(8080)的IP后粘贴以下内容-注意:您还必须配置摄像机,以便在同一个IP和端口

中发送php_anpr信息。

代码语言:javascript
运行
复制
php -S SERVER:PORT -t test

等待某个车辆在摄像机警告流中被触发

它将向您发送至少2个文件检测图片和anpr.xml,只有当被检测到牌照时,您将得到车牌picture.jpg。

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71496744

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档