UPDATE Vision 更新行人检测方法2

This commit is contained in:
HJW
2024-10-26 13:50:05 +08:00
parent 60f145c608
commit e1b52edc09
2 changed files with 18 additions and 0 deletions

View File

@ -39,6 +39,9 @@ class camera_HIK():
frame = None
if self.init_success==True:
if portisopen(self.ip, self.port):
# ret, frame = self.cap.read()
# if ret == False:
self.reconnect_camera()
ret, frame = self.cap.read()
else:
print('海康摄像头网络断开')
@ -46,6 +49,10 @@ class camera_HIK():
if portisopen(self.ip, self.port):
self.reconnect_camera()
ret, frame = self.cap.read()
# if ret == False:
# self.init_success =False
# else:
# self.init_success = True
else:
print('海康摄像头网络断开')
@ -55,6 +62,11 @@ class camera_HIK():
if self.init_success == True:
self.cap.release()
self.cap = cv2.VideoCapture(self.camera_url)
ret, _ = self.cap.read()
if ret:
self.init_success = True
else:
self.init_success = False
print("海康摄像头重连")
def release_camera(self):

View File

@ -5,6 +5,8 @@
# @Author : hjw
# @File : get_position_test.py
'''
import time
from Vision.camera_coordinate_dete_img import Detection
from Trace.handeye_calibration import *
from Vision.tool.utils import get_disk_space
@ -56,6 +58,10 @@ def detectionPerson_test():
if img_src is not None:
cv2.imshow('detectPerson', img_src)
cv2.waitKey(1)
time.sleep(5)
else:
cv2.destroyAllWindows()
print("person", person)
# video_path = ''.join([os.getcwd(), '/Vision/model/data/1.mp4'])
# cam = cv2.VideoCapture(video_path)