Skip to content

Instantly share code, notes, and snippets.

@ColtonPhillips
Created July 2, 2015 12:35
Show Gist options
  • Save ColtonPhillips/c028918d5386ca7f4b53 to your computer and use it in GitHub Desktop.
Save ColtonPhillips/c028918d5386ca7f4b53 to your computer and use it in GitHub Desktop.
Converts ycbcr to rgb
#http://www.equasys.de/colorconversion.html
import sys
y = sys.argv[1]
cb = sys.argv[2]
cr = sys.argv[3]
y = int(y)
cb = int(cb)
cr = int(cr)
r = y + 1.4 * (cr - 128)
g = y + (-0.343)*(cb - 128) + (-0.711)*(cr - 128)
b = y + 1.765*(cb - 128)
print ("RGB", r,g,b, "YCbCr", y, cb, cr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment