3

Basically, I just need to erase the green screen pixels in one of the images, then overlap it on the background image. Both images are of the same size.

pic1 = "C:\Users\user\Desktop\greenscreen.png"
pic2 = "C:\Users\kazan\Desktop\background.png"
picture = makePicture(pic1)
picture2 = makePicture(pic2)
greenPix = getPixels(picture)
bgPix = getPixels(picture2)
greenValue = []
counter = 0
for pixels in getPixels(picture2):
  xLoc = getX(pixels)
  yLoc = getY(pixels)
  r = getRed(pixels)
  g = getGreen(pixels)
  b = getBlue(pixels)
  setRed(pixel,255-r)
  setGreen=(pixel,255-g)
  setBlue=(255,-b)
explore(picture2)

How do I overlay the green screen picture onto the background picture? I feel like I'm getting somewhere, but I'm definitely not quite there yet.

  • I would suggest using `numpy` and `PIL` for this kind of work as looping through individual pixels will take *forever*. Numpy array operation in comparison is *very fast* and *concise* – Rocky Li Oct 26 '18 at 00:56

0 Answers0