For your sixth lab we’re going all in on a creative project. You’ll need to design multiple functions and get them working together to to create a chromakey masterpiece.

  • Don’t forget that at the end of each chapter contains a Programming Summary section that provides a quick dictionary of all of the important function and encoding names introduced thus far. When you run into problems don’t forget to check the Common Bugs and Debugging Tips scattered throughout the chapters as well. If you’re stuck on an error try looking at these items.
  • As always switch the driver (person typing the code) and navigator (person watching, helping spot typos, etc.) on every new problem or every half hour, whichever comes first.
  • Do all of the problems in a single python file. Put everyone’s name in a comment at the top of the file. Label the start of each problem with a comment.

To Do

I have four cats. I used to have five. Did I mention I’m alergic to cats? Like any crazy cat owner, I have way, way, way too many pictures of my cats. Today you’re going to play the programmers version of photoshop battle with one of my uncountable number of cat pictures. Rather than use photoshop, you’ll use Python. The picture in question is on the site next. Here’s what must happen:

  • Design one or more functions to set the background to a single color suitable for the chromakey, background substitution technique. Try to keep as much of the box and the blanket in the box as possible while getting rid of the floor and the remainder of the background. Bragging rights will go to the group that does the best job cropping the box-o-cat.
  • Design one or more functions that use the chromakey technique to replace the background with one or more backgrounds of your choosing. Get creative and virtually send my old grumpy cat on an amazing journey. Consider layering backgrounds horizontally or vertically. Don’t shy away from using color-modification techniques on the backgrounds as well to really ramp things up. Have fun with it!
  • Setup your final program in the same fashion that you see in my version of the lab 4 art project. This means having a single main function that takes zero inputs and that loads the image and calls all the necessary sub-functions to complete your final product, i.e. it coordinates and does everything.
    «««< HEAD
  • Print your code and submit it in person. Email a copy of the code and your final image to the instructor.


  • Optional: If you want you can modify the colors of the cat box image before, after, or during the cropping. Additionally, you can modify the color of the finished image. Don’t feel constrained by the colors as the appear in the original images.

Remember, you have three hours to complete your work of art. Have fun. Be creative. Don’t low-bar the whole thing and try to get done early but don’t go crazy and come up with a plan that takes more than three hours to complete. Work in chunks and test each step as you go.