Content-Length: 872720 | pFad | https://github.com/NativeScript/mlkit/commit/c7ee498

14 feat: still image detection, pause & torch · NativeScript/mlkit@c7ee498 · GitHub
Skip to content

Commit c7ee498

Browse files
committed
feat: still image detection, pause & torch
1 parent a39ac7e commit c7ee498

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1180
-42
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [@nativescript/mlkit-image-labeling](packages/mlkit-image-labeling/README.md)
66
- [@nativescript/mlkit-object-detection](packages/mlkit-object-detection/README.md)
77
- [@nativescript/mlkit-pose-detection](packages/mlkit-pose-detection/README.md)
8+
- [@nativescript/mlkit-selfie-segmentation](packages/mlkit-selfie-segmentation/README.md)
89
- [@nativescript/mlkit-text-recognition](packages/mlkit-text-recognition/README.md)
910

1011
# How to use?

apps/demo-angular/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"@nativescript/mlkit-image-labeling": "file:../../dist/packages/mlkit-image-labeling",
1010
"@nativescript/mlkit-object-detection": "file:../../dist/packages/mlkit-object-detection",
1111
"@nativescript/mlkit-digital-ink-recognition": "file:../../dist/packages/mlkit-digital-ink-recognition",
12-
"@nativescript/mlkit-pose-detection": "file:../../dist/packages/mlkit-pose-detection"
12+
"@nativescript/mlkit-pose-detection": "file:../../dist/packages/mlkit-pose-detection",
13+
"@nativescript/mlkit-selfie-segmentation": "file:../../dist/packages/mlkit-selfie-segmentation"
1314
},
1415
"devDependencies": {
1516
"@nativescript/android": "~8.1.1",

apps/demo-angular/src/app-routing.module.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const routes: Routes = [
1414
{ path: 'mlkit-image-labeling', loadChildren: () => import('./plugin-demos/mlkit-image-labeling.module').then(m => m.MlkitImageLabelingModule) },
1515
{ path: 'mlkit-object-detection', loadChildren: () => import('./plugin-demos/mlkit-object-detection.module').then(m => m.MlkitObjectDetectionModule) },
1616
{ path: 'mlkit-pose-detection', loadChildren: () => import('./plugin-demos/mlkit-pose-detection.module').then(m => m.MlkitPoseDetectionModule) },
17+
{ path: 'mlkit-selfie-segmentation', loadChildren: () => import('./plugin-demos/mlkit-selfie-segmentation.module').then(m => m.MlkitSelfieSegmentationModule) },
1718
{ path: 'mlkit-text-recognition', loadChildren: () => import('./plugin-demos/mlkit-text-recognition.module').then(m => m.MlkitTextRecognitionModule) }
1819
];
1920

apps/demo-angular/src/home.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export class HomeComponent {
2727
{
2828
name: 'mlkit-pose-detection'
2929
},
30+
{
31+
name: 'mlkit-selfie-segmentation'
32+
},
3033
{
3134
name: 'mlkit-text-recognition'
3235
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ActionBar title="mlkit-selfie-segmentation" class="action-bar"> </ActionBar>
2+
<StackLayout class="p-20">
3+
<ScrollView class="h-full">
4+
<StackLayout>
5+
<Button text="Test mlkit-selfie-segmentation" (tap)="demoShared.testIt()" class="btn btn-primary"></Button>
6+
</StackLayout>
7+
</ScrollView>
8+
</StackLayout>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Component, NgZone } from '@angular/core';
2+
import { DemoSharedMlkitSelfieSegmentation } from '@demo/shared';
3+
import { } from '@nativescript/mlkit-selfie-segmentation';
4+
5+
@Component({
6+
selector: 'demo-mlkit-selfie-segmentation',
7+
templateUrl: 'mlkit-selfie-segmentation.component.html',
8+
})
9+
export class MlkitSelfieSegmentationComponent {
10+
11+
demoShared: DemoSharedMlkitSelfieSegmentation;
12+
13+
constructor(private _ngZone: NgZone) {}
14+
15+
ngOnInit() {
16+
this.demoShared = new DemoSharedMlkitSelfieSegmentation();
17+
}
18+
19+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3+
import { MlkitSelfieSegmentationComponent } from './mlkit-selfie-segmentation.component';
4+
5+
@NgModule({
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitSelfieSegmentationComponent }])],
7+
declarations: [MlkitSelfieSegmentationComponent],
8+
schemas: [ NO_ERRORS_SCHEMA]
9+
})
10+
export class MlkitSelfieSegmentationModule {}

apps/demo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
"@nativescript/mlkit-image-labeling": "file:../../packages/mlkit-image-labeling",
1313
"@nativescript/mlkit-object-detection": "file:../../packages/mlkit-object-detection",
1414
"@nativescript/mlkit-pose-detection": "file:../../packages/mlkit-pose-detection",
15+
"@nativescript/mlkit-selfie-segmentation": "file:../../packages/mlkit-selfie-segmentation",
1516
"@nativescript/mlkit-text-recognition": "file:../../packages/mlkit-text-recognition"
1617
},
1718
"devDependencies": {
18-
"@nativescript/android": "~8.1.1",
19+
"@nativescript/android": "8.1.1",
1920
"@nativescript/ios": "~8.1.0"
2021
}
2122
}

apps/demo/src/main-page.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<Button text="mlkit-object-detection" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1515
<Button text="mlkit-digital-ink-recognition" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1616
<Button text="mlkit-pose-detection" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
17+
<Button text="mlkit-selfie-segmentation" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1718
</StackLayout>
1819
</ScrollView>
1920
</StackLayout>

apps/demo/src/plugin-demos/mlkit-core.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Observable, EventData, Page, Dialogs } from '@nativescript/core';
1+
import { Observable, EventData, Page, Dialogs, ImageSource } from '@nativescript/core';
22
import { DemoSharedMlkitCore } from '@demo/shared';
3-
import { DetectionType, MLKitView, DetectionEvent } from '@nativescript/mlkit-core';
3+
import { DetectionType, MLKitView, DetectionEvent, detectWithStillImage } from '@nativescript/mlkit-core';
44
import { BarcodeResult } from '@nativescript/mlkit-barcode-scanning';
55
import { FaceResult } from '@nativescript/mlkit-face-detection';
66
import { ImageLabelingResult } from '@nativescript/mlkit-image-labeling';
@@ -58,5 +58,19 @@ export class DemoModel extends DemoSharedMlkitCore {
5858
this.camera.pause = !this.camera.pause;
5959
this.set('isPaused', this.camera.pause);
6060
}
61+
62+
async processStill(args) {
63+
try {
64+
const src = await ImageSource.fromUrl('https://www.jqueryscript.net/images/jQuery-Plugin-To-Generate-International-Article-Number-Barcode-EAN13.jpg');
65+
66+
console.log(src.android)
67+
const result = await detectWithStillImage(src, {
68+
detectorType: DetectionType.Barcode
69+
});
70+
console.log('processStill', result.barcode[0]);
71+
} catch (e) {
72+
console.log(e);
73+
}
74+
}
6175
}
6276

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/NativeScript/mlkit/commit/c7ee498

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy