JSPM

  • Created
  • Published
  • Downloads 960
  • Score
    100M100P100Q165845F
  • License Apache-2.0

NativeScript MLKit Core

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nativescript/mlkit-core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @nativescript/mlkit-core

    npm install @nativescript/mlkit-core

    Usage

    Core

    Important: Ensure you've included xmlns:ui="@nativescript/mlkit-core" on the Page element

    <ui:MLKitView
      cameraPosition="back"
       detectionType="all" 
       detection="onDetection"
    />

    Angular

    import { MLKitModule } from '@nativescript/mlkit-core/angular';
    
    @NgModule({
        imports: [
        MLKitModule
        ],
        declarations: [
            AppComponent
        ],
        bootstrap: [AppComponent]
    })
    <MLKitView
    cameraPosition="back"
    detectionType="all" 
    (detection)="onDetection($event)"
    ></MLKitView>

    Vue

    import Vue from 'nativescript-vue'
    import MLKit from '@nativescript/mlkit-core/vue'
    
    Vue.use(MLKit)
    <MLKitView
    cameraPosition="back"
    detectionType="all" 
    @detection="onDetection"
    />

    Optional modules

    Important: Detection works only for optional modules installed

    Barcode Scanning

    npm install @nativescript/mlkit-barcode-scanning
    import { DetectionType, DetectionEvent } from '@nativescript/mlkit-core';
    import { BarcodeResult } from '@nativescript/mlkit-barcode-scanning';
    onDetection(event: DetectionEvent){
        if(event.type === DetectionType.Barcode){
            const barcode: BarcodeResult[] = event.data;
        }
    }

    Face Detection

    npm install @nativescript/mlkit-face-detection
    import { DetectionType, DetectionEvent } from '@nativescript/mlkit-core';
    import { FaceResult } from '@nativescript/mlkit-face-detection';
    onDetection(event: DetectionEvent){
        if(event.type === DetectionType.Face){
            const faces: FaceResult[] = event.data;
        }
    }

    Image Labeling

    npm install @nativescript/mlkit-image-labeling
    import { DetectionType, DetectionEvent } from '@nativescript/mlkit-core';
    import { ImageLabelingResult } from '@nativescript/mlkit-image-labeling';
    onDetection(event: DetectionEvent){
        if(event.type === DetectionType.Image){
            const labels: ImageLabelingResult[] = event.data;
        }
    }

    Object Detection

    npm install @nativescript/mlkit-object-detection
    import { DetectionType, DetectionEvent } from '@nativescript/mlkit-core';
    import { ObjectResult } from '@nativescript/mlkit-object-detection'
    onDetection(event: DetectionEvent){
        if(event.type === DetectionType.Object){
            const objects: ObjectResult[] = event.data;
        }
    }

    Pose Detection

    npm install @nativescript/mlkit-pose-detection
    import { DetectionType, DetectionEvent } from '@nativescript/mlkit-core';
    import { PoseResult } from '@nativescript/mlkit-pose-detection';
    onDetection(event: DetectionEvent){
        if(event.type === DetectionType.Pose){
            const poses: PoseResult = event.data;
        }
    }

    Text Recognition

    npm install @nativescript/mlkit-text-recognition
    import { DetectionType, DetectionEvent } from '@nativescript/mlkit-core';
    import { TextResult } from '@nativescript/mlkit-text-recognition';
    onDetection(event: DetectionEvent){
        if(event.type === DetectionType.Text){
            const text: TextResult = event.data;
        }
    }

    License

    Apache License Version 2.0