def synth_circle_noise(infiles, outfiles, NOISE): SIM_DURATION = 30.0 TDELTA = 1 / 30. t = np.arange(0, SIM_DURATION, TDELTA) frames_to_skip = [20, 35, 36, 50, 51, 52, 53] env = util.Environmentz((1.5, 2), (240, 320)) state = simulate.gen_track_circle(t, np.pi * 2 / 10, env, circle_radius=0.5) images = simulate.render(env, state) new_images = simulate.add_noise_background(images, NOISE, NOISE, frames_to_skip) pickle.dump( { 'state': state, 'video': new_images, 'noise': NOISE, 'frames_skipped': frames_to_skip }, open(outfiles[0], 'w')) videotools.dump_grey_movie(outfiles[1], new_images)
def test_writer(): frames = np.random.random_integers(0,255,size=(50,100,200,3)).astype('uint8') vsnk = videotools.VideoSink('mymovie.avi',size=frames.shape[1:3], colorspace='rgb24') for frame in frames: vsnk(frame) vsnk.close() a = np.zeros((1000, 240, 320), dtype = np.uint8) for i in range(1000): a[i, i % 240, i % 320]= 255 videotools.dump_grey_movie('test.avi', a)
def test_writer(): frames = np.random.random_integers(0, 255, size=(50, 100, 200, 3)).astype('uint8') vsnk = videotools.VideoSink('mymovie.avi', size=frames.shape[1:3], colorspace='rgb24') for frame in frames: vsnk(frame) vsnk.close() a = np.zeros((1000, 240, 320), dtype=np.uint8) for i in range(1000): a[i, i % 240, i % 320] = 255 videotools.dump_grey_movie('test.avi', a)
def synth_circle_noise(infiles, outfiles, NOISE): SIM_DURATION = 30.0 TDELTA = 1/30. t = np.arange(0, SIM_DURATION, TDELTA) frames_to_skip = [20, 35, 36, 50, 51, 52, 53] env = util.Environmentz((1.5, 2), (240, 320)) state = simulate.gen_track_circle(t, np.pi*2/10, env, circle_radius=0.5) images = simulate.render(env, state) new_images = simulate.add_noise_background(images, NOISE, NOISE, frames_to_skip) pickle.dump({'state' : state, 'video' : new_images, 'noise' : NOISE, 'frames_skipped' : frames_to_skip }, open(outfiles[0], 'w')) videotools.dump_grey_movie(outfiles[1], new_images)