image_feature_detector 0.1.0 copy "image_feature_detector: ^0.1.0" to clipboard
image_feature_detector: ^0.1.0 copied to clipboard

outdated

A image feature detector using OpenCV for Android and IOS

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.

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;
10
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A image feature detector using OpenCV for Android and IOS

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, path_provider

More

Packages that depend on image_feature_detector