Skip to content

mat show in statefullwidget #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
asanghehe opened this issue Mar 19, 2024 · 3 comments
Closed

mat show in statefullwidget #7

asanghehe opened this issue Mar 19, 2024 · 3 comments

Comments

@asanghehe
Copy link

please explain how to show Mat image in flutter widget Pages

@rainyl
Copy link
Owner

rainyl commented Mar 19, 2024

TL;DR, use cv.imencode() to get a encoded Uint8List and then use Image.memory()

Take a look at example

BTW, if you still use dart image library, you probably can also try to get Mat.data and construct a img.Image, note that Mat.data contains pixel values and have no headers for an image, so DO NOT pass Mat.data to Image.memory() directly!

@asanghehe
Copy link
Author

Thank you. I have checked the method and it shows that I have successfully displayed it, but I can only use the thread (flutter compute() method) to use opencv_dart, otherwise it will get stuck. Anyway, I can use it

@rainyl
Copy link
Owner

rainyl commented Mar 20, 2024

Asynchronous calls are not supported yet, so heavy computations should not be done in the main thread, you may need to use isolate, compute() also spawns a new thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants