基於python完成大華攝像頭對貨車逆行實時檢查的二次開發

吐槽的地方。大華的攝像頭逆行事件不能單獨篩選出貨車,所以沒辦法只有自己寫東西實現。

注意事項:數據類型一定要對應C源代碼SDK的排序否則獲取的數據不對或獲取不到。以下是逆行事件的數據結構及排序

class DEV_EVENT_TRAFFIC_RETROGRADE_INFO(Structure):
    """
    逆行事件
    """
    _fields_ = [
        ('nChannelID', c_int),              # 通道號;ChannelId
        ('szName', c_char*128),             # 事件名稱;event name
        ('bReserved1', c_ubyte*3),          # 保留字節,留待擴展.;Reserved bytes, leave extended_
        ('PTS', c_double),                  # 時間戳(單位是毫秒);PTS(ms)
        ('UTC', NET_TIME_EX),               # 事件發生的時間;the event happen time
        ('nEventID', c_int),                # 事件ID;event ID
        ('nLane', c_int),                   # 對應車道號;road number
		('stuObject', SDK_MSG_OBJECT),		# 車牌信息
        ('stuVehicle', SDK_MSG_OBJECT),     # 車身信息;vehicle info
        ('stuFileInfo', SDK_EVENT_FILE_INFO),  # 事件對應文件信息;event file info
        ('nSequence', c_int),               # 表示抓拍序號,如3,2,1,1表示抓拍結束,0表示異常結束;snap index,such as 3,2,1,1 means the last one,0 means there has some exception and snap stop
        ('nSpeed', c_int),                  # 車輛實際速度Km/h;car's speed (km/h)
        ('bEventAction', c_ubyte),          # 事件動作,0表示脈衝事件,1表示持續性事件開始,2表示持續性事件結束;Event action,0 means pulse event,1 means continuous event's begin,2means continuous event's end;
        ('byReserved', c_ubyte),            # 保留字節;reserved
        ('byImageIndex', c_ubyte),          # 圖片的序號, 同一時間內(精確到秒)可能有多張圖片, 從0開始;Serial number of the picture, in the same time (accurate to seconds) may have multiple images, starting from 0
        ('dwSnapFlagMask', C_DWORD),        # 抓圖標誌(按位),0位:"*",1位:"Timing",2位:"Manual",3位:"Marked",4位:"Event",5位:"Mosaic",6位:"Cutout"
        ('stuResolution', SDK_RESOLUTION_INFO),  # 對應圖片的分辨率;picture resolution
        ('bIsExistAlarmRecord', c_int),		# rue:有對應的報警錄像; false:無對應的報警錄像
		('dwAlarmRecordSize', C_DWORD),		# 錄像大小
		('szAlarmRecordPath', c_char*256),
        ('stuIntelliCommInfo', EVENT_INTELLI_COMM_INFO),  # 智能事件公共信息;intelli comm info
        ('stuGPSInfo', NET_GPS_INFO),       # GPS信息 車載定製;GPS info ,use in mobile DVR/NVR
        ('bReserved', c_ubyte*8),          # 保留字節,留待擴展.;Reserved bytes, leave extended_
        ('stTrafficCar', DEV_EVENT_TRAFFIC_TRAFFICCAR_INFO),         # 交通車輛信息;Traffic vehicle info
		('nDetectNum', c_int),				# 規則檢測區域頂點數
		('DetectRegion', SDK_POINT*20),
        ('stCommInfo', EVENT_COMM_INFO),        # 公共信息;public info  
        ('bHasNonMotor', c_int),             # 是否有非機動車信息;Non-motor info enable
        ('stuNonMotor', VA_OBJECT_NONMOTOR),    # 非機動車信息;Non-motor information
              
    ]

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章