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 GrandTetonjpg
A cool looking photographic effect is the miniature effect diorama, or tiltshift effect. As explained on
Wikipedia miniature faking is a process in which a photograph of a lifesize 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 closeup 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, ie 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 The original photo. Notice the lack of any blurring, ie long depth of
field.
The next version of this picture, shown below, is split in horizontal slices and each part has a
different degree of blurring, going from none at the crosswalk level then to x and up to a x
blurring grid applied to the top th of the photo:
Figure Miniature photo with 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 pLastnameFirstname.py a function
imgminiatureimg that takes as parameters an image ndarray object img obtained from
calling function imageloadfilename and any other arguments you may consider necessary to
be used to customize the blurring location and level The imgminiature 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 imageloadfilename into an object
img, applies function imgminiatureimg to the loaded photo, and then saves the
resulting photograph with the miniature effect to a new file with function imagesavefilename
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 filesave and blurring functions
from file imageblur.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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
