This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
#input is a RGB numpy array with shape (height,width,3), can be uint,int, float or double, values expected in the range 0..255 | |
#output is a double YUV numpy array with shape (height,width,3), values in the range 0..255 | |
def RGB2YUV( rgb ): | |
m = np.array([[ 0.29900, -0.16874, 0.50000], | |
[0.58700, -0.33126, -0.41869], | |
[ 0.11400, 0.50000, -0.08131]]) |