Start with a picture of someone you know and make some specific color changes to it:
• Turn the teeth purple.
• Turn the eyes red.
• Turn the hair orange.
Of course, if your friend’s teeth are already purple, or eyes red, or hair orange, choose a different target color.
```
def monsterify(picture, teethStartX, teethStartY, teethEndX, teethEndY, teethColor,
teethDistance, eyesStartX, eyesStartY, eyesEndX, eyesEndY, eyesColor, eyesDistance,
hairStartX, hairStartY, hairEndX, hairEndY, hairColor, hairDistance):
for px in getPixels(pic):
x = getX(px)
y = getY(px)
if (teethStartX <= x <= teethEndX) and (teethStartY <= y <= teethEndY):
if (distance(teethColor,getColor(px)) < teethDistance):
setColor(px,makeColor(255,0,255))
if (eyesStartX <= x <= eyesEndX) and (eyesStartY <= y <= eyesEndY):
if (distance(eyesColor,getColor(px)) < eyesDistance):
setColor(px,red)
if (hairStartX <= x <= hairEndX) and (hairStartY <= y <= hairEndY):
if (distance(hairColor,getColor(px)) < hairDistance):
setColor(px,orange)
```
Note: The solution above will work for any image, but could easily have been tailored to a specific one given the way the question was stated.
You might also like to view...
Suppose class Child is derived from class Parent was in turn derived from class GrandParent. The class Parent and GrandParent are the
a) Predecessor classes of class Child b) Forebearer classes of class Child c) Ancestor classes of class Child d) Descendant classes of class Child e) None of the above
If users require the ability to both read and write to a compact disc they need a(n) ________ drive
Fill in the blank(s) with correct word
__________ was developed by Phil Zimmermann and uses the IDEA cipher for message encoding.
A. PEM B. PGP C. S/MIME D. SSL
Excel attempts to guess which cells you want to include in the function by looking for ranges that are adjacent to the selected cell and that contain numeric data.
Answer the following statement true (T) or false (F)