opencv_dart icon indicating copy to clipboard operation
opencv_dart copied to clipboard

Web support

Open abdelaziz-mahdy opened this issue 1 year ago • 12 comments

Do you think this package can run opencv web assembly? Or it will be alot of work?

abdelaziz-mahdy avatar Jun 05 '24 08:06 abdelaziz-mahdy

I haven't investigated but the most important problem is that web is not supported by dart::ffi and package:ffi, which is the basement of calling native codes. But I do think it's possible to call native libs via WASM, I used to search dart ffi for web or something else and found some developers were working on ffi for web , but it's immatrue and haven't update for a long time.

If you have any ideas, maybe we can try to work more on it.

rainyl avatar Jun 05 '24 08:06 rainyl

i think this will be possible when this is available https://github.com/dart-lang/sdk/issues/46690

abdelaziz-mahdy avatar Jul 23 '24 20:07 abdelaziz-mahdy

@abdelaziz-mahdy Yes you are right, will keep tracking.

rainyl avatar Jul 24 '24 00:07 rainyl

I noticed wasm_ffi project:

  • https://github.com/vm75/wasm_ffi
  • https://pub.dev/packages/wasm_ffi

looks like possible to use a .wasm library similar to dart:ffi

rainyl avatar Oct 23 '24 08:10 rainyl

If opencv can be compiled to wasm, it will lead to this package being cross platform, which will most probably replace the image lib for the performance sensitive apps

Since the image lib is not as fast as opencv

abdelaziz-mahdy avatar Oct 23 '24 12:10 abdelaziz-mahdy

Yes, will try to build opencv for wasm

rainyl avatar Oct 23 '24 13:10 rainyl

Hi, any update about openCV for wasm?

eramirez3 avatar Dec 03 '24 20:12 eramirez3

Hi, any update about openCV for wasm?

I havn't managed to build it successfully so it's stuck.

And I have no much time recently, so it seems to be a long way to go.

rainyl avatar Dec 04 '24 01:12 rainyl

Hi, any update about openCV for wasm?

I havn't managed to build it successfully so it's stuck.

And I have no much time recently, so it seems to be a long way to go.

does a repo exist for your tries? i may try to work on it too (we may make it work step by step)

abdelaziz-mahdy avatar Dec 04 '24 02:12 abdelaziz-mahdy

Hi, any update about openCV for wasm?

I havn't managed to build it successfully so it's stuck. And I have no much time recently, so it seems to be a long way to go.

does a repo exist for your tries? i may try to work on it too (we may make it work step by step)

WASM for OpenCV itself is okay, you can find the static library at https://github.com/rainyl/opencv.full/actions/runs/11481954041, but I didn't managed to build the dynamic libraries for C wrappers because emsdk doesn't support shared library when using cmake (not sure about the supporting status now).

So you can download the static libopencv-webassembly from the artifacts and try to built the dynamic library for the wrappers locally, and then call it from dart.

rainyl avatar Dec 04 '24 02:12 rainyl

Regarding the support for the web end, have there been any recent developments? We are looking forward to it.

zhponng avatar Jul 18 '25 03:07 zhponng

Hi @zhponng

Sadly no more progress, I have no much time to work on it.

Contributions are welcome, feel free to submit PRs.

rainyl avatar Jul 18 '25 03:07 rainyl