Code Monkey home page Code Monkey logo

Comments (6)

tnup avatar tnup commented on July 20, 2024

import 'package:flutter/painting.dart';

And then change the 'new fileimage'function to

new FileImage(image)
    .resolve(new ImageConfiguration())
    .addListener( ((ImageInfo info, bool synchronousCall) {
          setState(() {
            _imageHeight = info.image.height.toDouble();
            _imageWidth = info.image.width.toDouble();
          });
        }) as ImageStreamListener);


seems to solve this one.

from flutter_tflite.

shaqian avatar shaqian commented on July 20, 2024

Yes. Looks like they changed addListener interface in painting library.
flutter/flutter@592f81e#diff-c40603317cbbb567a0ac6c32803d6788R292

Casting the type to ImageStreamListener as @tnup suggested should be the solution.

Thanks,
Qian

from flutter_tflite.

PrinceP avatar PrinceP commented on July 20, 2024

I am receiving the following error.
Exception has occurred.
_CastError (type '(ImageInfo, bool) => Null' is not a subtype of type 'ImageStreamListener' in type cast)

Launching lib/main.dart on Pixel 2 XL in debug mode...
Built build/app/outputs/apk/debug/app-debug.apk.
I/tflite ( 7567): Initialized TensorFlow Lite runtime.
I/flutter ( 7567): success
W/System ( 7567): A resource failed to call close.
V/time ( 7567): Inference took 233
I/flutter ( 7567): [{score: 0.9141436219215393, keypoints: {0: {score: 0.9366106390953064, part: nose, x: 0.9072170257568359, y: 0.7681019902229309}, 1: {score: 0.8853325247764587, part: leftEye, x: 0.9083921909332275, y: 0.7660269737243652}, 2: {score: 0.895061194896698, part: rightEye, x: 0.9051240086555481, y: 0.7632570266723633}, 3: {score: 0.6452447772026062, part: leftEar, x: 0.9123005270957947, y: 0.7663577198982239}, 4: {score: 0.5991162061691284, part: rightEar, x: 0.9066846966743469, y: 0.7621657252311707}, 5: {score: 0.9771823287010193, part: leftShoulder, x: 0.905788004398346, y: 0.7937831878662109}, 6: {score: 0.9885516166687012, part: rightShoulder, x: 0.901046633720398, y: 0.7925692796707153}, 7: {score: 0.9520376920700073, part: leftElbow, x: 0.9105158448219299, y: 0.8237140774726868}, 8: {score: 0.9721059203147888, part: rightElbow, x: 0.904983639717102, y: 0.8216578364372253}, 9: {score: 0.9290830492973328, part: leftWrist, x: 0.9192070960998535, y: 0.8451672196388245}, 10: {score: 0.9260290265083313, part: r

from flutter_tflite.

tnup avatar tnup commented on July 20, 2024

try this @PrinceP

new FileImage(image)
    .resolve(new ImageConfiguration())
    .addListener( new ImageStreamListener((ImageInfo info, bool synchronousCall) {
          setState(() {
            _imageHeight = info.image.height.toDouble();
            _imageWidth = info.image.width.toDouble();
          });
        }) as ImageStreamListener);

    setState(() {
      _image = image;
      _busy = false;
    });
  }

double cast, but works.

from flutter_tflite.

PrinceP avatar PrinceP commented on July 20, 2024

@tnup Couldn't understand but this works. Thanks

from flutter_tflite.

shaqian avatar shaqian commented on July 20, 2024

I'm archiving this thread. Feel free to reopen if you have further questions.

Thanks,
Qian

from flutter_tflite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.