RGB to YUV using GLSL [closed]

旧街凉风 提交于 2019-12-06 03:04:41
miguelao

For future reference, a bunch of colorspace conversions in GLSL shaders can be found in Gstreamer gst-plugins-gl codebase :)

user1118321

First, you should know that your question is poorly phrased. Nobody is going to write you sample code. You can use a search engine (or even search this site) for code to convert from RGB to YUV.

I have written an answer similar to what you're looking for here. It converts from RGB to YIQ, does some shifting of the hue and converts back. You can use the Y'CbCr matrix for the color conversion instead of YIQ, if that's what you need.

It doesn't down-convert to 4:2:0, though. That should be easy enough to do, though. Once it's in Y'CbCr format, you can downsample the appropriate channels as you see fit. I recommend doing a low-pass filter on those channel first to avoid aliasing artifacts.

I don't work with Linux, so haven't tested on Ubuntu. Good luck.

This link has a YUV 4:2:2 v210 to RGB implementation using a compute shader GLSL. YUV 4:2:2 v210 --> RGB GLSL source code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!