1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Flutterのdart:ffiでOpenCvを使う

Last updated at Posted at 2023-12-21

はじめに

FlutterでOpenCvを使いたかった。
pub.devで一部のOpenCv機能が使えるLibがあるが、2023.12時点ではMatレベルで操作できるものは存在しなかった。
仕方がないので、公式SDKをDLしてdart:ffiとC++を使ってOpenCvおよびMatを操作できるようにする。
ざっくりとしたコードの依存は dart:ffi -> cpp -> OpenCvSdk となり、言語はdartとcppで完結する。

公式SDK
https://opencv.org/releases/

iOS

iOSでOpenCv

Mat受け渡しが上記そのままではだめなので、その対応方法

Android

AndroidでのSDK取り込み方法が記されている。
LinuxとWinについても言及されているが、筆者には不要なため試していない。
VsCodeが推奨されているが、AndroidStudioでも問題なく適用できた。
わかりやすい具体的な方法が記述されており、調査の手間を考えると有料分の価値はあった。

感想

先人に感謝。
FlutterでMatが簡単に使えるように、pub.devで誰か対応してくれたら助かる。
各SDKの使い方はOpenCv公式がもうちょっと親切に解説してほしい。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?