|
|
@ -12,6 +12,12 @@ from myutils.MyLogger_logger import LogHandler |
|
|
|
from myutils.ConfigManager import myCongif |
|
|
|
from model.plugins.ModelBase import ModelBase |
|
|
|
|
|
|
|
import acl |
|
|
|
from PIL import Image |
|
|
|
|
|
|
|
ACL_MEM_MALLOC_HUGE_FIRST = 0 |
|
|
|
ACL_MEMCPY_HOST_TO_DEVICE = 1 |
|
|
|
ACL_MEMCPY_DEVICE_TO_HOST = 2 |
|
|
|
|
|
|
|
class VideoCaptureWithFPS: |
|
|
|
'''视频捕获的封装类,是一个通道一个''' |
|
|
@ -65,10 +71,21 @@ class ModelManager: |
|
|
|
self.frame_interval = 1.0 / int(myCongif.get_data("verify_rate")) |
|
|
|
#保存视频相关内容 |
|
|
|
self.fourcc = cv2.VideoWriter_fourcc(*'mp4v') # 使用 mp4 编码 |
|
|
|
#基于模型运行环境进行相应初始化工作 |
|
|
|
if myCongif.get_data("model_platform") == "acl": |
|
|
|
|
|
|
|
|
|
|
|
def __del__(self): |
|
|
|
self.logger.debug("释放资源") |
|
|
|
|
|
|
|
def _init_acl(self): |
|
|
|
'''acl初始化函数''' |
|
|
|
self.device_id = 0 |
|
|
|
#step1 初始化 |
|
|
|
ret = acl.init() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _open_view(self,url,itype): #打开摄像头 0--USB摄像头,1-RTSP,2-海康SDK |
|
|
|
if itype == 0: |
|
|
|
cap = VideoCaptureWithFPS(int(url)) |
|
|
|