https://github.com/emorilebo/advanced_image_processing
A comprehensive Flutter plugin for advanced image processing, featuring real-time filters, object recognition, and AR capabilities.
https://github.com/emorilebo/advanced_image_processing
image processing toolkit
Last synced: about 1 year ago
JSON representation
A comprehensive Flutter plugin for advanced image processing, featuring real-time filters, object recognition, and AR capabilities.
- Host: GitHub
- URL: https://github.com/emorilebo/advanced_image_processing
- Owner: emorilebo
- License: mit
- Created: 2025-02-19T21:42:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-07T14:38:47.000Z (about 1 year ago)
- Last Synced: 2025-04-07T15:37:11.297Z (about 1 year ago)
- Topics: image, processing, toolkit
- Language: Dart
- Homepage: https://pub.dev/packages/advanced_image_processing_toolkit
- Size: 151 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Advanced Image Processing Toolkit
[](https://pub.dev/packages/advanced_image_processing_toolkit)
[](https://opensource.org/licenses/MIT)
[](https://flutter.dev)
A powerful Flutter plugin that provides advanced image processing capabilities, including real-time filters, object recognition, and optional augmented reality features.
## 📋 Table of Contents
- [Overview](#overview)
- [Features](#features)
- [Installation](#installation)
- [Getting Started](#getting-started)
- [Basic Setup](#basic-setup)
- [Image Filtering](#image-filtering)
- [Object Detection](#object-detection)
- [Augmented Reality](#augmented-reality)
- [API Reference](#api-reference)
- [Platform Support](#platform-support)
- [Future Updates](#future-updates)
- [Requirements](#requirements)
- [Examples](#examples)
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [License](#license)
## 🔍 Overview
Advanced Image Processing Toolkit is a comprehensive Flutter plugin designed to bring sophisticated image processing capabilities to your mobile applications. Whether you need to apply filters to images, detect objects in real-time, or create immersive AR experiences, this toolkit provides a unified, easy-to-use API that works across platforms.
## ✨ Features
### 🎨 Real-time Image Filters
- **Grayscale Conversion**: Transform color images to grayscale with a single function call
- **Gaussian Blur**: Apply configurable blur effects with adjustable intensity
- **Brightness Adjustment**: Easily modify image brightness with precise control
- **Contrast Enhancement**: Improve image contrast for better visibility
- **Custom Filter Support**: Create and apply your own custom filters
### 🔍 Object Detection & Recognition
- **Real-time Object Detection**: Identify objects in images or camera feed
- **Multiple Object Recognition**: Detect and track multiple objects simultaneously
- **Confidence Score Reporting**: Get accuracy metrics for each detection
- **Bounding Box Calculation**: Receive precise object locations within images
- **Custom Model Integration**: Use your own trained models for specialized detection
### 🎮 Augmented Reality (Optional)
- **3D Model Placement**: Position 3D models in real-world space
- **AR Session Management**: Easily control AR experiences
- **Surface Detection**: Identify and use real-world surfaces
- **Real-world Scale Adjustment**: Ensure proper sizing of virtual objects
- **Interactive AR Elements**: Create engaging user experiences
### 💪 Performance Optimized
- **Hardware Acceleration**: Utilizes GPU for faster processing
- **Memory Efficient**: Optimized for mobile device constraints
- **Battery Conscious**: Designed to minimize power consumption
- **Cross-platform Consistency**: Reliable performance on both iOS and Android
## 📥 Installation
Add this to your package's `pubspec.yaml` file:
```yaml
dependencies:
advanced_image_processing_toolkit: ^0.1.0
```
Then run:
```bash
flutter pub get
```
### Optional AR Dependencies
To use the AR features, you need to manually add these dependencies to your app:
```yaml
dependencies:
# For iOS AR features
arkit_plugin: ^1.0.7
# For Android AR features
arcore_flutter_plugin: ^0.1.0
```
### Platform-specific Setup
#### Android
Add the following permissions to your `AndroidManifest.xml` file:
```xml
```
#### iOS
Add the following to your `Info.plist` file:
```xml
NSCameraUsageDescription
This app needs camera access for image processing and AR features
NSPhotoLibraryUsageDescription
This app needs photo library access to process your images
```
## 🚀 Getting Started
### Basic Setup
First, import the package:
```dart
import 'package:advanced_image_processing_toolkit/advanced_image_processing_toolkit.dart';
```
Initialize the toolkit in your app (typically in `main.dart` or during app startup):
```dart
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize the toolkit
await AdvancedImageProcessingToolkit.initialize(
enableObjectDetection: true,
enableAR: false, // Set to true only if you've added the AR dependencies
);
runApp(MyApp());
}
```
### Image Filtering
Apply filters to images with just a few lines of code:
```dart
// Create an instance of ImageFilters
final imageFilters = ImageFilters();
// Apply grayscale filter
Future convertToGrayscale(Uint8List imageBytes) async {
try {
// Apply the filter
final processedImage = await imageFilters.applyGrayscale(imageBytes);
// Use the processed image
setState(() {
_displayImage = processedImage;
});
} catch (e) {
print('Error applying grayscale: $e');
}
}
// Apply blur filter
Future applyBlur(Uint8List imageBytes) async {
try {
// Apply blur with sigma value of 5.0
final processedImage = await imageFilters.applyBlur(imageBytes, 5.0);
// Use the processed image
setState(() {
_displayImage = processedImage;
});
} catch (e) {
print('Error applying blur: $e');
}
}
// Adjust brightness
Future adjustBrightness(Uint8List imageBytes) async {
try {
// Increase brightness by 20%
final processedImage = await ImageFilters.adjustBrightness(imageBytes, 1.2);
// Use the processed image
setState(() {
_displayImage = processedImage;
});
} catch (e) {
print('Error adjusting brightness: $e');
}
}
```
### Object Detection
Detect objects in images:
```dart
Future detectObjectsInImage(Uint8List imageBytes) async {
try {
// Perform object detection
final detections = await ObjectRecognition.detectObjects(imageBytes);
// Process the results
for (var detection in detections) {
print('Detected: ${detection.label}');
print('Confidence: ${detection.confidence}');
print('Position: ${detection.boundingBox}');
// Draw bounding box or highlight the object
// ...
}
} catch (e) {
print('Error detecting objects: $e');
}
}
```
### Augmented Reality
Create AR experiences:
```dart
Future startARExperience() async {
// Check if AR is supported on the device
final isSupported = await AugmentedReality.isARSupported();
if (isSupported) {
// Start an AR session
final sessionStarted = await AugmentedReality.startARSession();
if (sessionStarted) {
// Place a 3D model in the AR scene
await AugmentedReality.placeModel(
modelPath: 'assets/models/robot.glb',
position: [0.0, 0.0, -1.0],
scale: 0.5,
rotation: [0.0, 45.0, 0.0],
);
}
} else {
print('AR is not supported on this device');
}
}
// Stop the AR session when done
Future stopARExperience() async {
await AugmentedReality.stopARSession();
}
```
## 📚 API Reference
### ImageFilters
| Method | Description | Parameters | Return Type |
|--------|-------------|------------|-------------|
| `applyGrayscale` | Converts an image to grayscale | `List imageData` | `Future>` |
| `applyBlur` | Applies Gaussian blur to an image | `List imageData, double sigma` | `Future>` |
| `adjustBrightness` | Adjusts image brightness | `Uint8List imageBytes, double factor` | `Future` |
### ObjectRecognition
| Method | Description | Parameters | Return Type |
|--------|-------------|------------|-------------|
| `detectObjects` | Detects objects in an image | `Uint8List imageBytes` | `Future>` |
### DetectedObject
| Property | Type | Description |
|----------|------|-------------|
| `label` | `String` | The name/class of the detected object |
| `confidence` | `double` | Confidence score (0.0 to 1.0) |
| `boundingBox` | `Rect` | Position and size of the object in the image |
### AugmentedReality
| Method | Description | Parameters | Return Type |
|--------|-------------|------------|-------------|
| `isARSupported` | Checks if AR is supported on the device | None | `Future` |
| `startARSession` | Starts an AR session | None | `Future` |
| `stopARSession` | Stops the current AR session | None | `Future` |
| `placeModel` | Places a 3D model in AR space | `String modelPath, List position, double scale, List rotation` | `Future` |
## 🖥️ Platform Support
| Platform | Support |
|----------|---------|
| Android | ✅ |
| iOS | ✅ |
| Web | 🚧 Coming soon |
| macOS | 🚧 Coming soon |
| Windows | 🚧 Coming soon |
| Linux | 🚧 Coming soon |
## 🔮 Future Updates
We're actively working on enhancing the Advanced Image Processing Toolkit with the following features:
### 🎨 Enhanced Image Filters
- **Sepia Filter**: Add vintage tone to images
- **Vignette Effect**: Create stylish darkened corners
- **Color Manipulation**: HSL adjustments, color inversion, and tinting
- **Artistic Filters**: Watercolor, oil painting, and sketch effects
- **Custom Filter Chains**: Combine multiple filters with configurable parameters
### 🧠 Advanced ML Capabilities
- **Custom ML Model Support**: Import and use your own trained models
- **Specialized Detection Models**: Industry-specific object recognition
- **Face Detection & Analysis**: Facial feature recognition and emotion detection
- **Text Recognition**: OCR capabilities for document scanning
- **Pose Estimation**: Human pose detection and tracking
### 🌟 Enhanced AR Features
- **Occlusion**: Allow virtual objects to be hidden behind real-world objects
- **Lighting Estimation**: Adapt virtual content to match real-world lighting
- **Environment Mapping**: Reflect real-world surroundings on virtual objects
- **Persistent AR**: Save and reload AR experiences
- **Collaborative AR**: Multi-user AR experiences
### 📱 Expanded Platform Support
- **Web Support**: Full functionality in browser environments
- **Desktop Support**: Native performance on Windows, macOS, and Linux
- **Cross-platform Consistency**: Unified API across all platforms
### ⚡ Performance Optimizations
- **Real-time Processing**: Enhanced algorithms for faster processing
- **Memory Usage Reduction**: More efficient resource management
- **Battery Consumption**: Further optimizations for mobile devices
- **Parallel Processing**: Multi-threading support for complex operations
Stay tuned for these exciting updates! Follow our [GitHub repository](https://github.com/emorilebo/advanced_image_processing) for the latest developments.
## 📋 Requirements
- **Flutter SDK**: >=2.12.0
- **Dart**: >=2.12.0
- **iOS**: 11.0 or newer
- **Android**: API level 21 or newer
## 📱 Examples
### Complete Image Processing Example
```dart
import 'package:flutter/material.dart';
import 'package:advanced_image_processing_toolkit/advanced_image_processing_toolkit.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:typed_data';
class ImageProcessingDemo extends StatefulWidget {
@override
_ImageProcessingDemoState createState() => _ImageProcessingDemoState();
}
class _ImageProcessingDemoState extends State {
Uint8List? _imageBytes;
final _imageFilters = ImageFilters();
final _picker = ImagePicker();
List? _detectedObjects;
Future _pickImage() async {
final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) {
final bytes = await pickedFile.readAsBytes();
setState(() {
_imageBytes = bytes;
_detectedObjects = null;
});
}
}
Future _applyGrayscale() async {
if (_imageBytes != null) {
final processed = await _imageFilters.applyGrayscale(_imageBytes!);
setState(() {
_imageBytes = Uint8List.fromList(processed);
});
}
}
Future _detectObjects() async {
if (_imageBytes != null) {
final objects = await ObjectRecognition.detectObjects(_imageBytes!);
setState(() {
_detectedObjects = objects;
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Image Processing Demo')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (_imageBytes != null) ...[
Image.memory(
_imageBytes!,
height: 300,
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: _applyGrayscale,
child: Text('Apply Grayscale'),
),
SizedBox(width: 10),
ElevatedButton(
onPressed: _detectObjects,
child: Text('Detect Objects'),
),
],
),
],
if (_detectedObjects != null) ...[
SizedBox(height: 20),
Text('Detected ${_detectedObjects!.length} objects'),
Expanded(
child: ListView.builder(
itemCount: _detectedObjects!.length,
itemBuilder: (context, index) {
final obj = _detectedObjects![index];
return ListTile(
title: Text(obj.label),
subtitle: Text('Confidence: ${obj.confidence.toStringAsFixed(2)}'),
);
},
),
),
],
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _pickImage,
child: Icon(Icons.add_photo_alternate),
),
);
}
}
```
## 🛠️ Troubleshooting
### Common Issues
#### AR Features Not Working
- Make sure you've added the required AR dependencies (arkit_plugin for iOS, arcore_flutter_plugin for Android)
- Verify that AR is supported on the device using `AugmentedReality.isARSupported()`
- Check that you've initialized the toolkit with `enableAR: true`
#### Build Errors
- If you're not using AR features, initialize with `enableAR: false` to avoid dependency issues
- Make sure you have the correct platform-specific setup (permissions in AndroidManifest.xml and Info.plist)
#### Permission Denials
- Request permissions at runtime using the permission_handler package:
```dart
import 'package:permission_handler/permission_handler.dart';
await Permission.camera.request();
await Permission.storage.request();
```
## 🤝 Contributing
Contributions are always welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) first.
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
### Development Setup
```bash
# Clone the repository
git clone https://github.com/emorilebo/advanced_image_processing.git
# Navigate to the project
cd advanced_image_processing
# Get dependencies
flutter pub get
# Run tests
flutter test
# Run the example app
cd example
flutter run
```
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## 👨💻 Author
**Godfrey Lebo**
- GitHub: [@emorilebo](https://github.com/emorilebo)
- Website: [godfreylebo.vercel.app](https://godfreylebo.vercel.app/)
## 🙏 Support
If you find this package helpful, please consider:
- ⭐ Starring the repository on GitHub
- 🐛 Reporting issues you find
- 📖 Contributing to the documentation
- 🤝 Submitting pull requests
For questions and support, please [open an issue](https://github.com/emorilebo/advanced_image_processing/issues) on GitHub.
---