最近opencv-mobile 对luckfox
这款板子进行了适配优化,我对它也很有兴趣所以入手了一个luckfox
开发板,包含300万像素摄像头,价格还算比较便宜。
不过官方提供的交叉编译链只有Linux
以及windows
的,而我却是Mac
的,没办法直接调用,刚刚最近在使用bazel
,并且它支持远程编译。
关于 luckfox 和 opencv-mobile
可以看看 opencv-mobile 现已支持 luckfox-pico MIPI CSI 摄像头和 rkaiq/rga 硬件加速
关于 Bazel
可以前往官网查看https://bazel.google.cn/
,这里用到的主要是:https://github.com/bazelbuild/bazel-toolchains
开始使用
https://github.com/kekxv/luckfox-bazel做了优化,可以快速使用:
1 2 3 4 5 6
| #克隆仓库 git clone https://github.com/kekxv/luckfox-bazel.git #进入仓库 cd luckfox-bazel # 如果是 Linux 系统或者wsl,直接编译即可 bazel build //...
|
编译结果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| ☁ luckfox git:(main) ✗ bazel build //... INFO: Invocation ID: e25a3ea2-4501-447b-9e57-071b71866b07 Loading: Loading: Loading: 0 packages loaded Analyzing: 16 targets (10 packages loaded, 0 targets configured) INFO: Analyzed 16 targets (53 packages loaded, 6907 targets configured). INFO: Found 16 targets... [0 / 5] [Prepa] BazelWorkspaceStatusAction stable-status.txt [24 / 33] Foreign Cc - CMake: Building protobuf-build; 1s remote [24 / 33] Foreign Cc - CMake: Building protobuf-build; 11s remote [24 / 33] Foreign Cc - CMake: Building protobuf-build; 41s remote [24 / 33] Foreign Cc - CMake: Building protobuf-build; Downloading third-party/protobuf/protobuf-build/lib/libprotobuf-lite.a, 1.0 MiB / 1.2 MiB; 44s remote [25 / 33] Foreign Cc - CMake: Building opencv-build; 0s remote [25 / 33] Foreign Cc - CMake: Building opencv-build; 11s remote [25 / 33] Foreign Cc - CMake: Building opencv-build; 41s remote [25 / 33] Foreign Cc - CMake: Building opencv-build; Downloading third-party/opencv/opencv-build/lib/libopencv_calib3d.a, 1.4 MiB / 4.2 MiB; 79s remote [25 / 33] Foreign Cc - CMake: Building opencv-build; Downloading third-party/opencv/opencv-build/lib/libopencv_calib3d.a, 2.7 MiB / 4.2 MiB; 80s remote [25 / 33] Foreign Cc - CMake: Building opencv-build; Downloading third-party/opencv/opencv-build/lib/libopencv_dnn.a, 10.9 MiB / 13.6 MiB; 81s remote [25 / 33] Foreign Cc - CMake: Building opencv-build; Downloading third-party/opencv/copy_opencv-build/opencv-build/lib/libopencv_dnn.a, 4.9 MiB / 13.6 MiB; 82s remote [28 / 33] [Sched] Foreign Cc - CMake: Building ncnn ... (3 actions, 2 running) [30 / 33] Foreign Cc - CMake: Building ncnn; 0s remote [30 / 33] Foreign Cc - CMake: Building ncnn; 11s remote [31 / 33] [Scann] Compiling third-party/ncnn/hello_ncnn/hello_ncnn.cpp INFO: Elapsed time: 157.768s, Critical Path: 157.18s INFO: 33 processes: 6 remote cache hit, 19 internal, 8 remote. INFO: Build completed successfully, 33 total actions
|
更多的信息请参考 https://github.com/kekxv/luckfox-bazel/blob/main/README.md ,方便获取最新信息。
参考文章
关于 bazel 远程服务 远程执行概览 远程执行服务
bazel 交叉编译链 参考了 https://ltekieli.com/cross-compiling-with-bazel/
opencv-mobile 参考 https://zhuanlan.zhihu.com/p/670191385