blur_detection 1.0.0 copy "blur_detection: ^1.0.0" to clipboard
blur_detection: ^1.0.0 copied to clipboard

A Flutter package for detecting blur in images.

example/lib/main.dart

import 'dart:io';
import 'package:blur_detection/blur_detection.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: ImagePickerScreen(),
    );
  }
}

class ImagePickerScreen extends StatefulWidget {
  @override
  _ImagePickerScreenState createState() => _ImagePickerScreenState();
}

class _ImagePickerScreenState extends State<ImagePickerScreen> {
  final ImagePicker _picker = ImagePicker();
  bool? _isBlurred;

  Future<void> _pickImage() async {
    final XFile? image = await _picker.pickImage(source: ImageSource.gallery);
    if (image != null) {
      File selectedFile = File(image.path);
      bool isBlurred = await BlurDetectionService.isImageBlurred(selectedFile);
      setState(() {
        _isBlurred = isBlurred;
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Blur Detection Example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: _pickImage,
              child: const Text('Pick an Image'),
            ),
            if (_isBlurred != null)
              Text(_isBlurred! ? 'Image is Blurred' : 'Image is Clear'),
          ],
        ),
      ),
    );
  }
}
14
likes
140
points
54
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for detecting blur in images.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_image_compress, image

More

Packages that depend on blur_detection