UPDATE Vision 更新行人检测方法2
This commit is contained in:
@ -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):
|
||||
|
||||
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user