Code Monkey home page Code Monkey logo

Comments (4)

CainKernel avatar CainKernel commented on July 4, 2024

原始数据在onPreviewFrame回调的数据就是相机原始数据,我这边用的是SurfaceTexture渲染的,美颜后的帧数据,在EglCore的有获取单帧的方法,预览拍照的代码就是这个

from caincamera.

babyofish avatar babyofish commented on July 4, 2024

原始数据在onPreviewFrame回调的数据就是相机原始数据,我这边用的是SurfaceTexture渲染的,美颜后的帧数据,在EglCore的有获取单帧的方法,预览拍照的代码就是这个

直接运行这个代码拍照的图片内容是黑色,华为的Honor V10型号BKL-AL100

from caincamera.

CainKernel avatar CainKernel commented on July 4, 2024

又是华为。。。我手上没有华为相关的设备,无法测试。华为的ROM自身存在不少的问题,前面有不少issue有提到过这个了。你可以先试试shareContext的方式截帧,利用ImageReader的Surface创建一个WindowSurface,makecurrent再做渲染,然后ImageReader填充完成再取出数据。目前除了glReadPixels方法外,没太好的办法。而且ImageReader存在尺寸限制。这个问题要想彻底解决,只能找华为的工程师找通用的解决方案。

from caincamera.

wanliang527 avatar wanliang527 commented on July 4, 2024

onPreviewFrame回调的相机原始数据好像跟渲染后的单帧数据不同步?我尝试改造了RenderThread.drawFrame方法,如下:
// 执行拍照
if (mCameraParam.isTakePicture) {
synchronized (mSyncFence) {
ByteBuffer buffer = mDisplaySurface.getCurrentFrame();
mCameraParam.captureCallback.onCapture(buffer,
mDisplaySurface.getWidth(), mDisplaySurface.getHeight());
mCameraParam.isTakePicture = false;
long start = System.currentTimeMillis();
Bitmap bitmap = new NV21ToBitmap(mContext).nv21ToBitmap(data, mCameraParam.previewWidth, mCameraParam.previewHeight);
BitmapUtils.bitmapToFile(bitmap, Bitmap.CompressFormat.JPEG, "mnt/sdcard/face_temp.jpg");
}
}
然而最终的结果是原始图片文件跟拍照后屏幕显示的图片是不一致的。

想请教一下,如何保证帧数据的同步?我需要同时取到原始相机数据和美颜渲染后的数据

from caincamera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.