Exemplo n.º 1
0
    def update_background(self, frame=None):
        if frame is None:
            frame = self.last_frame
            if frame is None:
                frame = self.grab_frame()
        self.background = clone_image(frame)

        self.background_gray = to_gray_image(self.background)
        self.background_flipped = flip_image(self.background)
Exemplo n.º 2
0
	def update_background(self, frame=None):
		if frame is None:
			frame = self.last_frame
			if frame is None:
				frame = self.grab_frame()
		self.background = clone_image(frame)
		
		self.background_gray = to_gray_image(self.background)
		self.background_flipped = flip_image(self.background)
Exemplo n.º 3
0
    def grab_frame(self):
        ret, frame = self.camera.read()
        frame_gray = to_gray_image(frame)
        frame_flipped = flip_image(frame)

        # Set the size of things if this is the first image we have seen
        if self.last_frame is None:
            self.size = frame.shape
            self.num_pixels = self.size[0]*self.size[1]

        self.recent_frames_gray.append(frame_gray)
        self.recent_frames.append(frame)
        if len(self.recent_frames) > self.recent_frames_max:
            del self.recent_frames[0]
            del self.recent_frames_gray[0]

        self.last_frame = clone_image(frame)
        self.last_frame_flipped = frame_flipped
        self.last_frame_gray = frame_gray
        return frame
Exemplo n.º 4
0
	def grab_frame(self):
		frame = cv.QueryFrame(self.camera)
		frame_gray = to_gray_image(frame)
		frame_flipped = flip_image(frame)

		# Set the size of things if this is the first image we have seen
		if self.last_frame is None:
			self.size = cv.GetSize(frame)
			self.num_pixels = self.size[0]*self.size[1]
	
		self.recent_frames_gray.append(frame_gray)
		self.recent_frames.append(frame)
		if len(self.recent_frames) > self.recent_frames_max:
			del self.recent_frames[0]
			del self.recent_frames_gray[0]

		self.last_frame = clone_image(frame)
		self.last_frame_flipped = frame_flipped
		self.last_frame_gray = frame_gray
		return frame