-
-
- flutter config --enable-macos-desktop
- flutter config --enable-windows-desktop
- flutter config --enable-linux-desktop
- flutter devices
- flutter create desktopapp // 创建项目
-
-
- 需要安装homebrew 、 python2、cmake(3.21 或更新版本)
- 下载继承opencv
- 参考文档 [Integrating C library in a Flutter app using Dart FFI] 和 [Integrating C library in a desktop Flutter app using Dart FFI]
- ios:
- https://opencv.org/releases 下点击平台下载
- 将下载下来的opencv2.framework放到插件的ios下,同级native_opencv.podspec下写上:
-
# 告诉 CocoaPods 不要删除框架 s.preserve_paths = 'opencv2.framework' # 告诉链接器包含 opencv2 框架 s.xcconfig = { 'OTHER_LDFLAGS' => '-framework opencv2' } # 包括 OpenCV 框架 s.vendored_frameworks = 'opencv2.framework' # 包括原生框架 s.frameworks = 'AVFoundation' # 包括 C++ 库 s.library = 'c++'
- 执行pod install刷新
- macos:
- git clone https://github.com/opencv/opencv
- python3 ~/dev/lib/opencv/platforms/apple/build_xcframework.py --macos_archs=x86_64,arm64 --build_only_specified_archs --out ./build_xcframework
- 生成如下:
- 将opencv2.xcframework放到macos文件夹下,同级native_opencv.podspec下写上:
-
# 告诉 CocoaPods 不要删除框架 s.preserve_paths = 'opencv2.xcframework' # 告诉链接器包含 opencv2 框架 s.xcconfig = { 'OTHER_LDFLAGS' => '-framework opencv2' } # 包括 OpenCV 框架 s.vendored_frameworks = 'opencv2.xcframework' # 包括原生框架 s.frameworks = 'AVFoundation', 'Accelerate', 'OpenCL' # 包括 C++ 库 s.library = 'c++'
- 在example的macos下执行pod install,刷新podspec依赖
- Window:
- https://opencv.org/releases 下点击平台下载,
- Linux:
- Linux下的flutter记得用[手动安装方式],不要使用snap,不然会clang link fail
- 下载flutter_linux_x.x.x-stable.tar.xz
-
``` tar xf ~/Downloads/flutter_linux_3.3.0-stable.tar.xz ```
-
``` echo 'export PATH="$PATH:~/Downloads/flutter/bin"' >> ~/.bashrc ```
-
根据网站执行official OpenCV website.
``` # Install minimal prerequisites (Ubuntu 18.04 as reference) sudo apt update && sudo apt install -y cmake g++ wget unzip # Download and unpack sources wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip unzip opencv.zip # Create build directory mkdir -p build && cd build # Configure cmake ../opencv-4.x # Build cmake --build . ```
-
-
# 将OpenCV_DIR写进环境变量 echo 'export OpenCV_DIR=/home/west/dev/lib/opencv/build' >> ~/.bashrc
-
``` # set("OpenCV_DIR" $ENV{OpenCV_DIR}) set("OpenCV_DIR" /home/west/dev/lib/opencv/build) ```
-
- Linux下的flutter记得用[手动安装方式],不要使用snap,不然会clang link fail
-
Notifications
You must be signed in to change notification settings - Fork 0
使用 Dart FFI 在桌面 Flutter 应用程序(window,linux,macos)和ios中集成 opencv 库
License
hellozsh/native_opencv
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
使用 Dart FFI 在桌面 Flutter 应用程序(window,linux,macos)和ios中集成 opencv 库
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published