yuv

Convert NV21 byte array into bitmap readable format [duplicate]

风格不统一 提交于 2019-12-28 06:47:26
问题 This question already has answers here : How to use ScriptIntrinsicYuvToRGB (converting byte[] yuv to byte[] rgba) (5 answers) Closed last year . Hey I'm creating small camera app I have implemented every things but I have one problem which is converting NV21 byte array into jpeg format I have found many way but all of them even not working or work on some devices firstly i tried this snippet and it work on Xperia z2 5.2 but on galaxy s4 4.4.4 bitmap = BitmapFactory.decodeByteArray(data, 0,

How to convert RGB from YUV420p for ffmpeg encoder?

寵の児 提交于 2019-12-28 01:55:21
问题 I want to make .avi video file from bitmap images by using c++ code. I wrote the following code: //Get RGB array data from bmp file uint8_t* rgb24Data = new uint8_t[3*imgWidth*imgHeight]; hBitmap = (HBITMAP) LoadImage( NULL, _T("myfile.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); GetDIBits(hdc, hBitmap, 0, imgHeight, rgb24Data , (BITMAPINFO*)&bmi, DIB_RGB_COLORS); /* Allocate the encoded raw picture. */ AVPicture dst_picture; avpicture_alloc(&dst_picture, AV_PIX_FMT_YUV420P, imgWidth,

Displaying YUV Image in Android

为君一笑 提交于 2019-12-27 19:14:30
问题 In my application, we need to display the Video frame receives from server to our android application, Server is sending video data @ 50 frame per second, having encoded in WebM i.e. using libvpx to encode and decode the images, Now after decoding from libvpx its getting YUV data, that we can displayed over the image layout, the current implementation is something like this, In JNI / Native C++ code, we are converting YUV data to RGB Data In Android framework, calling public Bitmap

Displaying YUV Image in Android

梦想的初衷 提交于 2019-12-27 19:14:26
问题 In my application, we need to display the Video frame receives from server to our android application, Server is sending video data @ 50 frame per second, having encoded in WebM i.e. using libvpx to encode and decode the images, Now after decoding from libvpx its getting YUV data, that we can displayed over the image layout, the current implementation is something like this, In JNI / Native C++ code, we are converting YUV data to RGB Data In Android framework, calling public Bitmap

常用视频像素格式NV12、NV21、I420、YV12、YUYV

亡梦爱人 提交于 2019-12-27 04:16:04
最近因为任务需要,遇到视频像素格式的问题,学习了NV12和YV12,以及UYVY的具体存储区别。 总结如下: 像素格式描述了像素数据存储所用的格式,定义了像素在内存中的编码方式,RGB和YUV是两种经常使用的像素格式。 RGB:较为熟悉,具有3个通道R G B,分别对应红 绿 蓝三个分量,由三个分量的值决定颜色;通常,会给RGB图像加一个通道alpha,即透明度,于是共有四个分量共同控制颜色。(常用的opencv库默认将图片以BGR的方式进行存储,只是通道顺序不一样而已) YUV:(YCrCb)是指将亮度参量Y和色度参量U/V分开表示的像素格式,主要用于优化彩色视频信号的 传输 。 YUV像素格式来源于RGB像素格式,通过公式运算,YUV三分量可以还原出RGB,YUV转RGB的公式如下: R = Y + 1.403V G = Y - 0.344U - 0.714V B = Y + 1.770U 一般,将RGB和YUV的范围均限制在[0,255]间,则有如下转换公式: R = Y + 1.403(V - 128) G = Y - 0.344(U - 128) - 0.714(V - 128) B = Y + 1.770(U - 128) YUV采样:YUV相比于RGB格式最大的好处是可以做到在保持图像质量降低不明显的前提下,减小文件大小。YUV格式之所以能够做到,是因为进行了采样操作

BitmapFactory null issue in android

