Add a feature to generate a white noise background as init world

This commit is contained in:
Yann Weber 2018-08-14 16:29:45 +02:00
commit 8c6f2c78d9

View file

@ -85,6 +85,11 @@ class World(object):
self._val = np.zeros([self._y, self._x]) self._val = np.zeros([self._y, self._x])
else: else:
self._val = np.zeros([self._y, self._x, 3]) self._val = np.zeros([self._y, self._x, 3])
elif color == 'rand':
if self._gray:
self._val = np.random.randint(255, size=(self._y, self._x))
else:
self._val = np.random.randint(255, size=(self._y, self._x, 3))
else: else:
self._val = [[color for _ in range(self._x)] for _ in range(self._y)] self._val = [[color for _ in range(self._x)] for _ in range(self._y)]
self._val = np.array(self._val) self._val = np.array(self._val)