90 likes | 275 Views
Taking Pictures. Sec 9-9 Web Design. Objectives. The student will: Know how command the scribbler robot to take a picture. Know how to display the picture taken by the robot Know how to save a picture or pictures. Taking a Picture. The command to take a picture in Myro is:
E N D
Taking Pictures Sec 9-9 Web Design
Objectives The student will: • Know how command the scribbler robot to take a picture. • Know how to display the picture taken by the robot • Know how to save a picture or pictures.
Taking a Picture • The command to take a picture in Myro is: takePicture("color") • Simply issuing the command does nothing but instruct the robot to take a picture. • The picture is not saved • The picture is not displayed • To take and display a picture at the same time you can: show(takePicture())
Storing a Picture in a Variable • A picture can be stored in a variable. pic = takePicture("color") • Once stored the picture can be displayed over and over again: show(pic) • This command will display the same picture every time.
Saving a Picture in a File • Myro has a command to save pictures in a file. savePicture(pic,"my_picture.jpg")
Taking a Series of Pictures • Your robot can be programmed to scan its environment and display what it sees: while timeRemaining(40): show(takePicture("color")) turnLeft(0.5,.1)
Animated Gifs • You can also save an animated GIF of the images generated by the robot by using the savePicturecommand by accumulating a series of images in a list. Pics = [] while timeRemaining(40): pic=takePicture("color") show(pic) Pics.append(pic) turnLeft(0.5,.1) savePicture(Pics, "room_movie.gif")
Summary • The command to take a picture in Myro is: takePicture("color") • Pictures can be stored or saved. • The robot can programmed to “scan” its environment.
Rest of Today • Program your robot to scan the room and take pictures. • Work with the settings on the turn command so that the pictures only overlap slightly or don’t overlap but are close. • Same this in a python file. This is the beginning of your final project!