Пример #1
0
 def write_frame(self, img):
     if self.post_processor:
         img = self.post_processor.process(img)
     if self.width is None:
         self.width = img.shape[0]
         self.height = img.shape[1]
     ndarray_to_array2d(img).write(self.directory +
                                   '/%05d.png' % self.frame_counter)
     self.frame_counter += 1
Пример #2
0
 def write_frame(self, img):
     if self.post_processor:
         img = self.post_processor.process(img)
     if self.width is None:
         self.width = img.shape[0]
         self.height = img.shape[1]
     assert os.path.exists(self.directory)
     ndarray_to_array2d(img).write(
         os.path.join(self.directory, '%05d.png' % self.frame_counter))
     self.frame_counter += 1
Пример #3
0
 def write_frame(self, img):
     if self.post_processor:
         img = self.post_processor.process(img)
     if self.width is None:
         self.width = img.shape[0]
         self.height = img.shape[1]
     assert os.path.exists(self.directory)
     fn = FRAME_FN_TEMPLATE % self.frame_counter
     self.frame_fns.append(fn)
     ndarray_to_array2d(img).write(os.path.join(self.frame_directory, fn))
     self.frame_counter += 1
     if self.frame_counter % self.next_video_checkpoint == 0:
         if self.automatic_build:
             self.make_video()
             self.next_video_checkpoint *= 2
Пример #4
0
 def write_frame(self, img):
   if isinstance(img, core.Array2DVector3):
     img = array2d_to_ndarray(img)
   if img.shape[0] % 2 != 0:
     print('Warning: height is not divisible by 2! Dropping last row')
     img = img[:-1]
   if img.shape[1] % 2 != 0:
     print('Warning: width is not divisible by 2! Dropping last column')
     img = img[:, :-1]
   if self.post_processor:
     img = self.post_processor.process(img)
   if self.width is None:
     self.width = img.shape[0]
     self.height = img.shape[1]
   assert os.path.exists(self.directory)
   fn = FRAME_FN_TEMPLATE % self.frame_counter
   self.frame_fns.append(fn)
   ndarray_to_array2d(img).write(os.path.join(self.frame_directory, fn))
   self.frame_counter += 1
   if self.frame_counter % self.next_video_checkpoint == 0:
     if self.automatic_build:
       self.make_video()
       self.next_video_checkpoint *= 2