Try doing chromakey in a range. The picture \"statue-tower.jpg\" has a blue, but
ID: 3675027 • Letter: T
Question
Try doing chromakey in a range. The picture "statue-tower.jpg" has a blue, but not blue enough background to work with chromakeyBlue. However, if you change the rule to getRed(px) + getGreen(px) < getBlue(px)+100, it works great for the sky - but messes up near the ground I have to Chnage chromakeyBlue to use the modified rule, and apply it to "statue-tower.jpg" and Write a chromakeyBlueAbove to take in an input picture, a new background, and a number. The number is a y value, and you shoul donly do chromakey to pixels above that input y. Apply it to "statue-tower.jpg" so that the blye of the sky gets changed to the moon or the jungle, but the area near the ground is not touched
Programming language is Python
Explanation / Answer
This below python code will change the blue color at moon or jungle but the area near the ground is not touched.
See the taken input as pict, bg and y value..based on these inputs updated the picture..
def chromakeyBlueAbove (pict, bg, y):
newPict = duplicatePicture(pict)
for y in range(getHeight(newPict)):
for x in range(getWidth(newPict)):
px = getPixel(newPict, x, y)
# A definition of green
if (getRed(px) + getBlue(px) < getBlue(px)+100):
setColor(px, getColor(getPixel(bg, x, y)))
return newPict
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.