def track_centers(self, frame): frame=cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) frame_applied= frame*self.masks[4] frame_applied = cv2.resize(frame_applied, (360, 240)) str_open, str_dila = camera2.get_strelements(15,12) fgmask = self.fgbg.apply(frame_applied) img = camera2.operacions_morfologiques(fgmask, str_open, str_dila) contours = camera2.get_contours (img) centres, frame_applied = camera2.get_centroids (contours, frame_applied) return centres
def isParkingUp(self): #override frame_applied= frame*self.masks[3] fgbg = cv2.createBackgroundSubtractorMOG2(detectShadows=True) ret = True str_open, str_dila = camera5.get_strelements(28,53) fgmask = fgbg.apply(frame_applied) img = camera5.operacions_morfologiques(fgmask, str_open, str_dila) contours = camera5.get_contours (img) centres, frame_applied = camera5.get_centroids (contours, frame_applied) if len(centres)>0: return True else: return False
def isParkingDown(self, frame): #override frame=cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) frame_applied= frame*self.masks[2] frame_applied = cv2.resize(frame_applied, (360, 240)) str_open, str_dila = camera2.get_strelements(15,12) fgmask = self.fgbg.apply(frame_applied) img = camera2.operacions_morfologiques(fgmask, str_open, str_dila) contours = camera2.get_contours (img) #centres, frame_applied = camera2.get_centroids (contours, frame_applied) if len(contours)>0: return True else: return False