[SOLVED] Introduction to Computer Science for Multidisciplinary Studies (CPSC 217) Exercise 5 of 8

$25

File Name: Introduction_to_Computer_Science_for_Multidisciplinary_Studies_(CPSC_217)_Exercise_5_of_8.zip
File Size: 838.38 KB

5/5 - (1 vote)

University of Calgary Department of Computer Science

Introduction to Computer Science for Multidisciplinary Studies (CPSC 217) Exercise 5 of 8

This exercise is to be completed individually and is due on March 8, 2015.
Submit your solution as a Python source code file (i.e., a .py file) to the Exercise 5 of 8 dropbox in D2L. Your source code must be commented. Uncommented submissions will be penalized.

Your .py file must be named with your last name, student number, and Exercise5, separated by underscores. e.g., Collier_12345678_Exercise5.py

For this exercise you will create a program that uses SimpleGraphics to perform a simple chroma keying (also known as green screening) operation, to merge two images. The first image, to be used as the background, depicts a hallway and will be a gif of size 800 600. The second image will contain an image of a monster (200 350) depicted against a green background (i.e., pixels where the red = 0, the green = 255, and the blue = 0). Your task will be to overlay a semi-transparent image of the monster on top of the background, centered at a point defined by the user. The result will be an image where the monster appears as a ghost, as depicted in the example below.

+

This is a deceptively simple problem (and is likely to be much shorter that some of your previous programs) but you must start by thoroughly reading the CPSC217-W00-07-(SimpleGraphics Tutorial Part 2) on D2L. Your program should begin by asking the user for the images and the co-ordinates for centering, and then you should use loops to check each of the pixels in the foreground image. If the pixel is green, you should do nothing to the background image, but if the pixel is anything other than green you should average the red, green, and blue pixel values of the foreground and the background. This will achieve the semi-transparency effect.

To achieve a mark of 50% for this exercise, your program must:

  • prompt the user for the name of the background and monster images, and the x and y co-ordinates
  • re-prompt the user whenever invalid x and y co-ordinates are provided (n.b., you will need a loop)
  • draw a semi-transparent monster image (minus the green background) centered on (x, y)
  • use the correct type of loop for each component

    To achieve a mark of 100% for this exercise, your program must also:

use a while loop with function calls to SimpleGraphicss mousePos and leftButtonPressed functions to get

the location from the user, instead of using input statements

Do not upload image files unless you have permission from your instructor to use images other than those provided.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Introduction to Computer Science for Multidisciplinary Studies (CPSC 217) Exercise 5 of 8
$25