代码之家  ›  专栏  ›  技术社区  ›  guness Manas

android在哪里。硬件camera2.full来自?

  •  12
  • guness Manas  · 技术社区  · 7 年前

    我正在尝试实现一个摄像头应用程序。并检查示例。一些示例包含以下清单功能: uses-feature android:name="android.hardware.camera2.full . 我查看了官方文件和谷歌示例,没有一个提到现有的这个功能。(或者我错过了一些)。

    此功能的来源是什么?两者之间的区别是什么 android.hardware.camera ?


    编辑: 让我困惑的是 googlesamples :

    https://github.com/googlesamples/android-Camera2Basic/blob/master/kotlinApp/Application/src/main/AndroidManifest.xml

    还有这个

    https://github.com/googlesamples/android-Camera2Basic/blob/master/Application/src/main/AndroidManifest.xml

    还有这个

    https://github.com/googlesamples/android-Camera2Raw/blob/master/Application/src/main/AndroidManifest.xml

    他们正在使用新的 Camera2 API和旧清单 features . 我不知道两者是如何结合在一起的。

    4 回复  |  直到 7 年前
        1
  •  12
  •   Eddy Talvala    7 年前

    特性标志和摄像头API的名称实际上并不相关,即使它们看起来相同。

    功能 "android.hardware.camera" (PackageManager.FEATURE_CAMERA) 表示该设备具有背面摄像头。这就是全部;任何想要避免安装在没有背面摄像头的设备上的应用程序都需要列出该应用程序。

    它与Java无关 android.hardware.Camera

    功能 "android.hardware.camera.level.full" (PackageManager.FEATURE_CAMERA_LEVEL_FULL) 表示设备上至少有一个摄像头支持 FULL hardware level 通过使用时 android.hardware.camera2 API包。

    因此,一个带有背面摄像头的设备总是会列出“android.hardware.camera”。如果它有一个好相机,它会 而且 列出“android.hardware.camera.level.full”。

    由于camera2的示例应用程序旨在在任何质量的相机上运行,因此它们只需要有一个相机设备,而不需要有任何特定的功能级别。

    我看到一些开发人员试图要求一个像“android.hardware.camera2”这样的功能;Android SDK中没有定义此类功能,因此尝试要求它意味着你的应用程序无法安装在任何设备上。从Android 5.0(棒棒糖)开始,camera2 API始终可用;这只是每个摄像头设备支持的硬件级别的问题(传统、有限、完整或level\U 3)。

        2
  •  9
  •   aga    5 年前

    一如既往,最好使用Android source code 自身:

    * A given camera device may provide support at one of two levels: limited or * full. If a device only supports the limited level, then Camera2 exposes a * feature set that is roughly equivalent to the older * {@link android.hardware.Camera Camera} API, although with a cleaner and more * efficient interface. Devices that implement the full level of support * provide substantially improved capabilities over the older camera * API. Applications that target the limited level devices will run unchanged on * the full-level devices; if your application requires a full-level device for * proper operation, declare the "android.hardware.camera2.full" feature in your * manifest.</p>

    我希望这能澄清你提到的功能的性质。

    至于 camera2 API-这些是 introduced 在Android 5(api级别21)中,试图创建更干净的api,以便与旧的摄像头进行交互 camera 应用程序编程接口。

        3
  •  3
  •   Ivan    7 年前

    Android从Android api 21开始引入了Camera2 api,这种新的摄像头api使其更易使用和更改参数。前一个版本的功能更加有限。

    Android Camera2有4个级别的实现,具体取决于制造商:

    1. 传统:它只是Camera2和Camera之间的转换。只是为了兼容性。只是Camera2的一些东西工作正常。
    2. 有限:有Camera2实现,但不是所有可用的方法。(并非所有制造商都采用相同的方法,因此并非所有设备都能正常工作)
    3. 完整:已实现Camera2的所有方法。通常制造商会在其旗舰设备上实现这一点。
    4. 级别3:额外支持YUV再处理和原始图像捕获。(最佳案例)

    source here 和个人经历。

        4
  •  1
  •   Manoj Mohanty    5 年前

    如果我们在Android studio中导航到抽象类,我们会更加清楚,它提供了以下信息

    /** *

    CameraDevice类表示连接到 *Android设备,允许对图像捕获和 *高帧速率下的后处理。

    * *

    您的应用程序必须声明 *{@link android.Manifest.permission#CAMERA-CAMERA}其清单中的权限 *以访问摄像头设备。

    * *

    给定的相机设备可以在两个级别之一提供支持:有限或 *已满。如果设备仅支持有限级别,则Camera2会显示 *大致相当于旧功能集的功能集 *{@link android.hardware.Camera-Camera}API,尽管有更干净的 *高效的接口。实现全面支持的设备 *与旧款摄像头相比,提供了显著改进的功能 *API。以有限级别设备为目标的应用程序将在 *全液位装置; 如果您的应用程序需要完整级别的设备 *正确操作,在您的 *清单。

    * *@请参阅CameraManager#openCamera *@请参阅android。显示权限#摄像头 */ 公共抽象类CameraDevice实现自动关闭{

    因此,没有必要或我不相信camera2所说的话,也不相信其他人所指出的话。