Failed to load dynamic library 'opencv_dart.dll'
According to your prompts, I went to ~\AppData\Local\Pub\Cache\hosted\pub.dev\opencv_dart-
@BluesCool Hello.
If it's difficult to resolve your network conditions to make dart run opencv_dart:setup work, you can
downlaod .tar.gz from https://github.com/rainyl/opencv_dart/releases/tag/v1.2.5 and extract, then move opencv_dart.dll to \AppData\Local\Pub\Cache\hosted\pub.flutter-io.cn\opencv_dart-1.2.5\windows
@rainyl Hello. \AppData\Local\Pub\Cache\hosted\pub.flutter-io.cn\opencv_dart-1.2.5\windows, I can find opencv_dart.dll, When I run the example you provided, it prompts ArgumentError (Invalid argument(s): Failed to load dynamic library 'opencv_dart.dll': Invalid access to memory location. (error code: 998))
I just tested on my Windows 11 PC but can't reprocude it.
Provide more informations please, e.g., the structure of pub.flutter-io.cn\opencv_dart-1.2.5\windows and the steps to reproduce.
I just added this dependency in pub.yaml, and then used the code you provided: final img = cv.imread("test/images/lenna.png", flags: cv.IMREAD_COLOR); final gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY); print("${img.rows}, ${img.cols}"); cv.imwrite("test_cvtcolor.png", gray);
In cv.imread("test/images/lenna.png", flags: cv.IMREAD_COLOR); reported an error, as follows: [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'opencv_dart.dll': Invalid access to memory location. (error code: 998) #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43) #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12) #2 loadNativeLibrary (package:opencv_dart/src/native_lib.dart:37:29) #3 cimgcodecs (package:opencv_dart/src/native_lib.dart:47:48) #4 cimgcodecs (package:opencv_dart/src/native_lib.dart) #5 imread. v_dart/src/core/base.dart:83:76) #7 imread.
Then, as mentioned above, I went to find 'opencv_dart.dll'. The folder that differs from your prompt is pub.flutter-io.cn. Yours is named pub.dev.
- Check the hash value of opencv_dart.dll via
Get-FileHash -Algorithm sha256 .\opencv_dart.dll, it should be1EC16101DCB0A8F79A97E67826385F7BA9BCA9FCBD1E582FE4859174852B6CE6 - Provide the info of your hardware and OS, i.e., windows 10 or windows 11, x86, x64 or arm64, for windows, this plugin was only tested on windows 11 x64 (should work on windows 10 x64 too)
- The version of Flutter/dart? also attach the output of flutter doctor
1.‘ED67F391C1B1DD8E12BD2A01152ABE77010AB3DF2F499AFD0DBAE274517CA6BA’ My output is different from yours
2.My operating system is windows11 x64.
3.The flutter doctor information is as follows:
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.0, on Microsoft Windows [版本 10.0.22631.4169], locale zh-CN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
X Could not determine java version
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.9.6)
[!] Android Studio (version 2021.3)
X Unable to find bundled Java version.
[√] IntelliJ IDEA Ultimate Edition (version 2022.3)
[√] Connected device (3 available)
[√] Network resources
@BluesCool
1.‘ED67F391C1B1DD8E12BD2A01152ABE77010AB3DF2F499AFD0DBAE274517CA6BA’ My output is different from yours
Apparently, your opencv_dart.dll was broken, please download from https://github.com/rainyl/opencv_dart/releases/download/v1.2.5/libopencv_dart-windows-x64.tar.gz and try again.
I downloaded and replaced it, but the effect is still the same. I tested the hash value and it is consistent with what you gave. Is there any other operation?
I changed the computer and this problem did not occur.
I changed the computer and this problem did not occur.
Well, maybe something was broken in your previous PC...