在Android Things上使用rpi3 camera v2的相机未初始化问题

时间:2017-06-09 22:43:37

标签: raspberry-pi3 android-camera2 android-things

我正在尝试运行一个简单的Android Thing项目,该项目只是捕获并在显示中呈现捕获的图像。我从(https://github.com/googlecodelabs/androidthings-imageclassifier/tree/master/imageclassifier-add-camera)获取了示例代码而没有图像识别部分。但我收到以下错误 -

    spinnerpagilauk1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent,
                                   View view,
                                   int i,
                                   long l) {
            // On selecting a spinner item
            String label = parent.getItemAtPosition(position).toString();
            etpagilauk1kcal.setText(db.getKalonFromNamamakanan(label));
        }
        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });

    spinnerpagilauk2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent,
                                   View view,
                                   int i,
                                   long l) {
            // On selecting a spinner item
            String label = parent.getItemAtPosition(position).toString();
            etpagilauk1kca2.setText(db.getKalonFromNamamakanan(label));
        }
        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });

因此它似乎检测到相机但无法从相机捕捉图像。任何人在AndroidThings平台上遇到类似的问题? 下面提供的主要相机处理程序代码 -

I/InstantRun: starting instant run server: is main process
I/CameraManagerGlobal: Connecting to camera service
D/CameraHandler: Using camera id 0
W/CameraHandler: Cannot capture image. Camera not initialized.
D/CameraHandler: Opened camera.

1 个答案:

答案 0 :(得分:1)

相机陷阱: 检查Manifest文件中的权限,然后重新启动设备。 安装应用程序后不会授予摄像机权限,而是在安装和RESTART设备之后。 见https://developer.android.com/things/sdk/index.html