So, for my assignment I have to make an image look like part of it was a green screen or blue screen or whatever you want to call it (what they use for things like weather forecasts on tv). So that means turning certain pixels blue/green/whatever. I can that much. It is getting certain ones to turn a color while leaving others alone. It is driving me insane. I can get kinda there but the part I want left alone won't stay left alone.
from image import *
from graphics import *
def replaceWall(image, color):
imageCopy = image.copy()
width = imageCopy.getWidth()
height = imageCopy.getHeight()
for row in range(height):
for col in range(width):
(r, g, b) = imageCopy.getPixel2D(col, row)
#Fill in to specify pixels. Blahblahblah!
imageCopy.setPixel2D(col, row, color)
return imageCopy
original = FileImage("amy.jpg")
wallColor = (0, 255, 0)
modified = replaceWall(original, wallColor)
original.show("Original", 100, 100)
modified.show("Modified", 100, 400)
endProgram = raw_input("Press <Enter> to exit. ")
It is what to put in the commented area that I am having trouble. I have tried every single combination of if statements containing things like r >= 150, etc. and none seem to work right. Makes me want to throw things at Python. D:
Does anyone have any help whatsoever?
Should I include the image?