【问题标题】:how to left and right reverse camera preview on android?如何在android上左右倒车预览?
【发布时间】:2016-12-13 07:09:02
【问题描述】:

我要在原点相机预览画面,左右倒车预览。

我想用Matrix

首先,显示相机预览部分。 GLFragment.class

private GLStreamView streamView = null;

@Override
public View onCreateView(LayoutInflater inflater,
                         ViewGroup container, Bundle savedInstanceState) {
    final View fragment =inflater.inflate(R.layout.gl_view, container, false);

    stream = (GLStreamView) fragment.findViewById(R.id.gl_stream);
    ...

    return fragment;
}

Stream 是相机预览屏幕。

和 gl_view.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:padding="0dp"
             tools:context="kr.co.test.video.GLFragment">
        <kr.co.test.video.GLStreamView
            android:id="@+id/gl_stream"
            android:layout_width="480dp"
            android:layout_height="480dp"
            android:layout_gravity="center"/>
    <FrameLayout>

我想说的是左右倒车预览。

所以,我尝试使用Matrix

但我不知道如何使用矩阵。

使用矩阵对吗?

请问如何使用左右倒车预览画面。

谢谢。

【问题讨论】:

    标签: android matrix camera


    【解决方案1】:

    通过onPreviewFrame 可以得到yuv 帧,也许你可以把yuv 转成matrix,然后把matrix 倒过来,我不确定。但你可以使用 OpenGL ES 绘制纹理,并通过 shader

    反转它

    【讨论】:

    猜你喜欢
    • 2012-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多