FLUTTER ECOSYSTEM

lowapple/flutter-pixel-matching

OpenCV를 사용한 이미지 특징 매칭 및 비교용 플러터 플러그인

flutter-pixelmatching 프로젝트 이미지
Stars
13
Forks
2
최근 푸시(UTC)
2024. 9. 9.
프로젝트 상태
보관됨
Junseo Youn GitHub avatar
GITHUB User

Junseo Youn ↗

Android, Flutter Software Engineer

@ugleelabKorea, Seoul공식 웹사이트 ↗
언어DartC++RubyShellCMakeKotlinCSwiftObjective-C

기술 주제

사용 중인 의존성

의존성 목록 8 개

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

Image feature matching for Flutter

Pub License: MIT

Plugin to perform feature matching using OpenCV

An image comparison module written as an exercise in Flutter FFI and out of a need for that functionality. It is called PixelMatching, but it is actually a FeatureMatching module utilizing OpenCV. Isolate was utilized for asynchronous processing. For the internal functionality, it was written in C++.

The matching algorithm is using FLannBasedMatcher, and for the detector, Andorid uses SIFT iOS uses KAZE.

There is currently no method to change the algorithm, so if you want to change the algorithm and test it, please refer to ios/Classes/src/ImageProcessor.cpp and change it.

ImageProcessor::ImageProcessor() : stateCode(NotInitialized) {
    compare.setMatchers(cv::DescriptorMatcher::create(DescriptorMatcher::MatcherType::FLANNBASED));
#ifdef __ANDROID__
    compare.setDetector(cv::SIFT::create());
#elif __APPLE__
    compare.setDetector(cv::KAZE::create());
#endif
}

Demo Screenshots

Demo Screenshot

Features

  • [x] Plugins utilizing OpenCV
  • [x] Perform image comparisons on camera streams (mobile platforms only), image files.
  • [x] Compares image features to calculate and return similarity

Supported platforms

Flutter PixelMatching is available for Android and iOS.

  • Android (min SDK 24)
  • iOS (min iOS version 11.0)

flutter_pixelmatching is currently written to be available only on mobile and there are no plans for other platforms.

Getting started

Installing dependencies
flutter pub add flutter_pixelmatching

or

dependencies:
  flutter_pixelmatching: ^1.0.0
XCode

Symbolic errors in the archive when using the FFi module.
For this issue, check out the following link https://github.com/dart-lang/ffi/issues/41#issuecomment-645550964

Runner -> Build Settings -> Strip Style -> change from "All Symbols" to "Non-Global Symbols"

XCode-Settings

Usage

For image data passed as parameters, we support CameraImage, Image from the Image plugin, and Uint8List of images.

final matching = PixelMatching();
// setup target image
await matching?.initialize(image: image);
// compare image 
final double? similarity = await matching?.similarity(cameraImage);
support CameraImage ImageFormatGroup

A list of currently supported ImageFormats for CameraImages. We added the YUV420 format due to issues with JPEG during recent development.

ImageFormatGroup Android iOS
yuv420
jpeg
bgra8888
nv21

⚠️ Issue

Currently, for ease of use, the libopencv_java4.so binary file is included inside the plugin. I know it's not recommended, but it's there so you can try it out quickly. If you are using the OpenCV module in another plugin, it may cause conflicts. Please note that.

License

MIT License. See LICENSE for details.