基于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
              
    ]

 

你可能感兴趣的:(python)