image_feature_detector 0.2.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

image_feature_detector #

A image feature detector using opencv for IOs and Android.

This plugin uses native versions of OpenCV to detect shapes in given images.

What does it do? #

For now it only detects rectangles in given images. It uses native implementations for both IOs and Android for this task.

Usage #

To use this package add following import to your file:

import 'package:image_feature_detector/image_feature_detector.dart';

The API for this package is fairly simple. We can only detect rectangles for now.

If you need more functionalities, feel free to contribute or open an issue in the code repository.

To detect a rectangle in an image save it to a local file and call the ImageFeatureDetector:

var rectangle = ImageFeatureDetector.detectRectangles(_filePath);

// Access the points of the contour
rectangle.contour[0].x; // Access X
rectangle.contour[0].y; // Access the y value.

To detect and transform the image into a normalized image use following api:

var imageData = ImageFeatureDetector.detectAndTransformRectangle(_filePath);

Quick Aside: Relative Coordiantes #

To be as size independent as possible this package uses relative coordinates.

Absolute coordinates would look likes this:

// This values are in Pixels.
var p = Point(x: 25, y: 25); 

This coordinates are only correct for the original width and height of the image.

If it gets scaled for some reason the above point won't be correct anymore.

To work around this we use relative coordinates. These are values between 0 and 1.

// Would be 25 in a image width 500 width or height
var relativePoint = Point(x: 0.05, y: 0.05);

RelativeCoordianteHelper #

To revert the relative coordinates back to absolute values we can use this helper.

Usage #

We have to easy methods. One for calculating a single value another for calculating a whole Point.

Calculating one point:

var p = Point(x: 0.05, y: 0.05);
var absoluteX = RelativeCoordianteHelper.calculateDistance(p.x, 500); // p.x = 0.05

// absolute value would be 25

Calculating a whole point:

var absolutePoint = RelativeCoordianteHelper.calculatePointDinstances(
          Point(x: 0.05, y: 0.05), ImageDimensions(500, 500));

// Result Point -> x = 25; y = 25;

0.2.1 #

  • Objective C: added helper to work with points to sort them and refactored opencvwrapper to be able to reuse contour logic for transformation
  • Java: refactored Opencvwrapper for upcomming image perspective wrapping function, started to add points helper to get list of points sorte
  • General: new Api has been added: detectAndTransformRectangle.

0.2.0 #

  • refactored image detection on java side to work with real images and fixed a logic bug, which found bigger objects that werent rectangles in the end
  • lifted the objective c code to the same functionality as the java side

0.1.1 #

Added longer description to pubspec and other fixes from pub

0.1.0 #

This is the initial release fo this package

Features #

  • Added detectRectangles to ImageFeatureDetector
  • Added getVersionStringto ImageFeatureDetector
  • Added RelativeCoordianteHelper to Plugin
  • Added example for basic usage.

example/README.md

image_feature_detector_example #

Demonstrates how to use the image_feature_detector plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  image_feature_detector: ^0.2.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:image_feature_detector/image_feature_detector.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
34
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Oct 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (path_provider).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
path_provider ^0.5.0+1 0.5.0+1 1.3.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test