패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.0.8

google_ml_vision

Google ML Kit의 디바이스 내 비전 API용 플러터 플러그인입니다. 바코드 스캔, 이미지 레이블링, 텍스트 인식 및 얼굴 감지가 포함되어 있습니다.

AndroidiOS
30일 다운로드
88
좋아요
135
Pub 점수
140

패키지 설치

flutter pub add google_ml_vision

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Google ML Kit의 디바이스 기반 비전 API를 통합한 플러터 플러그인으로, 바코드 스캔, 이미지 라벨링, 텍스트 인식(OCR), 얼굴 감지 기능을 플러터 앱 내에서 직접 사용할 수 있습니다. 낮은 지연 시간으로 실시간 처리를 지원하며, 안드로이드 및 iOS 기기에서 로컬로 실행되어 프라이버시와 성능을 보장합니다. 이 플러그인은 일반적인 컴퓨터 비전 작업을 간단한 메서드로 구현할 수 있도록 도와주며, 클라우드 서비스에 의존하지 않고 스마트한 이미지 분석이 필요한 모바일 애플리케이션에 적합합니다.

사용 사례

  • 소매 앱에서의 바코드 스캔
  • 이미지에서 텍스트 추출
  • 사진 앱에서의 이미지 분류
  • 증강 현실을 위한 얼굴 감지
  • 문서 스캔 및 OCR

주요 기능

  • 기기 내 처리
  • 다중 비전 작업 지원
  • 저지연 성능
  • Privacy-preserving
  • 간단한 API 통합

적합한 대상

  • 실시간 비전 기능이 필요한 모바일 앱
  • 사용자 프라이버시를 우선시하는 개발자
  • 오프라인 기능이 필요한 앱
  • 문서 또는 AR 도구를 구축하는 스타트업
  • 네이티브 ML 기능을 사용하는 플러터 개발자

고려 사항

  • Android 5.0+ 또는 iOS 10.0+ 필요
  • 지원되는 비전 모델에 제한됨
  • 클라우드 기반 향상 기능 없음
  • 성능은 기기마다 다릅니다
  • iOS에 대해 수동 구성이 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Google ML Kit Vision Plugin

(https://pub.dev/packages/google_ml_vision)

A Flutter plugin to use the capabilities of on-device Google ML Kit Vision APIs

Usage

To use this plugin, add google_ml_vision as a dependency in your pubspec.yaml file.

Using an ML Vision Detector

1. Create a GoogleVisionImage.

Create a GoogleVisionImage object from your image. To create a GoogleVisionImage from an image File object:

final File imageFile = getImageFile();
final GoogleVisionImage visionImage = GoogleVisionImage.fromFile(imageFile);
2. Create an instance of a detector.
final BarcodeDetector barcodeDetector = GoogleVision.instance.barcodeDetector();
final FaceDetector faceDetector = GoogleVision.instance.faceDetector();
final ImageLabeler labeler = GoogleVision.instance.imageLabeler();
final TextRecognizer textRecognizer = GoogleVision.instance.textRecognizer();

You can also configure all detectors, except TextRecognizer, with desired options.

final ImageLabeler labeler = GoogleVision.instance.imageLabeler(
  ImageLabelerOptions(confidenceThreshold: 0.75),
);
3. Call detectInImage() or processImage() with visionImage.
final List<Barcode> barcodes = await barcodeDetector.detectInImage(visionImage);
final List<Face> faces = await faceDetector.processImage(visionImage);
final List<ImageLabel> labels = await labeler.processImage(visionImage);
final VisionText visionText = await textRecognizer.processImage(visionImage);
4. Extract data.

a. Extract barcodes.

for (Barcode barcode in barcodes) {
  final Rectangle<int> boundingBox = barcode.boundingBox;
  final List<Point<int>> cornerPoints = barcode.cornerPoints;

  final String rawValue = barcode.rawValue;

  final BarcodeValueType valueType = barcode.valueType;

  // See API reference for complete list of supported types
  switch (valueType) {
    case BarcodeValueType.wifi:
      final String ssid = barcode.wifi.ssid;
      final String password = barcode.wifi.password;
      final BarcodeWiFiEncryptionType type = barcode.wifi.encryptionType;
      break;
    case BarcodeValueType.url:
      final String title = barcode.url.title;
      final String url = barcode.url.url;
      break;
  }
}

b. Extract faces.

for (Face face in faces) {
  final Rectangle<int> boundingBox = face.boundingBox;

  final double rotY = face.headEulerAngleY; // Head is rotated to the right rotY degrees
  final double rotZ = face.headEulerAngleZ; // Head is tilted sideways rotZ degrees

  // If landmark detection was enabled with FaceDetectorOptions (mouth, ears,
  // eyes, cheeks, and nose available):
  final FaceLandmark leftEar = face.getLandmark(FaceLandmarkType.leftEar);
  if (leftEar != null) {
    final Point<double> leftEarPos = leftEar.position;
  }

  // If classification was enabled with FaceDetectorOptions:
  if (face.smilingProbability != null) {
    final double smileProb = face.smilingProbability;
  }

  // If face tracking was enabled with FaceDetectorOptions:
  if (face.trackingId != null) {
    final int id = face.trackingId;
  }
}

c. Extract labels.

for (ImageLabel label in labels) {
  final String text = label.text;
  final String entityId = label.entityId;
  final double confidence = label.confidence;
}

d. Extract text.

String text = visionText.text;
for (TextBlock block in visionText.blocks) {
  final Rect boundingBox = block.boundingBox;
  final List<Offset> cornerPoints = block.cornerPoints;
  final String text = block.text;
  final List<RecognizedLanguage> languages = block.recognizedLanguages;

  for (TextLine line in block.lines) {
    // Same getters as TextBlock
    for (TextElement element in line.elements) {
      // Same getters as TextBlock
    }
  }
}
5. Release resources with close().
barcodeDetector.close();
faceDetector.close();
labeler.close();
textRecognizer.close();

Getting Started

See the example directory for a complete sample app using Google Machine Learning.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.