Log in

View Full Version : ColorYUV(levels="TV->PC") Formula


Corpsecreate
1st July 2024, 13:17
Hi,

I'm trying to figure what formula this is using under the hood to make the conversion. Reason for this is that I'm doing some image processing in Python using OpenCV and I would like to replicate the formula performed by this function. The formula I am currently using is:

result = (np.clip( (LUMA - 16) / (235 - 16), 0.0, 1.0) * 255).round().astype(np.uint8)

This is really close, but seems to be more aggressive in the blacks compared with ColorYUV. Any ideas?

Thanks!

DTL
1st July 2024, 19:31
In math it is expected
Full = (Y-16)*(255/219). And clip output to 255..0.