【问题标题】:Problem adding "pro mode" for Huawei Camera Kit为华为相机套件添加“专业模式”时出现问题
【发布时间】:2021-02-13 07:37:57
【问题描述】:

我按照他们开发者页面上的示例代码,在初始化华为相机套件实例后,我不确定如何将专业模式相机功能添加到我的应用程序中。

private CameraKit mCameraKit;
mCameraKit = CameraKit.getInstance(getApplicationContext());
//If the current mobile phone does not support the kit or the SDK version is incompatible, NULL is returned. Compatibility processing is required.
if (mCameraKit == null) {
    return;
}

根据华为开发者指南部分,pro模式应该是支持的相机模式之一,但我在Camera Kit API参考中没有找到pro模式。有谁知道如何开启专业模式?

【问题讨论】:

    标签: camera android-camera huawei-developers huawei-mobile-services


    【解决方案1】:

    Pro 模式没有特定的模式定义。专业模式由打开的键定义。您只需:

    1. 将 mCurrentModeType 设置为 PRO_PHOTO_MODE 或 PRO_VIDEO_MODE。

    2. 使用 mCurrentModeType 创建一个 Mode 对象。

    3. 调用Mode对象的setParameter方法开启相应的能力。

    4. 使用Mode对象的takePicture、startRecording和stopRecording方法进行拍照和录像。参考details

    开启预览功能后,您可以配置专业模式的能力值,如ISO、曝光时间、白平衡等。下面是一些示例代码。

    // Query the functions supported by the mode.
    List<CaptureRequest.Key<?>> parameters = mModeCharacteristics.getSupportedParameters();
    // Query the supported ISO range.
    List<Integer> values = mModeCharacteristics.getParameterRange(RequestKey.HW_PRO_SENSOR_ISO_VALUE);
    // Set the ISO value. The first value is used as an example.
    mMode.setParameter(RequestKey.HW_ PRO_SENSOR_ISO_VALUE, values.get(0));
    

    【讨论】:

      【解决方案2】:
      1. 目前,专业模式仅支持 Kirin 990Kirin 9000 的设备。
      2. 以下代码供您参考如何为您的应用添加模式。目前,只有后置摄像头支持专业模式。
      // Query the camera list of the device.
      String[] cameraLists = mCameraKit.getCameraIdList();
      // Query the modes supported by the current camera.
      int[] modes = mCameraKit.getSupportedModes(cameraLists[0]);
      // Create a mode.
      mCameraKit.createMode(cameraLists[0], mCurrentModeType, mModeStateCallback, mCameraKitHandler);
      

      【讨论】:

        猜你喜欢
        • 2021-12-17
        • 2021-11-25
        • 1970-01-01
        • 1970-01-01
        • 2019-03-17
        • 1970-01-01
        • 1970-01-01
        • 2021-01-03
        • 1970-01-01
        相关资源
        最近更新 更多