""" HW1 - Robot motion and manifold Learning Code written for assignment for CS365A - Artificial Intelligence Programming Author - Saurav Prakash (saurav@iitk.ac.in) """ from __future__ import division from PIL import Image import sys, math, pygame, numpy import geometry pygame.init() # Define global variables linecolor = [0, 200, 150] linecolors = [(0,200,150),(250,100,50),(100,100,50),(0,0,150)] room_coords = [(-200,-200),(200,-200),(200,200),(-200,200)] BGCOLOR = 250,250,250 # background color for screen HEIGHT = 700 # Height of screen WIDTH = 900 # Width of screen outimg_width = 18 # Width of output image # Ceate a graphical window to work in : screen = pygame.display.set_mode((WIDTH,HEIGHT)) # Import the robot image #robot_sprite = pygame.image.load("robot.png") i=1 ang=0.2 basewidth = 200 j=1 while j<=10000: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() #robot = Robot(x=50,y=50,theta=ang,FOV=120) img = Image.open('img_rand_train/env'+str(j)+'.png') wpercent = (basewidth / float(img.size[0])) hsize = int((float(img.size[1]) * float(wpercent))) img = img.resize((basewidth, hsize), Image.ANTIALIAS) img.save('img_rand_train/env'+str(j)+'.png') j=j+1 # Fill the screen with specified background color # screen.fill(BGCOLOR) # Draw the textured background #load_background('texture.jpg') # Draw the room '''Uncomment if you want to see the boundary of the walls However for purpose of taking images keep this line commented''' # draw_poly(room_coords) # Draw the robot on the screen # robot.theta +=1 # robot.draw(screen) # Show everything on the screen pygame.display.flip()