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.
To use this package add following import to your file:
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
var rectangle = ImageFeatureDetector.detectRectangles(_filePath); // Access the points of the contour rectangle.contour.x; // Access X rectangle.contour.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);
To revert the relative coordinates back to absolute values we can use this helper.
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;
- 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:
- 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
Added longer description to pubspec and other fixes from pub
This is the initial release fo this package
- Added example for basic usage.
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:
$ 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:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Dec 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.6.1
- pana: 0.13.1+4
- Flutter: 1.12.13+hotfix.2
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 (