What format is for Android camera with raw pictureCallback?

后端 未结 3 2181
自闭症患者
自闭症患者 2021-01-04 12:36

I am trying to use data from Android picture. I do not like JPEG format, since eventually I will use gray scale data. YUV format is fine with me, since the first half part i

3条回答
  •  梦谈多话
    2021-01-04 12:52

    The biggest problem with using the raw callback is that many developers have trouble with getting anything returned on many phones.

    If you are satisfied with just the YUV array, your camera preview SurfaceView can implement PreviewCallback and you can add the onPreviewFrame method to your class. This function will allow you direct access to the YUV array for every frame. You can fetch it when you choose.

    EDIT: I should specify that I was assuming you were building a custom camera application in which you extended SurfaceView for a custom camera preview surface. In order to follow my advice you will need to build a custom camera. If you are trying to do things quickly though I suggest building a new bitmap out of the JPEG data where you implement the greyscale yourself.

提交回复
热议问题