小编VSK*_*VSK的帖子

如何在Camera2 API Android中捕获覆盖层内的图像?

叠加层内的图像

我只需要捕获如图所示的覆盖框内的图像。我不需要TextureView 中的整个图像。我是 Android 新手,我无法找出一些提到的仅捕获矩形区域内图像的解决方案。覆盖层必须位于中心。我尝试过,但没能实现。

我遵循了这段代码 - Google Sample-Camera2Basic


为了添加覆盖,我使用了以下代码:

activity_camera2_basic_fragment.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.example.googlecamera2.AutoFitTextureView
        android:id="@+id/texture"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true" />

    <LinearLayout
        android:id="@+id/surface"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_centerInParent="true"/>

    <FrameLayout
        android:id="@+id/control"
        android:layout_width="match_parent"
        android:layout_height="112dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        android:background="@color/control_background">

        <Button
            android:id="@+id/picture"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="@string/picture" />

        <ImageButton
            android:id="@+id/info"
            android:contentDescription="@string/description_info"
            style="@android:style/Widget.Material.Light.Button.Borderless"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|right"
            android:padding="20dp"
            android:src="@drawable/ic_action_info" />

    </FrameLayout>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我是onCreateView这样实现的:

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

        linearLayout = view.findViewById(R.id.surface);
        linearLayout.addView(new Rectangle(getActivity())); …
Run Code Online (Sandbox Code Playgroud)

android overlay crop android-camera2

7
推荐指数
1
解决办法
6986
查看次数

哪个版本的Miniconda具有适用于Windows 64位的Python 3.6?

我正在一个需要这些深度学习库的项目-keras和tensorflow。不幸的是,这些不适用于Python 3.7。有人可以告诉我一个具有Python 3.6的Miniconda版本(适用于Windows 64位)吗?我尝试使用Python 3.6创建虚拟环境,但是这些库无法正确安装。任何帮助将不胜感激!谢谢!

windows python-3.x miniconda

4
推荐指数
2
解决办法
3907
查看次数

如何在 Google Cloud SQL PostgreSQL 11 实例上记录 SQL 查询?

我必须记录在 Google Cloud SQL PostgreSQL 实例上执行的所有 DDL 和 DML 查询。

我查了很多网站,但没有明确的信息可用。我尝试使用该pgAudit扩展程序,但 Cloud SQL 不支持该扩展程序。

有人可以建议要使用的扩展名或任何其他记录 SQL 查询的方式吗?此外,如果用户登录可以被记录,那么这也会有帮助。

postgresql google-cloud-sql google-cloud-platform

1
推荐指数
1
解决办法
1082
查看次数