Converting preview frame to bitmap

后端 未结 5 1724
天涯浪人
天涯浪人 2020-11-29 07:30

I know the subject was on the board many times, but i can not get it work anyhow... I want to save view frames from preview to jpeg files. It looks more or less(code is simp

5条回答
  •  遥遥无期
    2020-11-29 08:22

    as I found out the width and height read from PreviewSize were wrong.... In other words the conversion went wrong because it was based on false values. After use a new way of setting the preview settings(from example deleivered by google) everything works fine.

    EDIT:

    Sorry for the quick answer above and long delay.

    It was while ago and I can not dig the code now, but i think that I used:

    http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getSupportedPreviewSizes()

    and took the first element from the list and set the values with

    http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewSize(int, int)

    i stored the width and height and used it to transform picture.

    It dont know if it was the best solution, but it worked out.

提交回复
热议问题