Your matrix has shape (3, 3)
while your image has shape (rows, cols, 3)
and np.dot
does "a sum product over the last axis of a and the second-to-last of b."
The simplest solution is to reverse the order of the operands inside np.dot
and transpose your conversion matrix:
rgb2yuv = np.array([[0.299, 0.587, 0.114],
[-0.14713, -0.28886, 0.436],
[0.615, -0.51499, -0.10001]])
self.yuv = np.dot(self.rgb, rgb2yuv.T)