Get an Image from CameraPreview

痴心易碎 提交于 2021-01-29 15:04:27

问题


Is there a way I can get an image from a camera preview? The purpose of this would be to overlay an emoji over the face of the camera preview, and I can't overlay the emoji images without first having a Bitmap image as follows:

private void processAndSetImage()
{
    mResultsBitmap = OverlayEmoji.detectFacesandOverlayEmoji(this, mResultsBitmap);

    mImageView.setImageBitmap(mResultsBitmap);
}

Is there a way that mImageView could have the value of a camera preview? Any links to other SO posts, or articles (in java) would be greatly appreciated!


回答1:


Is there a way I can get an image from a camera preview?

No.

First, there are thousands of Android device models. These devices will have dozens, if not hundreds, of "android native camera" apps, as many device manufacturers frequently ship a customized camera app.

Second, there is no requirement that all camera apps have an identical user interface. The size and position of the camera preview can vary. Not only will they vary between apps, but even the same app might vary the size and position of the camera preview between versions of that app, as apps can and do get updated.

Third , you have no good way of determining when any of these camera apps happens to be in the foreground.



来源:https://stackoverflow.com/questions/56334054/get-an-image-from-camerapreview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!