|  |  | @ -20,7 +20,7 @@ import ctypes | 
			
		
	
		
			
				
					|  |  |  | from ctypes import c_int64 | 
			
		
	
		
			
				
					|  |  |  | from server import run_server, RTSPServer, get_local_ip | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | showTrack = False | 
			
		
	
		
			
				
					|  |  |  | showTrack = True | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | class Core(QThread): | 
			
		
	
		
			
				
					|  |  |  |     newFrame = pyqtSignal(object, int, bool, ctypes.c_int64) | 
			
		
	
	
		
			
				
					|  |  | @ -31,13 +31,13 @@ class Core(QThread): | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         self.__detector = detector | 
			
		
	
		
			
				
					|  |  |  |         self.__tracker = tracker | 
			
		
	
		
			
				
					|  |  |  |         self.__tracker_rio = None | 
			
		
	
		
			
				
					|  |  |  |         self.__tracker__secc = False | 
			
		
	
		
			
				
					|  |  |  |         self.__tracker_roi = None | 
			
		
	
		
			
				
					|  |  |  |         self.__tracker__succ = False | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         self.__rtspserver_0 = RTSPServer(get_local_ip(), 41231,"/stream0") | 
			
		
	
		
			
				
					|  |  |  |         self.__rtspserver_0 = RTSPServer(get_local_ip(), 41231,"/stream") | 
			
		
	
		
			
				
					|  |  |  |         threading.Thread(target=run_server,args=[self.__rtspserver_0], daemon=True).start() | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         self.__rtspserver_1 = RTSPServer(get_local_ip(), 41232,"/stream1") | 
			
		
	
		
			
				
					|  |  |  |         self.__rtspserver_1 = RTSPServer(get_local_ip(), 41232,"/stream") | 
			
		
	
		
			
				
					|  |  |  |         threading.Thread(target=run_server,args=[self.__rtspserver_1], daemon=True).start() | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         self.__video_sources = video_sources | 
			
		
	
	
		
			
				
					|  |  | @ -79,6 +79,7 @@ class Core(QThread): | 
			
		
	
		
			
				
					|  |  |  |             self.set_source(0) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     def __stream(self): | 
			
		
	
		
			
				
					|  |  |  |         # return | 
			
		
	
		
			
				
					|  |  |  |         """Continuous streaming of the video source.""" | 
			
		
	
		
			
				
					|  |  |  |         while self.__is_streaming: | 
			
		
	
		
			
				
					|  |  |  |             try: | 
			
		
	
	
		
			
				
					|  |  | @ -89,18 +90,20 @@ class Core(QThread): | 
			
		
	
		
			
				
					|  |  |  |                 if frame_1 is not None: | 
			
		
	
		
			
				
					|  |  |  |                     if self.__is_tracking and self.__tracker is not None and self.__processing_id == 1: | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                         if self.__tracker_rio is not None: | 
			
		
	
		
			
				
					|  |  |  |                         if self.__tracker_roi is not None: | 
			
		
	
		
			
				
					|  |  |  |                             x, y, w, h = map(int, self.__tracker_roi) | 
			
		
	
		
			
				
					|  |  |  |                             box_color = (0, 255, 0) if self.__tracker__secc else (255, 0, 0) | 
			
		
	
		
			
				
					|  |  |  |                             box_color = (0, 255, 255) if self.__tracker__succ else (255, 0, 0) | 
			
		
	
		
			
				
					|  |  |  |                             cv2.rectangle(frame_1, (x, y), (x + w, y + h), box_color, 2) | 
			
		
	
		
			
				
					|  |  |  |                             print(frame_1.shape) | 
			
		
	
		
			
				
					|  |  |  |                     self.__rtspserver_1.update_frame(frame_1) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 if frame_0 is not None: | 
			
		
	
		
			
				
					|  |  |  |                     if self.__is_tracking and self.__tracker is not None and self.__processing_id == 0: | 
			
		
	
		
			
				
					|  |  |  |                         if self.__tracker_rio is not None: | 
			
		
	
		
			
				
					|  |  |  |                         if self.__tracker_roi is not None: | 
			
		
	
		
			
				
					|  |  |  |                             x, y, w, h = map(int, self.__tracker_roi) | 
			
		
	
		
			
				
					|  |  |  |                             box_color = (0, 255, 0) if self.__tracker__secc else (255, 0, 0) | 
			
		
	
		
			
				
					|  |  |  |                             box_color = (0, 255, 255) if self.__tracker__succ else (255, 0, 0) | 
			
		
	
		
			
				
					|  |  |  |                             cv2.rectangle(frame_0, (x, y), (x + w, y + h), box_color, 2) | 
			
		
	
		
			
				
					|  |  |  |                             print(frame_0.shape) | 
			
		
	
		
			
				
					|  |  |  |                     self.__rtspserver_0.update_frame(frame_0) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 sleep(0.03) | 
			
		
	
	
		
			
				
					|  |  | @ -159,10 +162,10 @@ class Core(QThread): | 
			
		
	
		
			
				
					|  |  |  |             ctime = c_int64(int(time.time() * 1000))  # Convert to c_int64 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             frame = source.get_frame() | 
			
		
	
		
			
				
					|  |  |  |             print(f"intial frame size :{frame.shape}") | 
			
		
	
		
			
				
					|  |  |  |             # print(f"intial frame size :{frame.shape}") | 
			
		
	
		
			
				
					|  |  |  |             bbox, success = self.__tracker.update(frame) | 
			
		
	
		
			
				
					|  |  |  |             self.__tracker_roi = bbox | 
			
		
	
		
			
				
					|  |  |  |             self.__tracker__secc = success | 
			
		
	
		
			
				
					|  |  |  |             self.__tracker__succ = success | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             if bbox is not None: | 
			
		
	
		
			
				
					|  |  |  |                 center = bbox[:2] + bbox[2:] // 2 | 
			
		
	
	
		
			
				
					|  |  | @ -279,6 +282,7 @@ class Core(QThread): | 
			
		
	
		
			
				
					|  |  |  |         self.__tracker.stop() | 
			
		
	
		
			
				
					|  |  |  |         self.__is_tracking = False | 
			
		
	
		
			
				
					|  |  |  |         self.__tracking_thread = None | 
			
		
	
		
			
				
					|  |  |  |         self.__tracker_roi = None | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     def __draw_bbox(self, img: np.ndarray, bbox, color): | 
			
		
	
		
			
				
					|  |  |  |         thickness = self.__thickness | 
			
		
	
	
		
			
				
					|  |  | 
 |