1

我有一段代码,无法得到这个,但只了解图像选择器的一部分。任何人解释我,什么是卷FirebaseVisionImage。顺便说一句,我正在使用firebase_ml_vision

Future pickImage() async {
    var awaitImage = await ImagePicker.pickImage(source: ImageSource.gallery);

    setState(() {
      pickedImage = awaitImage;
      imageLoaded = true;
    });

    FirebaseVisionImage visionImage = FirebaseVisionImage.fromFile(pickedImage);

    final ImageLabeler cloudLabeler = FirebaseVision.instance.cloudImageLabeler();

    final List<ImageLabel> cloudLabels =
        await cloudLabeler.processImage(visionImage);

    for (ImageLabel label in cloudLabels) {
      final double confidence = label.confidence;
      setState(() {

        text = "$text $label.text   $confidence.toStringAsFixed(2) \n";

        print(text);
      });
    }

    cloudLabeler.close();
  }
4

0 回答 0