Android Google Lens in Camera

google lens in camera 原文以及翻译:
Google Lens in Camera runs within the Android Google Search App (AGSA), which is Google’s main app on Android. Lens SDK is available for download on the Google Lens page. Lens SDK and logo are available for download at Google Lens SDK
(https://drive.google.com/a/google.com/uc?export=download&id=1Zc2cxA8QX7de8QJSC_6YOFGFfqWXbSM5) and Google Lens Branding (https://drive.google.com/a/google.com/uc?export=download&id=1TnRv7poRfwbQvWAA8M8n0gqplG–1dsL), respectively . The Lens SDK needs to be integrated following the Google Lens integration guidelines (/gms/building/apps/lens#integration-steps) .
The Lens libraries that provide extended functionality to the Android Open Source Project (AOSP) assume an Android-compatible device, which allows maximum compatibility with the Android app development ecosystem and distribution systems. DEVICEs MAY optionally integrate the Google Lens feature in their app. However, DEVICEs integrating the Google Lens feature MUST meet the requirements below.

译文:Camera中的Google Lens可以在Android Google搜索应用(AGSA)中运行,这是Google在Android上的主要应用。 Lens SDK可在Google Lens页面上下载。 Lens SDK和徽标可从Google Lens SDK下载
(https://drive.google.com/a/google.com/uc?export=download&id=1Zc2cxA8QX7de8QJSC_6YOFGFfqWXbSM5)和Google Lens品牌(https://drive.google.com/a/google.com/uc?export= download&id = 1TnRv7poRfwbQvWAA8M8n0gqplG–1dsL)。 必须遵循Google Lens集成准则(/ gms / building / apps / lens#integration-steps)集成Lens SDK。
为Android开源项目(AOSP)提供扩展功能的Lens库采用的是Android兼容设备,从而最大程度地与Android应用程序开发生态系统和发行系统兼容。 设备可以选择将Google Lens功能集成到他们的应用中。 但是,集成了Google镜头功能的设备必须满足以下要求。

[GMS-7.14-001] An Androidd device with the following hardware features is REQUIRED:

A rear-facing camera (as described in CDD section 7.5.1)
The DEVICE MUST make this feature available to third-party apps.

译文:将Google Lens功能集成到他们的应用中。但是,DEVICE集成了Google摄像头功能必须满足以下要求。
Android设备需要具有后置摄像头硬件功能的,
并且三方应用能够使用该功能

[GMS-7.14-002] At least one rear-facing color camera on the device MUST support CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED or higher.

译文:将Google Lens功能集成到他们的应用中。但是,DEVICE集成了Google摄像头功能必须满足以下要求。
设备上至少有一个后置彩色摄像头功能等级为
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED或者更高等级。

[GMS-7.14-003] At least one rear-facing color camera on the device MUST be configurable with standard Camera2 APIs, or MUST have default values that support acceptable Lens performance on the device:

CaptureRequest.CONTROL_AF_MODE
CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE
CaptureRequest.EDGE_MODE
CaptureRequest.FLASH_MODE
CaptureRequest.LENS_OPTICAL_STABILIZATION_MODE
CaptureRequest.NOISE_REDUCTION_MODE

译文:设备上至少有一个后置彩色摄像头必须使用标准Camera2 API进行配置,
或者必须具有支持设备上可接受镜头性能的默认值:
CaptureRequest.CONTROL_AF_MODE
CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE
CaptureRequest.EDGE_MODE
CaptureRequest.FLASH_MODE
CaptureRequest.LENS_OPTICAL_STABILIZATION_MODE
CaptureRequest.NOISE_REDUCTION_MODE

[GMS-7.14-004] At least one rear-facing color camera on the device SHOULD conform to the following specification:

Simultaneously supports at least one 1920x1080 SurfaceTexture stream and one 640x480 stream

译文:设备上至少有一个后置彩色摄像头应符合以下规范:
同时支持至少一个1920x1080 SurfaceTexture 流 和一个 640x480 流

[GMS-7.14-005] At least one rear-facing color camera on the device SHOULD support the following features:

Zoom
Flash

译文:设备上至少有一个后置彩色摄像头应支持以下功能:
缩放
闪光灯

[GMS-7.14-006] At a minimum, the device main processor is STRONGLY RECOMMENDED meet either of the following requirements:

A main processor with at least eight (A53 class) cores of at least 1.4 GHz that allow simultaneous execution of prioritized processing threads
A main processor with at least two (A57 class) cores of at least 1.9 GHz, and two (A53 class) cores of at least 1.6 GHz

译文:强烈建议设备主处理器至少满足以下任一要求:
一种主处理器,至少有8个(A53类)核,至少1.4GHz,允许同时执行优先处理线程
一种主处理器,至少有两个(A57类)核和两个(A53类)核(至少1.6GHz)

[GMS-7.14-007] At a minimum, the device memory MUST meet the following requirement:

More than 2 GB of RAM

译文:设备存储器至少必须满足以下要求:
超过2GB的RAM

[GMS-7.14-008] At a minimum, the device screen MUST meet the following requirement:

720 px screen width

译文:设备屏幕至少必须满足以下要求:
720像素屏幕宽度

[GMS-7.14-009]
The app that the Google Lens in Camera SDK is integrated into MUST be the system’s
default camera app.
The package name of the app that the Google Lens in Camera SDK is integrated into
MUST be identi?ed in the ro.com.google.lens.oem_camera_package system property.

译文:Camera SDK中的 Google Lens 集成到的应用程序必须是系统的默认Camera应用程序。
Camera SDK中 Google Lens 集成到的应用程序的包名必须在ro.com.google.lens.oem_camera_package系统属性中标识。

[GMS-7.14-010] It’s STRONGLY RECOMMENDED to adhere to the placement requirements of Google Lens icon as described in the Google Lens branding guidelines.

译文:强烈建议遵守Google Lens品牌指南中描述的Google Lens图标的位置要求。

[GMS-7.14-011] After opening the native camera app on a device with Google Lens SDK
integrated, Google Lens should be featured as prominently as the video mode to the end
user in terms of form, ?t, and function.

译文:在集成了Google Lens SDK的设备上,打开原生camera app后,Google Lens应在形式、契合度、功能等方面与视频模式一样突出于终端用户。

[GMS-7.14-012] Lens in Camera doesn’t support large screen (tablet) devices. Lens in
Camera MUST NOT be integrated on devices where Configuration.smallestScreenWidthDp
is greater than or equal to 600 dp.

译文:相机镜头不支持大屏幕(平板)设备。
相机中的镜头不得集成在配置smallestScreenWidthDp大于或等于600 dp。

[GMS-7.14-013] Google Lens in Camera requires the support of AGSA version 11.33 or
higher.
译文:谷歌镜头在相机需要支持AGSA版本11.33或更高。

[GMS-7.14-014] The com.google.lens.feature.CAMERA_INTEGRATION feature ?ag MUST be
declared as described in the Google Lens integration guidelines(/gms/building/apps/lens#integration-steps) .

译文:com.google.lens.feature.CAMERA_INTEGRATION特性标志必须按照Google Lens集成指南中的说明声明。

通过上面14点要求就是在集成Google lens 时需要设备具有的,必须遵行。

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要使用Camera2 API在Android Studio中,你需要依赖以下库: ```gradle implementation 'androidx.camera:camera-camera2:1.0.0-beta01' ``` 您还需要具备相应的权限,例如`CAMERA`和`WRITE_EXTERNAL_STORAGE`。 使用Camera2 API需要遵循以下步骤: Step 1:检查设备是否支持相机功能 您可以使用CameraManager API进行检查。例如: ```java CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE); try { String[] cameraIdList = manager.getCameraIdList(); for (String cameraId : cameraIdList) { CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId); int facing = characteristics.get(CameraCharacteristics.LENS_FACING); if (facing == CameraCharacteristics.LENS_FACING_FRONT) { // 前置摄像头可用 } else if (facing == CameraCharacteristics.LENS_FACING_BACK) { // 后置摄像头可用 } } } catch (Exception e) { e.printStackTrace(); } ``` Step 2:打开相机设备 您可以使用`openCamera`方法打开相机设备。例如: ```java manager.openCamera(cameraId, new CameraDevice.StateCallback() { @Override public void onOpened(CameraDevice camera) { mCameraDevice = camera; } @Override public void onDisconnected(CameraDevice camera) { mCameraDevice.close(); mCameraDevice = null; } @Override public void onError(CameraDevice camera, int error) { mCameraDevice.close(); mCameraDevice = null; } }, null); ``` 请注意,您需要处理相机设备的连接,断开连接和错误事件。 Step 3:创建相机会话 您需要使用`createCaptureSession`方法创建相机会话。例如: ```java List<Surface> surfaces = new ArrayList<>(); surfaces.add(mPreviewSurface); surfaces.add(mImageReader.getSurface()); mCameraDevice.createCaptureSession(surfaces, new CameraCaptureSession.StateCallback() { @Override public void onConfigured(CameraCaptureSession session) { mCameraCaptureSession = session; try { CaptureRequest.Builder builder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); builder.addTarget(mPreviewSurface); CaptureRequest request = builder.build(); mCameraCaptureSession.setRepeatingRequest(request, null, mBackgroundHandler); } catch (Exception e) { e.printStackTrace(); } } @Override public void onConfigureFailed(CameraCaptureSession session) { mCameraCaptureSession = null; } }, null); ``` 在相机会话创建后,您需要构建一个捕获请求并通过相机会话发送它。在这个例子中,您使用Preview目标并在后台线程上重复请求。 Step 4:拍照并保存照片 要进行拍照,您需要使用CaptureRequest.Builder并指定target为ImageReader的Surface。当图片可用时,您需要将其保存到文件中。例如: ```java CaptureRequest.Builder builder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE); builder.addTarget(mImageReader.getSurface()); int rotation = getWindowManager().getDefaultDisplay().getRotation(); builder.set(CaptureRequest.JPEG_ORIENTATION, getRotation(rotation)); CameraCaptureSession.CaptureCallback captureCallback = new CameraCaptureSession.CaptureCallback() { @Override public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) { super.onCaptureCompleted(session, request, result); File file = new File(getExternalFilesDir(null), "photo.jpg"); Image image = mImageReader.acquireLatestImage(); ByteBuffer buffer = image.getPlanes()[0].getBuffer(); try { FileOutputStream outputStream = new FileOutputStream(file); byte[] bytes = new byte[buffer.remaining()]; buffer.get(bytes); outputStream.write(bytes); outputStream.close(); } catch (Exception e) { e.printStackTrace(); } finally { image.close(); } } }; mCameraCaptureSession.stopRepeating(); mCameraCaptureSession.abortCaptures(); mCameraCaptureSession.capture(builder.build(), captureCallback, mBackgroundHandler); ``` 在这个例子中,您使用TEMPLATE_STILL_CAPTURE模板创建CaptureRequest.Builder,并将target设置为ImageReader的Surface。然后,您定义一个捕获回调来捕获和保存图像。最后,您停止相机会话的重复请求并使用捕获请求捕获图像。 以上是使用Camera2 API的基本步骤,您可以在此基础上进行自定义和优化。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值