Skip to content

Commit

Permalink
Vsyng
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheider committed May 13, 2019
1 parent 1645776 commit d1b713e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 587 deletions.
4 changes: 2 additions & 2 deletions Assets/Scenes/handdrill.unity

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions run.py → scripts/run.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os
import pathlib
from itertools import count

import neodroid as neo
Expand All @@ -21,32 +23,35 @@
from contextlib import suppress


def main(how_many = 10, gamma=2.2):
def main(how_many = 10, gamma=2.2, path=pathlib.Path.home()/'Data'/'drill'):
'''
:param how_many:
:param gamma: Gamma < 1 ~ Dark ; Gamma > 1 ~ Bright
:return:
'''

if not path.exists():
pathlib.Path.mkdir(path)

with CameraObservationWrapper(connect_to_running=True) as _environment, suppress(KeyboardInterrupt):
for obs, frame_i in zip(tqdm(_environment, leave=False),count()):
if how_many == frame_i:
break

rgb = obs['RGB']
obj = obs['ObjectSpace']
ocl = obs['OcclusionMask']

name = f'stepper_{frame_i}'

if gamma != 1:
#with suppress(UserWarning):
rgb = ((rgb / 255.) ** (1. / gamma))

imageio.imwrite(name + '.png',rgb)
numpy.savez_compressed(name + '.npz', obj.astype(numpy.float16))



imageio.imwrite(str(path / f'{name}_rgb.png'),rgb)
numpy.savez_compressed(str(path / f'{name}_obj.npz'), obj.astype(numpy.float16))
numpy.savez_compressed(str(path / f'{name}_ocl.npz'), ocl.astype(numpy.float16))

if __name__ == '__main__':
main()
File renamed without changes.
Loading

0 comments on commit d1b713e

Please sign in to comment.