UPDATE Vision 更新行人检测方法2
This commit is contained in:
@ -39,6 +39,9 @@ class camera_HIK():
|
|||||||
frame = None
|
frame = None
|
||||||
if self.init_success==True:
|
if self.init_success==True:
|
||||||
if portisopen(self.ip, self.port):
|
if portisopen(self.ip, self.port):
|
||||||
|
# ret, frame = self.cap.read()
|
||||||
|
# if ret == False:
|
||||||
|
self.reconnect_camera()
|
||||||
ret, frame = self.cap.read()
|
ret, frame = self.cap.read()
|
||||||
else:
|
else:
|
||||||
print('海康摄像头网络断开')
|
print('海康摄像头网络断开')
|
||||||
@ -46,6 +49,10 @@ class camera_HIK():
|
|||||||
if portisopen(self.ip, self.port):
|
if portisopen(self.ip, self.port):
|
||||||
self.reconnect_camera()
|
self.reconnect_camera()
|
||||||
ret, frame = self.cap.read()
|
ret, frame = self.cap.read()
|
||||||
|
# if ret == False:
|
||||||
|
# self.init_success =False
|
||||||
|
# else:
|
||||||
|
# self.init_success = True
|
||||||
else:
|
else:
|
||||||
print('海康摄像头网络断开')
|
print('海康摄像头网络断开')
|
||||||
|
|
||||||
@ -55,6 +62,11 @@ class camera_HIK():
|
|||||||
if self.init_success == True:
|
if self.init_success == True:
|
||||||
self.cap.release()
|
self.cap.release()
|
||||||
self.cap = cv2.VideoCapture(self.camera_url)
|
self.cap = cv2.VideoCapture(self.camera_url)
|
||||||
|
ret, _ = self.cap.read()
|
||||||
|
if ret:
|
||||||
|
self.init_success = True
|
||||||
|
else:
|
||||||
|
self.init_success = False
|
||||||
print("海康摄像头重连")
|
print("海康摄像头重连")
|
||||||
|
|
||||||
def release_camera(self):
|
def release_camera(self):
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
# @Author : hjw
|
# @Author : hjw
|
||||||
# @File : get_position_test.py
|
# @File : get_position_test.py
|
||||||
'''
|
'''
|
||||||
|
import time
|
||||||
|
|
||||||
from Vision.camera_coordinate_dete_img import Detection
|
from Vision.camera_coordinate_dete_img import Detection
|
||||||
from Trace.handeye_calibration import *
|
from Trace.handeye_calibration import *
|
||||||
from Vision.tool.utils import get_disk_space
|
from Vision.tool.utils import get_disk_space
|
||||||
@ -56,6 +58,10 @@ def detectionPerson_test():
|
|||||||
if img_src is not None:
|
if img_src is not None:
|
||||||
cv2.imshow('detectPerson', img_src)
|
cv2.imshow('detectPerson', img_src)
|
||||||
cv2.waitKey(1)
|
cv2.waitKey(1)
|
||||||
|
time.sleep(5)
|
||||||
|
else:
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
|
||||||
print("person", person)
|
print("person", person)
|
||||||
# video_path = ''.join([os.getcwd(), '/Vision/model/data/1.mp4'])
|
# video_path = ''.join([os.getcwd(), '/Vision/model/data/1.mp4'])
|
||||||
# cam = cv2.VideoCapture(video_path)
|
# cam = cv2.VideoCapture(video_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user