yuv

How to display a raw YUV frame in a Cocoa OpenGL program

旧街凉风 提交于 2019-12-01 02:20:35
I have been assigned wit the task to write a program that takes a sample raw YUV file and display it in a Cocoa OpenGL program. I am an intern at my job and I have little or no clue how to start. I have been reading wikipedia & articles on YUV, but I couldn't find any good source code on how to open a raw YUV file, extract the data and convert it into RGB and display it in the view window. Essentially, I need help with the following aspects of the task -how to extract the YUV data from the sample YUV file -how to convert the YUV data into RGB color space -how to display the RGB color space in

Problems when scaling a YUV image using libyuv library

拈花ヽ惹草 提交于 2019-12-01 02:06:34
I'm developing a camera app based on Camera API 2 and I have found several problems using the libyuv . I want to convert YUV_420_888 images retrieved from a ImageReader, but I'm having some problems with scaling in a reprocessable surface. In essence: Images come out with tones of green instead of having the corresponding tones (I'm exporting the .yuv files and checking them using http://rawpixels.net/ ). You can see an input example here: And what I get after I perform scaling: I think I am doing something wrong with strides, or providing an invalid YUV format (maybe I have to transform the

Convert RGBA to YUV by OpenGL ES shader

别说谁变了你拦得住时间么 提交于 2019-11-30 23:40:16
最近在做android平台摄像头采集和视频渲染,当想要把性能做到极致的时候,总避不开使用GPU。在视频采集、美颜以及其他前处理之后,需要将数据转换成I420格式,方便后续处理,如果使用CPU去做会导致性能瓶颈。因为我们在前处理过程都是采用GPU去做,因此这个转换使用GPU去做不仅方便,而且能充分利用GPU的优势。 1. 输入输出数据格式 在编写OpenGL ES的shader前,先需要确定好fragment shader的输入和输出格式。输入可以是一个包含RGBA的texture,或者是分别包含Y、U、V的三个texture,也可以使包含Y和UV的两个texture(UV分别放在texture rgba的r和a中,NV21和NV12都可以用这种方式)。输出的texture不仅要包含所有的YUV信息,还要方便我们一次性读取I420格式数据(glReadPixels)。因此输出数据的YUV紧凑地分布: +---------+ | | | Y | | | | | +----+----+ | U | V | | | | +----+----+ 而对于OpenGL ES来说,目前它输入只认RGBA、lumiance、luminace alpha这几个格式,输出大多数实现只认RGBA格式,因此输出的数据格式虽然是I420格式,但是在存储是我们仍然要按照RGBA方式去访问texture数据。

Problems when scaling a YUV image using libyuv library

你离开我真会死。 提交于 2019-11-30 21:29:19
问题 I'm developing a camera app based on Camera API 2 and I have found several problems using the libyuv. I want to convert YUV_420_888 images retrieved from a ImageReader, but I'm having some problems with scaling in a reprocessable surface. In essence: Images come out with tones of green instead of having the corresponding tones (I'm exporting the .yuv files and checking them using http://rawpixels.net/). You can see an input example here: And what I get after I perform scaling: I think I am

Converting YUV420SP to YUV420P

柔情痞子 提交于 2019-11-30 16:32:46
How do I to convert YUV420SP to YUV420P using ffmpeg sws_scale or another efficient method? There are an enormous amount of different YUV-formats available, as a starting point see http://www.fourcc.org/yuv.php You need to be more specific in you question since "Semi Planar" and "Planar" doesn't really tell how the data is formatted. But as a general advice, it's just raw-data placed contiguously. All you need to do is to read the correct amount of data from the in-stream and write it to the out-stream using your favorite language. If you are using swscale lib from ffmpeg the following code

How to convert RGB -> YUV -> RGB (both ways)

柔情痞子 提交于 2019-11-30 13:00:23
问题 I want a pair of conversion algorithms, one from RGB to YUV, the other from YUV to RGB, that are inverses of each other. That is, a round-trip conversion should leave the value unchanged. (If you like, replace YUV with Y'UV, YUV, YCbCr, YPbPr.) Does such a thing exist? If so, what is it? Posted solutions (How to perform RGB->YUV conversion in C/C++?, http://www.fourcc.org/fccyvrgb.php, http://en.wikipedia.org/wiki/YUV) are only inverses (the two 3x3 matrices are inverses), when omitting the

iOS - How to draw a YUV image using openGL

烂漫一生 提交于 2019-11-30 10:49:35
问题 Currently, I am trying to draw an image using openGL (the image updates very often, and thus must be redrawn). Previously, I was converting my image from YUV to RGB, and then using this new image to draw with openGL. All worked fine, but the conversion process was not particularly fast. I am now attempting to change the code so that the conversion is taken care of in the openGL shaders. After looking around, I've found a couple code snippets (particularly the shaders and the bulk of my

YUV to RGBA on Apple A4, should I use shaders or NEON?

匆匆过客 提交于 2019-11-30 10:17:05
问题 I'm writing media player framework for Apple TV, using OpenGL ES and ffmpeg. Conversion to RGBA is required for rendering on OpenGL ES, soft convert using swscale is unbearably slow, so using information on the internet I came up with two ideas: using neon (like here) or using fragment shaders and GL_LUMINANCE and GL_LUMINANCE_ALPHA. As I know almost nothing about OpenGL, the second option still doesn't work :) Can you give me any pointers how to proceed? Thank you in advance. 回答1: It is most

skin detection in the YUV color space?

元气小坏坏 提交于 2019-11-30 07:38:21
can i perform skin detection using a set of rules (things like x1 < Y < x2 ) The short answer is yes , you can. However, luminance (Y) is actually irrelevant . It's the chrominance (CbCr or UV) that matters. One of the most cited papers in this area is this one (uncompressed PS file). I've implemented it and it seems to work fairly well. UPDATE: the link above seems to have become broken, so here is the bibtex citation of the paper: @ARTICLE{767122, author={Chai, D. and Ngan, K.N.}, journal={Circuits and Systems for Video Technology, IEEE Transactions on}, title={Face segmentation using skin

Convert Android camera2 api YUV_420_888 to RGB

蹲街弑〆低调 提交于 2019-11-30 03:19:30
I am writing an app that takes the camera feed, converts it to rgb, in order to do some processing. It works fine on the old camera implementation which uses NV21 Yuv format. The issue I am having is with the new Yuv format, YUV_420_888. The image is no longer converted correctly to RGB in the new Camera2 Api which sends YUV_420_888 yuv format instead of NV21 (YUV_420_SP) format. Can someone please tell me how should I convert YUV_420_888 to RGB? Thanks In my approach I use OpenCV Mat and script from https://gist.github.com/camdenfullmer/dfd83dfb0973663a7974 First of all you convert your YUV