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

A Flutter widget for real-time object detection using the camera and SSD MobileNet.

example/lib/main.dart

// ignore_for_file: avoid_print

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:realtime_image_labeler/realtime_image_labeler.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  SystemChrome.setSystemUIOverlayStyle(
    SystemUiOverlayStyle.dark.copyWith(
      statusBarColor: Colors.transparent,
      systemNavigationBarColor: Colors.transparent,
      systemNavigationBarIconBrightness: Brightness.dark,
    ),
  );

  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
  ]);
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Realtime Image Labeler Example',
      home: const MyHomePage(),
      color: Colors.white,
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    ScreenParams.screenSize = MediaQuery.of(context).size;

    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text('Image Labeler Example'),
      ),
      body: SizedBox(
        height: ScreenParams.screenSize.width,
        child: FutureBuilder(
          future: Future.delayed(const Duration(seconds: 1)),
          builder: (context, snapshot) {
            if (snapshot.connectionState == ConnectionState.waiting) {
              return const Center(child: CircularProgressIndicator());
            }
            return DetectorWidget(
              iconSize: 50,
              onResult: (results) =>
                  print(results.map((result) => result.label).join(', ')),
              onTakePicture: (file) => print('Picture taken: ${file.path}'),
            );
          },
        ),
      ),
    );
  }
}
0
likes
150
points
47
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter widget for real-time object detection using the camera and SSD MobileNet.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

camera, camera_android, exif, flutter, image, tflite_flutter

More

Packages that depend on realtime_image_labeler