yuv

convert YUV422 to RGB24

痞子三分冷 提交于 2019-12-23 03:32:17
问题 I tried to write an YUV422 to RGB24 converter, but the result of the converted data seems to be strange. The result is a violet touched greyscale Picture with some light green dots... Does anyone has an idea? inline void convert_yuv442_2_rgb24(const unsigned char* source, unsigned char* destination, unsigned long width, unsigned long height) { unsigned char data[3]; for(unsigned long i = 0, c = 0; i < width * height * 2; i += 2, c += 3) { // 16Bit YUV422 -> 24Bit YUV data[0] = source[i+0];

Incorrect transformation of frames from YUV_420_888 format to NV21 within an image reader

微笑、不失礼 提交于 2019-12-22 10:23:36
问题 I configured my code in order to get a stream of YUV_420_888 frames from my device's camera using an imageReader object and the rest of the well known camera2 API. Now I need to transform these frames to NV21 pixel format and call a native function which expect a frame in this format to perform certain computations. This is the code I am using inside the imagereader callback to rearrange the bytes of the frame: ImageReader.OnImageAvailableListener readerListener = new ImageReader

a lot of GREEN Color at YUV420p --> RGB in OpenGL 2.0 Shader on iOS

不打扰是莪最后的温柔 提交于 2019-12-21 06:28:09
问题 I want to make a movie player for iOS using ffmpeg and OpenGL ES 2.0 but I have some problem. Output RGB image has a lot of GREEN color. This is code and images 480x320 width & height: 512x512 Texture width & height I got a YUV420p row data from ffmpeg AVFrame. for (int i = 0, nDataLen = 0; i < 3; i++) { int nShift = (i == 0) ? 0 : 1; uint8_t *pYUVData = (uint8_t *)_frame->data[i]; for (int j = 0; j < (mHeight >> nShift); j++) { memcpy(&pData->pOutBuffer[nDataLen], pYUVData, (mWidth >> nShift

need to create a webm video from RGB frames

旧城冷巷雨未停 提交于 2019-12-21 05:22:12
问题 I have an app that generates a bunch of jpgs that I need to turn into a webm video. I'm trying to get my rgb data from the jpegs into the vpxenc sample. I can see the basic shapes from the original jpgs in the output video, but everything is tinted green (even pixels that should be black are about halfway green) and every other scanline has some garbage in it. I'm trying to feed it VPX_IMG_FMT_YV12 data, which I'm assuming is structured like so: for each frame 8-bit Y data 8-bit averages of

Convert YUV4:4:4 to YUV4:2:2 images

只愿长相守 提交于 2019-12-20 04:34:29
问题 There is a lot of information on the internet about the differences between YUV4:4:4 to YUV4:2:2 formats, however, I can not find anything that tells how to convert the YUV4:4:4 to YUV4:2:2. Since such conversion is performed using software, I was hoping that there should be some developers that have done it and could direct me to the sources that describe the conversion algorithm. Of course, the software code would be nice to have, but having the access to the theory would be sufficient

How to convert YUV420P image to JPEG using ffmpeg's libraries?

南笙酒味 提交于 2019-12-20 04:15:28
问题 I'm trying to convert a YUV420P image ( AV_PIX_FMT_YUV420P ) to a JPEG using ffmpeg's libavformat and libavcodec . This is my code so far: AVFormatContext* pFormatCtx; AVOutputFormat* fmt; AVStream* video_st; AVCodecContext* pCodecCtx; AVCodec* pCodec; uint8_t* picture_buf; AVFrame* picture; AVPacket pkt; int y_size; int got_picture=0; int size; int ret=0; FILE *in_file = NULL; //YUV source int in_w = 720, in_h = 576; //YUV's width and height const char* out_file = "encoded_pic.jpg"; //Output

Convert from YUV to RGB in c++ (android-ndk)

醉酒当歌 提交于 2019-12-20 02:32:12
问题 Im developing in android, and want to convert the byte-array from the camera's previewCallback, which is in YUV-format, to rgb-format. I have used the function given in this answer: Getting frames from Video Image in Android It works perfectly in java, but my problem is that I want to make the function in c++ (I'm using the ndk, and not very familiar with c++). I have tried to create the function in c++, but it always makes strange results (eg the picture is all green). Does anyone have a

How to extract frames from yuv 420 video clip and store them as different images, using matlab?

一世执手 提交于 2019-12-19 04:14:09
问题 How do I extract the frames from a yuv 420 video? Let's say i want to store them as still images. How? 回答1: Here's a submission from the MathWorks File Exchange that should do what you want: Convert YUV CIF 4:2:0 video file to image files by Da Yu The function loadFileYuv from the above submission will load a YUV file and return an array of movie frames. Each movie frame is a structure with the following fields: cdata : A matrix of uint8 values. The dimensions are height-by-width-by-3.

Convert Android camera2 api YUV_420_888 to RGB

拜拜、爱过 提交于 2019-12-18 11:25:42
问题 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 回答1: In my approach I use OpenCV Mat

Resize (downsize) YUV420sp image

自古美人都是妖i 提交于 2019-12-18 00:50:04
问题 I am trying to resize (scale down) an image which comes in YUV420sp format. Is it possible to do such image resizing without converting it into RGB, so directly manipulating the YUV420sp pixel array? Where can I find such algorithm? Thanks 回答1: YUV 4:2:0 planar looks like this: ---------------------- | Y | Cb|Cr | ---------------------- where: Y = width x height pixels Cb = Y / 4 pixels Cr = Y / 4 pixels Total num pixels (bytes) = width * height * 3 / 2 And the subsamling used like this: