image_blur_detector 0.0.2 copy "image_blur_detector: ^0.0.2" to clipboard
image_blur_detector: ^0.0.2 copied to clipboard

A Flutter package that provides utilities for detecting blur in images. Ideal for applications that require image quality analysis.

example/example.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Blur Detector Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const BlurDetectorScreen(),
    );
  }
}

class BlurDetectorScreen extends StatefulWidget {
  const BlurDetectorScreen({Key? key}) : super(key: key);

  @override
  _BlurDetectorScreenState createState() => _BlurDetectorScreenState();
}

class _BlurDetectorScreenState extends State<BlurDetectorScreen> {
  final ImagePicker _picker = ImagePicker();
  File? _image;
  String _result = '';

  Future<void> _pickImage() async {
    final XFile? image = await _picker.pickImage(source: ImageSource.gallery);

    if (image != null) {
      setState(() {
        _image = File(image.path);
        _result = '';
      });

      final bool isImageClear = await BlurRadio.evaluateImageQuality(
        image: File(image.path),
        acceptableBlurThreshold: 50,
      );

      setState(() {
        _result = isImageClear
            ? "The image is clear and readable."
            : "The image is blurry or text is not readable.";
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Blur Detector Example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            if (_image != null) Image.file(_image!),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: _pickImage,
              child: const Text('Pick an Image'),
            ),
            const SizedBox(height: 20),
            Text(
              _result,
              style: const TextStyle(fontSize: 18),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
120
points
38
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that provides utilities for detecting blur in images. Ideal for applications that require image quality analysis.

Documentation

API reference

License

unknown (license)

Dependencies

flutter, google_mlkit_text_recognition, image_picker, tflite

More

Packages that depend on image_blur_detector