微笑、不失礼 提交于 2019-12-25 08:51:05
问题 I am trying to create bitmap class using bitmapfactory. I get camera preview image in YUV format and decode manually to grayscale image. When i try to create bitmap object via BitmapFactory it returns null. try { for (int y = 0; y < frameHeight; y++){ for (int x = 0; x < frameWidth; x++){ byte grey = YUVData[y * frameWidth + x]; convertedData[y * stride + 3 * x] = grey; convertedData[y * stride + 3 * x + 1] = grey; convertedData[y * stride + 3 * x + 2] = grey; } } Bitmap bitmap =(Bitmap)

opencv基础入门——色彩空间

江枫思渺然 提交于 2019-12-25 03:55:22
参考教程: python+opencv3.3视频教学 基础入门-bilibili 颜色空间 - 911的专栏 几种颜色模型介绍 - 简书 从 RGB 到 HSV 的转换详细介绍 - hanshanbuleng的博客 一、定义 色彩通常用三个相对独立的属性来描述,三个独立变量综合作用,自然就构成一个 空间坐标 ,这就是 色彩空间(色彩模型) 。 二、常见色彩空间 色彩可以由不同的角度,用三个一组的不同属性加以描述,就产生了不同的色彩空间。 最常见的几种色彩空间有: RGB 用于扫描仪和显示设备 、计算机系统 CMYK 用于打印机、印刷出版业 YUV/YIQ 用于视频和电视 HIS/HSB/HSV/HSL CIE 颜色空间,包括:CIE XYZ,CIE Lab,CIE YUV等颜色空间 1.RGB 一个能发出光波的物体称为有源物体,它的颜色由该物体发出的光波决定,使用R GB相加混合模型(additive color) 。 国际照明委员会(CIE)规定以 700nm(红)、546.1nm (绿)、435.8nm (蓝)三个色光为三基色 。又称为 物理三基色 。自然界的所有颜色都可以通过选用这三基色按不同比例混合而成。 计算机彩色显示器的输入需要RGB三个彩色分量,通过三个分量的不同比例,在显示屏幕上合成所需要的任意颜色。RGB颜色空间的三个分量又称为三个通道,R、G

How to manipulate on the fly YUV Camera frame efficiently in Android?

拟墨画扇 提交于 2019-12-25 03:35:07
问题 I'm adding a black (0) padding around Region of interest (center) of NV21 frame got from Android CameraPreview callbacks in a thread. To avoid overhead of conversion to RGB/Bitmap and reverse, I'm trying to manipulate NV21 byte array directly but this involves nested loops which is also making preview/processing slow. This is my run() method sending frames to detector after calling method blackNonROI . public void run() { Frame outputFrame; ByteBuffer data; while (true) { synchronized (mLock)

how to fetch raw YUV420p camera data

蹲街弑〆低调 提交于 2019-12-25 02:32:45
问题 I don't know which value to use to fetch raw YUV420p data. code below first: AVCaptureVideoDataOutput *output = [[AVCaptureVideoDataOutput alloc] init]; output.alwaysDiscardsLateVideoFrames = YES; output.videoSettings = @{(id)kCVPixelBufferPixelFormatTypeKey: [NSNumber numberWithUnsignedInt:kCVPixelFormatType_420YpCbCr8BiPlanarFullRange]}; //output.videoSettings = @{(id)kCVPixelBufferPixelFormatTypeKey: [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA]}; dispatch_queue_t queue; queue

Converting more yuv frames to one yuv frame

别说谁变了你拦得住时间么 提交于 2019-12-24 17:12:27
问题 I have some number of images in yuv format which are all part of one sequence I captured. Now I want to make video by converting them to mpg4 file. But before doing that I need somehow to make one yuv file from all of those yuv frames that I have. I have heard that it's possible, but couldn't find anything on Internet. Does anyone knows how to do that? Apparently there is a Windows command for such thing... Thanks 回答1: YUV-video (or more correctly YCbCr) is just a concatenation of all frames