edge_detector 1.0.3
edge_detector: ^1.0.3 copied to clipboard
Edge detector plugin based on google ml kit object detection. Allows basic edge detection for given image.
edge_detector #
Edge detector plugin based on google ml kit object detection. Allows basic edge detection for given image file.
💡 Please note that this package is just for edge detection. 💡
Check other packages for cropping tools:
- auto_crop - available for Android & iOS only.
- custom_cropper
Preview #
Example usage #
Basic usage #
Future<void> _detectEdges() async {
final imageFile = File('path/to/image');
// Edges that are respective for the original image size.
final originalImageEdges = await EdgeDetector().detectEdges(imageFile);
if (originalImageEdges == null) return;
final topLeft = originalImageEdges.topLeft; // Offset(x,y).
final topRight = originalImageEdges.topRight; // Offset(x,y).
final bottomRight = originalImageEdges.bottomRight; // Offset(x,y).
final bottomLeft = originalImageEdges.bottomLeft; // Offset(x,y).
final all = originalImageEdges.values; // [topLeft, topRight, bottomRight, bottomLeft].
// Edges that are respective for the rendered image widget size.
final widgetEdges = await originalImageEdges.toWidgetEdges(
imageKey: _imageKey,
originalImageFile: imageFile,
);
}
Full example #
Full example showing how to set up and use EdgeDetector. Source code