def generateMovingBarDataset(Nx, Ny): barMovies = [] barHalfLength = 2 # horizongtal bars stratNy = 1 for startNx in range(barHalfLength, Nx-barHalfLength+1): barMovie = getMovingBar(startLocation=(startNx, stratNy), direction=(0, 1), imageSize=(Nx, Ny), barHalfLength=barHalfLength, steps=Ny-stratNy) barMovies.append(barMovie) # vertical bars # stratNx = 1 # for startNy in range(barHalfLength, Ny-barHalfLength+1, 2): # barMovie = getMovingBar(startLocation=(startNx, stratNy), # direction=(1, 0), # imageSize=(Nx, Ny), # barHalfLength=barHalfLength, # steps=Nx-stratNx) # barMovies.append(barMovie) return barMovies
def generateMovingBarDataset(Nx, Ny): barMovies = [] barHalfLength = 2 # horizongtal bars stratNy = 1 for startNx in range(barHalfLength, Nx - barHalfLength + 1): barMovie = getMovingBar(startLocation=(startNx, stratNy), direction=(0, 1), imageSize=(Nx, Ny), barHalfLength=barHalfLength, steps=Ny - stratNy) barMovies.append(barMovie) # vertical bars # stratNx = 1 # for startNy in range(barHalfLength, Ny-barHalfLength+1, 2): # barMovie = getMovingBar(startLocation=(startNx, stratNy), # direction=(1, 0), # imageSize=(Nx, Ny), # barHalfLength=barHalfLength, # steps=Nx-stratNx) # barMovies.append(barMovie) return barMovies
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU Affero Public License for more details. # # You should have received a copy of the GNU Affero Public License # along with this program. If not, see http://www.gnu.org/licenses. # # http://numenta.org/licenses/ # ---------------------------------------------------------------------- from htmresearch.support.generate_sdr_dataset import getMovingBar import matplotlib.pyplot as plt import numpy as np plt.ion() if __name__ == "__main__": bars = getMovingBar(startLocation=(10, 1), direction=(0, 1), imageSize=(20, 20), steps=19) plt.figure(1) i = 0 while True: plt.imshow(np.transpose(bars[i]), cmap='gray') plt.pause(.05) i += 1 if i >= len(bars): i = 0
# See the GNU Affero Public License for more details. # # You should have received a copy of the GNU Affero Public License # along with this program. If not, see http://www.gnu.org/licenses. # # http://numenta.org/licenses/ # ---------------------------------------------------------------------- from htmresearch.support.generate_sdr_dataset import getMovingBar import matplotlib.pyplot as plt import numpy as np plt.ion() if __name__ == "__main__": bars = getMovingBar(startLocation=(10, 1), direction=(0, 1), imageSize=(20, 20), steps=19) plt.figure(1) i = 0 stop = False while stop is False: plt.imshow(np.transpose(bars[i]), cmap='gray') plt.pause(.05) i += 1 plt.savefig('image_{}.png'.format(i)) if i >= len(bars): stop = True # i = 0