Question: type the code in python here is the file name Grand _ Teton - 8 0 0 - 4 8 0 . jpg A cool

type the code in python here is the file name Grand_Teton-800-480.jpg
A cool looking photographic effect is the miniature effect diorama, or tilt-shift effect. As explained on
Wikipedia miniature faking is a process in which a photograph of a life-size location or object is
made to look like a photograph of a miniature scale model.
Depth of field is the distance between the nearest and the furthest objects that give an image judged to
be in focus in a camera.
The effect can be added with post processing to a normal photo with a wide depth of field by blurring
parts of the photograph to mimic a shallow depth of field typical for close-up photography. The result is
that the captured scene looks much smaller than in reality.
Here is an example. The original photograph with a long depth of field and no blurring is this:
Notice that all parts of the picture are in focus, i.e. there is no blurring at all since the photo has a large
depth of field.
Compare it with this version of the same photo, where the top third and bottom third have been blurred
to some degree in a first attempt to produce the miniature effect:
Figure 1. The original photo. Notice the lack of any blurring, i.e. long depth of
field.
The next version of this picture, shown below, is split in 12 horizontal slices and each part has a
different degree of blurring, going from none (at the crosswalk level), then to 3x3 and up to a 31x31
blurring grid applied to the top 12th of the photo:
Figure 2. Miniature photo with 3 blurring zones.
Blurred
Blurred
Unblurred
Ideally, to accurately mimic the continuous optical phenomenon, the strength of the blurring must vary
depending on the camera angle and the actual depth of field of the subjects in the photo. We accept for
this problem the rough approximation obtained by blurring equal size horizontal slices of the
photograph with discrete levels of blurring, as seen above. We also must acknowledge that each picture
may require a different blurring map (where and how much blurring) and that each person may have
their own personal taste on how to make the effect look good.
For this problem you have to write in file p3_Lastname_Firstname.py a function
img_miniature(img,......) that takes as parameters an image ndarray object img obtained from
calling function image_load(filename) and any other arguments you may consider necessary to
be used to customize the blurring (location and level). The img_miniature function returns a
new image ndarray of the same shape as img with the miniature effect applied to your desire,
but with minimum three slices of different blurring levels.
Write a function main() that loads a picture from a file with image_load(filename) into an object
img, applies function img_miniature(img,......) to the loaded photo, and then saves the
resulting photograph with the miniature effect to a new file with function image_save(filename,
img).
Include in the PDF file the Python code, followed by the original photo and the photo with the
miniature effect. Use an photograph (with prior effects) of your choice. No credit is given for
the screenshots if the miniature effect is NOT applied to the original photograph.
NOTICE: To get any credit for this problem you must use the image file/save and blurring functions
from file image_blur.py, posted on the Image Effects page on Canvas and discussed in class. Do not
use any blurring functions from any other library.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!