コード例 #1
0
    def capture_video(self, sky, millis_end, millis_start=0, quiet=False):
        """
        Captures a list of images, each one separated from the other at a rate of 1. / fps seconds
        Parameters:
            sky: sky object with stars and cubesats
            millis_end: time at which the last image is taken
            millis_start: time at which the first image is taken
            quiet: if True, no progress bar is displayed
        Returns a list of frames and a list of timestamps
        """
        video = []
        timestamps = []
        millis = millis_start
        base = Image(width=self.camera.cols,
                     height=self.camera.rows)  # Base image with stars only
        progress_bar = ProgressBar('Capturing video', millis_start, millis_end,
                                   quiet)

        sky.draw_stars_on_image(base)
        while millis <= millis_end:
            captured = base.clone()
            sky.draw_cubesats_on_image(captured, millis)
            self._add_noise(captured)
            video.append(captured)
            timestamps.append(millis)
            progress_bar.update(millis)
            millis += 1000. / self.fps

        progress_bar.end()

        return timestamps, video
コード例 #2
0
 def process_video(self, video, quiet=False):
     """
     Process a video taken from a Receiver
     Parameters:
         video
         quiet: if True, no progress bar is displayed
     """
     processed = []
     progress_bar = ProgressBar('Processing video', 0,
                                len(video) - 1, quiet)
     for i, image in enumerate(video):
         processed.append(self.process_image(image))
         progress_bar.update(i)
     progress_bar.end()
     return processed