yuv

OpenCV Error reading YUV buffer

浪尽此生 提交于 2019-12-05 20:33:46
I'm trying to get high resolution uncompressed images through the camera of an Android phone (Samsung Galaxy S3), using OpenCV v2.4. I set width and height using VideoCapture.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, width) and same for height, but whenever I go to a mid-high resolution, the following error starts appearing: ERROR reading YUV buffer: width=1600, height=1200, size=2880000, receivedSize=1036800 I'm guessing it means that the buffer is not big enough to store all the data, which I understand, but there must be some way to allocate a bigger buffer. Does anybody know how, or any

Convert YUY2 to YV12

一世执手 提交于 2019-12-05 13:05:45
I am almost sure that this is much simpler than I think it is, but I have been scouring the internet for a much longer time than I care to admit to try and figure out how the frig to convert the two formats. I am able to extract the Y0, Cb, Y1, Cr data from a stream of unsigned bytes (unsigned char), but I have no idea how these bytes are arranged in YV12 - is this document implying that the various values are actually contained in different rows? I've literally been searching all day for things like "c++ convert YUY2 to YV12," and have turned up absolutely no tutorials or code samples. I

Out of Memory when using compresstojpeg on multiple YuvImage one at a time

梦想的初衷 提交于 2019-12-05 08:35:37
I am building an app that buffers N camera frames and when the user taps a button it saves the photo using all the saved frames applying an effect. I am saving the photo and processing the frames on an AsyncTask . When I execute it, I remove everything from the screen and leave only a TextView to display the progress of saving the photo. Currently the AsyncTask doInBackground looks like this: protected Void doInBackground(Integer... params) { int w = mBuffer.get(0).getWidth(); int h = mBuffer.get(0).getHeight(); int lineHeight = h / mBuffer.size(); int currentHeight = 0; Log.d("output",

how to display data of yuv format without converting rgb in OpenGL ES?

十年热恋 提交于 2019-12-05 06:01:39
问题 I have being study about OpenGL ES for iOS. I wonder that data of YUV format is can display without converting RGB. In most, the yuv data have to convert RGB for display. But, converting process is very slow, Then, that is not display smoothly. So, I would like to try to dispaly YUV data without convert to RGB. Is it possible? If possible, what can I do? Please, let me give a advice. 回答1: I think it is not possible in OpenGL ES to display YUV data without convert to RGB data. 回答2: You can do

Correct YUV422 to RGB conversion

此生再无相见时 提交于 2019-12-04 23:54:10
问题 I've been trying to tackle a YUV422 into a RGB conversion problem for about a week. I've visited many different websites and have gotten different formulas from each one. If anyone else has any suggestions I would be glad to hear about them. The formulas below give me an image with either and overall purple or a green hue in them. As of this moment I haven't been able to find a formula that allows me to get back a proper RGB image. I have include all my various chunks of code below. //for(int

零基础,史上最通俗视频编码技术入门

╄→尐↘猪︶ㄣ 提交于 2019-12-04 23:20:46
本文引用了微信公众号“鲜枣课堂”的《视频编码零基础入门》文章内容。为了更好的内容呈现,引用和收录时内容有改动,转载时请注明原文来源信息,尊重原作者的劳动。 1、引言 如今我们所处的时代,是移动互联网时代,也可以说是视频时代。从快播到抖音,从“三生三世”到“延禧攻略”,我们的生活,被越来越多的视频元素所影响。 而这一切,离不开视频拍摄技术的不断升级,还有视频制作产业的日益强大。 此外,也离不开通信技术的飞速进步。试想一下,如果还是当年的56K Modem拨号,或者是2G手机,你还能享受到现在动辄1080P甚至4K的视频体验吗? 除了视频拍摄工具和网络通信技术升级之外,我们能享受到视频带来的便利和乐趣,还有一个重要因素,就是视频编码技术的突飞猛进。 视频编码技术涉及的内容太过专业和庞杂,市面上的书籍或博客多数都只是枯燥的技术概念罗列,对于新手来说读完依旧蒙逼是常态,本文将借此机会,专门给大家做一个关于视频编码的零基础科普。 ▼ 本文涉及概念较多,为了方便阅读,本文的内容目录对应如下: 1、引言 2、系列文章 3、图像基础知识 3.1)什么是像素? 3.2)什么是PPI? 3.3)颜色在计算机里是如何表示的? 4、视频编码基础知识 4.1)视频和图像和关系 4.2)未经编码的视频数据量会有多大? 4.3)什么是编码? 5、视频编码的实现原理 5.1)视频编码技术的基本原理 5.2

OpenCV for Android: Convert Camera preview from YUV to RGB with Imgproc.cvtColor

妖精的绣舞 提交于 2019-12-04 15:41:09
I get a runtime error if I try to convert camera preview YUV byte array to a RGB(A) byte array with Imgproc.cvtColor( mYUV_Mat, mRgba_Mat, Imgproc.COLOR_YUV420sp2RGBA, 4 ) in onPreviewFrame(byte[] data, Camera camera): Preview.java: mCamera.setPreviewCallback(new PreviewCallback() { public void onPreviewFrame(byte[] data, Camera camera) { // Pass YUV data to draw-on-top companion System.arraycopy(data, 0, mDrawOnTop.mYUVData, 0, data.length); mDrawOnTop.invalidate(); } }); DrawOnTop.java: public class DrawOnTop extends View { Bitmap mBitmap; Mat mYUV_Mat; protected void onDraw(Canvas canvas) {

Where can I obtain a raw YUV File? [closed]

落花浮王杯 提交于 2019-12-04 10:28:57
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . I need a raw YUV file for research purposes. Neither the size nor the content is critical. Any ideas on where such files exist? 回答1: You can find all kinds of YUV files with different formats: here. 回答2: You can use ffmpeg to convert any other video type to raw YUV. Your source could be from a DVD home movie,

Issue with writing YUV image frame in C/C++

泪湿孤枕 提交于 2019-12-04 09:45:09
问题 I am trying to convert an RGB frame, which is taken from OpenGL glReadPixels(), to a YUV frame, and write the YUV frame to a file (.yuv). Later on I would like to write it to a named_pipe as an input for FFMPEG, but as for now I just want to write it to a file and view the image result using a YUV Image Viewer. So just disregard the "writing to pipe" for now. After running my code, I encountered the following errors: The number of frames shown in the YUV Image Viewer software is always 1/3 of

texture for YUV420 to RGB conversion in OpenGL ES

狂风中的少年 提交于 2019-12-04 05:37:32
I have to convert and display YUV420P images to RGB colorspace using the AMD GPU on a Freescale iMX53 processor (OpenGL ES 2.0, EGL). Linux OS, no X11. To achieve this I should be able to create an appropriate image holding the YUV420P data: this could be either a YUV420P/YV12 image type or 3 simple 8-bit images, one for each component (Y, U, V). glTexImage2D is excluded, because it's slow, the YUV420P frames are the results of a real time video decoding @25FPS and with glTexImage2D we can't keep the desired framerate. There's an alternative: eglCreateImageKHR/glEGLImageTargetTexture2DOES. The