rainyl / opencv_dart

OpenCV bindings for Dart language and Flutter. Support Asynchronous Now!
https://pub.dev/packages/opencv_dart
Apache License 2.0
136 stars 18 forks source link

CV.imread( ) does not get Mat #150

Closed cike111 closed 4 months ago

cike111 commented 4 months ago

How to load an image under the assets path to generate mat ,if using CV.imread("assets/ material_wood.jpg ") does not get the correct Mat

abdelaziz-mahdy commented 4 months ago

I think assets are not easy to handle specially on mobile

I recommend copying the file to tmp dir and use the new path

rainyl commented 4 months ago

I think assets are not easy to handle specially on mobile

I recommend copying the file to tmp dir and use the new path

yes,it works. a more elegant way is reading assets to bytes and use imdecode.

but for APIs without the support of loading from bytes it will be the only solution for now.

abdelaziz-mahdy commented 4 months ago

And I don't think including the asset reader will work with native assets since the asset reader is from flutter

So people should manage that in their own app, maybe we can add an example?

rainyl commented 4 months ago

And I don't think including the asset reader will work with native assets since the asset reader is from flutter

agree, it's out of the scope of this package. maybe we can develop another package to extend this package and provide some helper functions but not for now, this package is still in heavy development and APIs are not stable enough.

So people should manage that in their own app, maybe we can add an example?

actually the example under this repo has shown how to load image from assets, but we can make another one to show this clearer and add more solutions, e.g., copy to tmp folder and load models.

abdelaziz-mahdy commented 4 months ago

Ok let's open an issue with it I may check when I have time, no promises since I have been busy for a while now

rainyl commented 4 months ago

Ok let's open an issue with it I may check when I have time, no promises since I have been busy for a while now

Sounds good, just do it when you are free.

rainyl commented 4 months ago

Refer https://github.com/rainyl/awesome-opencv_dart/issues/1 for further development.

As for the answer of this issue, please take a look at the example of this repo.

https://github.com/rainyl/opencv_dart/blob/91681445fb6c465ed7ca9515e0f0a1d4564330cc/example/lib/main.dart#L86-L95