pdf

School

Simon Fraser University *

*We aren’t endorsed by this school

Course

120

Subject

Computer Science

Date

Oct 30, 2023

Type

pdf

Pages

8

Uploaded by xiaofanfan

Report
2022/11/11 11:51 Final Project - Audio Visual Language Learning App for Blackfoot: CMPT 120 - Intro to Computing Science https://canvas.sfu.ca/courses/72744/pages/final-project-audio-visual-language-learning-app-for-blackfoot?module_item_id=2710902 1/8 Final Project - Audio Visual Language Learning App for Blackfoot Audio Visual Language Learning App In this project, you will be developing an audio-visual Language Learning app for the endangered Canadian Indigenous language, Blackfoot. This language has an oral tradition, and therefore this app will show images to the user while playing audio, to help them associate word sounds to objects such as apples, child, etc. This project is a collaboration with Dr. Eldon Yellowhorn in the Indigenous Studies Department, and the Peigan Board of Education in Lethbridge, Alberta. The application has 3 parts: Learn. Images are shown to the user while listening to the audio. By pressing Enter, the user can listen to words and see their corresponding image. Play. The application will play the audio for a word, then show the user images of several items, possibly overlapped. Then it will ask the user to count how many of the images corresponding to the spoken word they see. The user will enter a number, and will be informed if their answer (i.e. their count) is correct or not. Settings. By default, the user learns 3 words, but the user can add more words to learn and play with as they progress. Here is a video depicting an example of the flow of this program. 0:00 / 1:45
2022/11/11 11:51 Final Project - Audio Visual Language Learning App for Blackfoot: CMPT 120 - Intro to Computing Science https://canvas.sfu.ca/courses/72744/pages/final-project-audio-visual-language-learning-app-for-blackfoot?module_item_id=2710902 2/8 What to Submit This project is broken down into 2 submissions, with details defined below. Together, these two submissions will provide your final project grade. Submission 1 involves developing a modul e ( draw.py ) with Image Processing functions. It will be due on Wed Nov. 23. [ Submit here (https://canvas.sfu.ca/courses/72744/assignments/795988) .] You will be provided a solution to draw.py on Nov. 26th, that is, immediately after the late deadline for Submission 1, which you can use if desired for Submission 2. Submission 2 is the complete application and is due on Mon Dec. 5, last day of lectures. [ Submit here (https://canvas.sfu.ca/courses/72744/assignments/820879) .] You may do either or both of the submissions either solo or in a pair. Your partner may be in any of D100, D300 or OL01 in CMPT 120 this Fall 2022. Make sure that both members of the pair join the same Canvas group as directed in the Canvas submission activities. If you work individually do NOT join any Canvas group. Submission 1: Image Processing Module (due Wed, Nov. 23) Implement the following 5 functions and place them into a custom module called draw.py . You have to use the draw.py starter file in the Starter Kit to start your file (find the link to Starter Kit below). To test these functions to make sure that they work appropriately, you may use any of the image files provided in the Starter Kit . To get, show or save the images into/from your program you MUST place the images files in the subfolder images as indicated below, and also you MUST use the provided functions in the module cmpt120image.py , as seen in class and also included in the Starter Kit. See examples for each of the functions in the figure below. 1. recolor(img, color) - Changes all non-white pixels of the image referred to by the parameter img to the specified color , and returns a new image with the changes. img is a 2D array of RGB pixels as seen in class to represent images. color is a list containing 3 integers, each from 0 to 255, representing RGB values. To create a new image use the cmpt120image.getBlackImage() function which returns a new canvas to draw on. 2. minify(img) - Shrinks the image img by half in both height and width and returns the result. For this function, you can assume the width and height of images are even. Use the cmpt120image.getBlackImage() function which returns a new canvas to draw on. Hint: The average of each 2x2 block of pixels from the original image becomes one pixel in the result image. As an example, the R/G/B values of the pixel at result[0][0] with have the average- R/average-G/average-B values of the pixels at original[0][0], original[0][1], original[1][0], and original[1][1]. 3. mirror(img) - Flips the image img left-to-right, and returns a new image with the result. Use the cmpt120image.getBlackImage() function which returns a new canvas to draw on. 4. drawItem(canvas, item, row, col) - Modify canvas by drawing the non-white pixels of the item (intended to be the image of a word) onto canvas . Row and col represent the top left pixel
2022/11/11 11:51 Final Project - Audio Visual Language Learning App for Blackfoot: CMPT 120 - Intro to Computing Science https://canvas.sfu.ca/courses/72744/pages/final-project-audio-visual-language-learning-app-for-blackfoot?module_item_id=2710902 3/8 of canvas where the item (the item's top left 0,0 pixel) should be placed. Canvas and item are 2D images of RGB pixels. This function should assume that the canvas image is large enough to contain the item img in the row col indicated; row and col do NOT need to be validated. 5. distributeItems(canvas, item, n) - Draws the item onto the Canvas n times in random locations. Overlapping item images is OK. Hint : Consider calling one of the functions above. In your test code for functions 4 and 5, create a canvas corresponding to a white background of 300 (h) x 400 (w) pixels, using the provided function in cmpt120image.py. function original image or canvas resulting image recolor(img, color) minify(img) mirror(img) drawItem(canvas, item, row, col) item is the child image row,col are both low numbers in this example distributeItems(canvas, item, n) item is the child image, n is 4 Examples of results when calling each of the image processing functions described above
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2022/11/11 11:51 Final Project - Audio Visual Language Learning App for Blackfoot: CMPT 120 - Intro to Computing Science https://canvas.sfu.ca/courses/72744/pages/final-project-audio-visual-language-learning-app-for-blackfoot?module_item_id=2710902 4/8 Submission 2: Language Learning App (due Mon, Dec. 5) (The program will first ask the user to indicate the environment the app will be executing). Code is included in the Starter kit, the main file, to ask this and set up an environment variable. You need to leave this starter code) The app will first show a menu to the user to choose if they want to Learn, Play, or change Settings. The items (words) that the app will teach the user in this game are listed in a provided blackfoot.csv file, included in the the Starter Kit below. Some examples: apples, bread, burger, child, coffee, tipi, etc. Your application must first read this .csv file containing all possible items/words. Separate files for each item corresponding to their image ( .png ) and sound ( .wav ) are also provided. The names of these files are the same as each word, with the corresponding extension. Note: When marking, slightly different files may be used, but will have the same characteristics. Hence, you should not hardcode any of the words nor file names, but rather use the items names in the .csv file. The app should use this list of words and the provided image and sound files to implement the following parts of the application. 1. Learn . Displays each item image to be learned randomly on the canvas, and plays the sound of the corresponding word. The user presses enter to continue to the next item to be learned. When the program first starts, only the first 3 items in the .csv file are taught to the user (and their corresponding image and sound are shown and played respectively). The user can change this number in the Settings menu, up to the number of items in the .csv and at least 3. 2. Play . This is a seek-and-count game, where the user has to listen to a word, and count how many of that item are in the image. First, the user can specify how many rounds they’d like to play. Then, for each round, the program must: Create a challenge list of 3 words from the list of items (the list of items being only the words currently being learned, i.e. either 3 or what the user indicated in settings). You must ensure that the same word is not repeated in this list of 3 randomly chosen words. You can explore the random.shuffle() function.
2022/11/11 11:51 Final Project - Audio Visual Language Learning App for Blackfoot: CMPT 120 - Intro to Computing Science https://canvas.sfu.ca/courses/72744/pages/final-project-audio-visual-language-learning-app-for-blackfoot?module_item_id=2710902 5/8 For each item in the challenge list, choose a random number n between 1 and 4, and display n of that item to the canvas. Your program should first recolor the image, then randomly decide to minify (or not), and mirror the item (or not) before drawing it to the screen. All images for the item will have the same property. For example, if a randomly chosen item is orange and the number randomly chosen is 3, and it is randomly decided to minify, all 3 of the oranges should be half sized on the canvas. One specific item (e.g. oranges) may have more than one image processing applied before placing all copies in the canvas; i.e. if oranges are minimized, they may also be mirrored, although all n copies would have the same processing. Ask the user how many of the items they found. If they enter the number correctly, then a message confirming that it is correct should be printed to the user, otherwise inform that it is incorrect. To play audio, call the function provided playSound(soundfile,env) ( The function is included in the Started Kit code, in the main file). Depending on your coding environment, the implementation of this function will differ and it will depend on the ENV variable. 3. Settings. By default, the player learns 3 words. They can change the number of words to learn and or to play using the Settings option in this menu. The application should NOT allow the user to change the number of words to less than 3 or more than the number of words in the blackfoot.csv file. What to Submit The TAs will mark on Mu or IDLE, but not replit. Therefore, if you (and your partner) decide to develop on replit.com (paying $5 to access private repls), download and test your work on Mu or IDLE before submitting. As indicated above: Submission 1 : Name your file draw.py containing the required image processing functions and also tests for those functions. Due on Wed Nov. 23. [ Submit here (https://canvas.sfu.ca/courses/72744/assignments/795988) .] You will be provided a solution to draw.py on Nov. 26th, immediately after the late deadline for Submission 1, which you can use if desired for Submission 2. Submission 2 : Name your file main_firstname_lastnameinitial .py to run the complete application. Due on Mon Dec. 5, last day of lectures. [ Submit here (https://canvas.sfu.ca/courses/72744/assignments/820879) .] Do NOT submit the images, sounds and csv files. The TAs will use their own copy of cmpt120image.py, and their own images, sound files and .csv file to test your work. Submi±ng with a Partner Follow the instructions in the submission activities above, regarding the formation of pairs and how to submit.
2022/11/11 11:51 Final Project - Audio Visual Language Learning App for Blackfoot: CMPT 120 - Intro to Computing Science https://canvas.sfu.ca/courses/72744/pages/final-project-audio-visual-language-learning-app-for-blackfoot?module_item_id=2710902 6/8 The default assumption is that the teammate pair is the same for both submissions, 1st and 2nd. If you need to change this make sure to revise the Canvas group you joined before you submit the 2nd submission, and additionally clearly indicate in the program code (header part) and also Canvas comments. You MUST include both official names in the program header and in Canvas comments when you submit. Also you must include both initials in the main file name; for example the group with Harry Potter and Ariana Grande would name the file main_HPAG.py. If you joined a Canvas pair, only ONE of the teammates should submit. Ge±ng Started Download the Project Starter Kit from here. (https://canvas.sfu.ca/courses/72744/files/20292046/download) Placement of images, sounds and .csv and .py files Prior to running the application, as a programmer, you will have to place the files provided in appropriate folders. To make all solutions consistent, you will be asked to create the same subfolders, regardless of the environment you use. Hence, together with the code that is provided in the starter kit, your code will work fine any of the environments. In the same folder where you develop your program, copy the cmpt120image.py and the blackfoot.csv files. In this same folder (or in the replit environment) create two subfolders, exactly named sounds and images, and correspondingly, place the sounds and images files in them. Note: You will need to include the path ( subfolder) in the file name in your code. (Although this is not to be included when using the provided function playSound(...) for which you will only have to provide to the function the wav filename without the extension) For example: if the image to be obtained is xxxx.png , since it is in the subfolder images , you should obtain it as cmpt120image.getImage("images/xxxx.png") Additionally, for: IDLE: Remember to install pygame (with pip, and appropriate Python version) MU: You do NOT need to install pygame to work with images you may just use the default Python3 mode. to work with images and sounds you need to change to the Pygame Zero mode.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2022/11/11 11:51 Final Project - Audio Visual Language Learning App for Blackfoot: CMPT 120 - Intro to Computing Science https://canvas.sfu.ca/courses/72744/pages/final-project-audio-visual-language-learning-app-for-blackfoot?module_item_id=2710902 7/8 Development Hints First start getting familiar with what you are asked to do, including being clear what you need to submit for each submission. As soon as possible, figure out if you will work with a partner or individually. If with a partner, define who it will be, arrange how you will work together, join the Canvas group ASAP. What function should I start implementing first for the first submission? This project includes an image processing component, and one of the functions is meant to recolor an image. A good place to begin is to try to develop this function and test by changing the color of the apple image (border) from black to a random color of your choice. This and other analogous tests for the various required functions are not necessarily needed for the general application, but you are recommended to do them as a starting point and it should help you debug the functions. Placeholder functions. Both the Learn and Play parts include image processing, sound processing, and other various tasks that may be implemented gradually, and/or possibly independently. In general, for coding a program of considerable size, while you have not coded all the needed components and functions you may temporarily define “ placeholder functions ”. A placeholder function would be defined with the appropriate name (e.g. drawingSomething(...)) and be called from where it corresponds, but temporarily the only content of the function would be, for example, print(“inside drawingSomething(...)”). If it is a productive of fruitful function, you would temporarily return a fixed possible value (e.g. return 1, if the function is meant to return numbers for example ). At a later stage, or independently, you can develop such functions, and once they work you can incorporate them into your whole code. Ques²ons? If you have any general interpretation questions, please ask in the discussion forum, or come to office hours and peer tutor sessions. Also pay attention for questions that your peers may be asking in the discussion forum, and responses from the teaching team in the discussion forum or via announcements.
2022/11/11 11:51 Final Project - Audio Visual Language Learning App for Blackfoot: CMPT 120 - Intro to Computing Science https://canvas.sfu.ca/courses/72744/pages/final-project-audio-visual-language-learning-app-for-blackfoot?module_item_id=2710902 8/8

Browse Popular Homework Q&A

Q: Identify for each table, the followings:  Foreign keys  Candidate keys  Primary key  Alternate keys
Q: A grade 36 round steel bar with a diameter of 0.5 inches and a gauge length of 2 inches was…
Q: A company has operating income of​ $300,000, revenues of​ $1,500,000, total assets of​ $2,000,000…
Q: 9. True or False? In the production model we studied, TFP can be greater than 1. A. True B. False
Q: d. x² + 5x - 24 e. 4x³6x² - 10x f. x² - 10x + 25
Q: Let y = 4x?. Find the change in y, Ay when x = 5 and Aæ = 0.1 Find the differential dy when x = 5…
Q: Let Z be a standard normal random variable. Use the z‐table to find P(Z > ‐1.30)?
Q: How to determine if this is N- ethylsaccharin or O-ethylsaccharin or a mixture of both based on…
Q: Solve this linear programming problem using graphical methods. Restrict  x ≥ 0  and  y ≥ 0. Maximize…
Q: Why do we have a Law / Technology Delta – what causes the gap between our laws and our technology?…
Q: 115 Find the lenath of the side adiacent to the given angle. (Round vour answer to two decimal plac
Q: Similarly, approaching along the y-axis yields a limit equal to 0. Since these two limits are the…
Q: Let y = 4x?. Find the change in y, Ay when x = 5 and Aæ = 0.1 Find the differential dy when x = 5…
Q: eeting today with the office manager at the law firm Abercrombie and Wilson (A&W). A&W is a la ve…
Q: The expression (x-7)(x²+2x+5) equals Ax³ + Bx² + C + D where A equals: and Bequals: and C equals:…
Q: What concept did James Hutton and Charles Lyell introduce?
Q: What term is used to describe the checkpoints (Go/No-go decision points) that occur during a project…
Q: Organotin compounds play a significant role in diverse industrial applications. They have been used…
Q: Consider the function f(x)=2x3−3x2−36x+54f(x)=2x3-3x2-36x+54.   Find the first derivative.…
Q: You plan to buy a house in three years and would like to put $100,000 down at the time of buying.…
Q: a. f(t) = cos(2t). Find F(s) b. g(t) = e²t sin(3t). Find G(s) c. H(s) = 3s +1 s² - 2s + 5* Find h(t)
Q: The processing of incoming information in the central nervous system and deciding what to do with…