本文介绍了在preVIEW转换YUV到YUV420的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

A)我在想,什么是YUV和YUV420之间的区别? B)我想从相机使用原始帧并将它们转换成YUV420的实时性。什么是做到这一点的最快方法?我用位图厂从YUV转换成JPG,我用的onDraw()方法来绘制位图。然而,这需要一些时间来处理。什么是做转换,如果我想从转换为YUV YUV420的最佳替代品?

a)I was wondering what is the difference between YUV and YUV420? b)I want to use the raw frames from Camera and convert them into YUV420 in real time. What is the fastest way to do this? I used bitmap factory to convert from yuv to jpg and I used onDraw() method to draw the bitmap. However, this takes some time to process. What is the best alternative to do the conversion if I want converting from YUV to YUV420?

推荐答案

我发现了一个很简单的方法来转换NV12到YV12 / YUV 420两行code的做的工作对我来说:

I found a very straight forward way to convert from NV12 to YV12/YUV 420. Two lines of code did the job for me:

公共无效surfaceCreated(SurfaceHolder持有者){

public void surfaceCreated(SurfaceHolder holder) {

        try {
            // set view of surface in cameraview
            Camera.Parameters p = mCamera.getParameters();

            p.setPreviewFormat(ImageFormat.YV12);

            mCamera.setParameters(p);
            mCamera.setPreviewDisplay(holder);
            mCamera.startPreview();
            }

}

这篇关于在preVIEW转换YUV到YUV420的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-21 03:47