NativeScript / mlkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting lastVisionImage from the face detection

kriefsacha opened this issue · comments

Hi,

In the previous plugin we could do event.object.lastVisionImage to have the last image of the face detection which is mandatory in my project.

I was doing like:

const source = new ImageSource();

      if (isAndroid) {
        const bmp = event.object.lastVisionImage.getBitmap();
        source.setNativeSource(bmp);
      }
      else source.setNativeSource(event.object.lastVisionImage);

But now it doesn't work.

I tried

event.object.get("lastVisionImage");

but its undefined.

Thank you.

Just two other things:

  • There was also a variable beepOnScan which was very helpful to have but we don't have any beep on scan here

  • I commented #24 because it still doesn't work.

@triniwiz is there any chance you look at this please ? Thats the last thing i need for my project..

Added in f98e08d , you will need to enable it first using retrieveLatestImage = true then grab the imagesource from latestImage

Its not working @triniwiz , i got this error when putting retrieveLatestImage="true" in the MLKitView HTML ( i updated the plugins of course) :

TypeError: Cannot read property 'setRetrieveLatestImage' of undefined
JS: at MLKitView.set retrieveLatestImage [as retrieveLatestImage] (file: node_modules@nativescript\mlkit-core\index.android.js:72:0)
JS: at ViewUtil.setPropertyInternal (file: node_modules@nativescript\angular_ivy_ngcc_\fesm2015\nativescript-angular.js:1515:0)
JS: at ViewUtil.setProperty (file: node_modules@nativescript\angular_ivy_ngcc_\fesm2015\nativescript-angular.js:1467:0)
JS: at EmulatedRenderer.setAttribute (file: node_modules@nativescript\angular_ivy_ngcc_\fesm2015\nativescript-angular.js:2029:0)
JS: at setUpAttributes (file: node_modules@angular\core_ivy_ngcc_\fesm2015\core.js:2842:0)
JS: at Module.ɵɵelementStart (file: node_modules@angular\core_ivy_ngcc_\fesm2015\core.js:14877:0)
JS: at ScanComponent_GridLayout_66_Template (file: src\app\scan\scan.component.ts:174:21)
JS: at executeTemplate (file: node_modules@angular\core_ivy_ngcc_\fesm2015\core.js:9618:0)
JS: at render...

If i do it by the TS i got:

TypeError: classPrivateFieldGet(...).setRetrieveLatestImage is not a function
JS: at MLKitView.set retrieveLatestImage [as retrieveLatestImage] (file: node_modules@nativescript\mlkit-core\index.android.js:72:0)
JS: at file: src\app\scan\scan.component.ts:1409:0
JS: at ZoneDelegate.invoke (file: node_modules\zone.js\fesm2015\zone.js:372:0)
JS: at Object.onInvoke (file: node_modules@angular\core_ivy_ngcc
\fesm2015\core.js:28692:0)
JS: at ZoneDelegate.invoke (file: node_modules\zone.js\fesm2015\zone.js:371:0)
JS: at Zone.run (file: node_modules\zone.js\fesm2015\zone.js:134:0)
JS: at NgZone.run (file: node_modules@angular\core_ivy_ngcc
\fesm2015\core.js:28546:0)
JS: at file: src\app\scan\scan.component.ts:1408:0
JS: at timer (file:///data/data/org.nativescript.VisualyScan/files/...

Please updated to the latest alpha

I'm getting this @triniwiz , alpha7, and puted retrieveLatestImage = true on TS after that the MLKitView is loaded

TypeError: Cannot read property 'android' of undefined
JS: at MLKitView.get latestImage [as latestImage] (file: node_modules@nativescript\mlkit-core\index.android.js:83:0)
JS: at ScanComponent.onFaceDetectionResult (file: src\app\scan\scan.component.ts:1415:0)
JS: at ScanComponent_GridLayout_66_Template_MLKitView_detection_3_listener (file: src\app\scan\scan.component.ts:175:178)
JS: at executeListenerWithErrorHandling (file: node_modules@angular\core_ivy_ngcc_\fesm2015\core.js:15327:0)
JS: at Object.wrapListenerIn_markDirtyAndPreventDefault (file: node_modules@angular\core_ivy_ngcc_\fesm2015\core.js:15365:0)
JS: at ZoneDelegate.invokeTask (file: node_modules\zone.js\fesm2015\zone.js:406:0)
JS: at Object.onInvokeTask (file: node_modules@angular\core_ivy_ngcc_\fesm2015\core.js:28679:0)
JS: at ZoneDelegate.invokeTask (file:...

Thank you for testing, the .8 has the final fix for that

I'll test tomorrow and let you know (it's 1:24 am for me now). Thank you

Seems like working, opened a new ticket in @nativescript/firebase