Like part b, this part of the assignment will be completed in Pycharm. Please follow instructions on the Installing Pycharm handout to download python and Pycharm before starting.
For this project, you will use code and your creativity to create a bluescreen image. We will have a class art-show and some small prizes with all this artistic output.
We will have an in class art-show and contest using these images.
The contest categories for the images are:
The foreground image for the bluescreen must be one that you yourself take; not something you grabbed off the internet. Often you yourself will appear in your foreground image. The Background image can be from anywhere, and please keep in mind that a selection of the entries will be shown to the whole class.
See file bluescreen.py (in the image-grid folder) which has working code set up like the lecture monkey example. You can use adjust this code in any way, if needed, to get the effect you want. Run the front strategy with this command line (make sure to use py instead of python3 if you are on a windows computer).
$ python3 bluescreen.py monkey-500.jpg moon-600.jpg
With the front strategy, the back image needs to be at least as big as the front image
See the back strategy with with the following command line. In the command line below, the "200" is a shift_x applied to the monkey, so 200 moves it to the right, and -50 would move it to the left on the background image.
$ python3 bluescreen.py monkey-500.jpg 200 stanford-600.jpg
For the grading of this project, you can get full marks from an image that demonstrates creating a real image and processing it with the bluescreen algorithm, and we will not be picky about the level of artistry or creativity. The artistry and creativity are important instead for the in-class art show and contest.
How to create your own bluescreen:
First create several "foreground" pictures with people or whatever in front of a blue or green colored background, and save those images on your computer. You can use, say, a blue towel as background. We are not grading on the artistic details of your photography here; we just want an image and some code that work together. For the contest however, the sky is the limit.
Take a few different foreground images so you can experiment. For example, take one image with people in the center and another with them off to the side to fit in with interesting parts of the background. You can also try dressing the people in the foreground with blue clothes, so the background will show through those areas. You don't have to use blue, green is also popular, and you would just fix the code to work with your background color.
Digital cameras create very large images like 4000 by 3000 pixels, 12 megapixels, and such large images will take too long to process and have far more pixels than the displays we have. Keep your original images, and create smaller versions for processing, say reduced to a width of 600 or 800 pixels with a filename like "myimage-600.jpg".
On the Mac, the built-in Preview application can crop and resize and export images, and on Windows I assume there's something similar. In Preview: open your original, use the Duplicate menu command first to save your original, then crop and resize and save.
"Fix It In Post" is a sort of Hollywood joke, referring to fixing some on-camera mistake later on in the computer post-production phase. This is totally optional, but you can do the same sort thing with your bluescreen image. For example, if part of the blue background is not quite big enough, you can edit the image in a paint program, and draw a blue rectangle over the area to just make it be blue the way you want. Since the blue gets removed by the bluescreen algorithm, it never appears in the final image. You are just creating a sort of hole for the background image to show through. On the Mac, the built-in Preview image app has a very limited ability to put colored rectangles and ovals on things, and on Windows the Paint program is similar.
You can fix up your image this way, but we want the actual bluescreen composition to be done by your code.
There are two strategies shown in the bluescreen.py file; either of these is fine for your output.
The simplest bluescreen form is the one shown with the monkey/moon example.
Front Algorithm: Loop over the main front image (e.g. monkey in front of blue). Detect blue pixels, copy over pixels from the background on top of the blue pixels. The background needs to be as big as the front image, so we do not get out-of-bounds errors accessing non-existent pixels on the background. If you get that error, resize the back to be bigger in an image editor and try again. The changed front image is the final output
Loop over the front image. Detect non-blue (i.e. monkey) pixels. Copy these monkey pixels over to the back image, possibly shifted by some shift_x/shift_y amount to move the monkey to a specific spot on the background. When done, the changed background image is the final output.
The bluescreen output image files should be the product of your input files and your edits to the bluescreen.py code. You will submit your output image files and your bluescreen.py code. Save your favorite bluescreen output as a .png or .jpg file for upload. Please use your name in the file name, like "jane-smith1.png" to help use keep the entries organized. You must submit 1 bluescreen image, and you can submit a second if you like.
When you have your bluescreen output looking good, please submit your 1 or 2 output image files and your edited bluescreen.py file on Paperless as HW2.2.