Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[DevTalksRomania]Building Augmented Reality Exp...

[DevTalksRomania]Building Augmented Reality Experiences with Flutter and AI-Powered Development

This is the slide, "Building Augmented Reality Experiences with Flutter and AI-Powered Development" at Dev Talks Romania
#DevTalks #DevTalksRomania #GenerativeAI #mobile #flutter

Avatar for Kenichi Kambara

Kenichi Kambara

June 05, 2025
Tweet

More Decks by Kenichi Kambara

Other Decks in Technology

Transcript

  1. Kenichi Kambara (@korodroid) June 5, 2025 Building Augmented Reality Experiences

    with Flutter and AI-Powered Development Romania 2025
  2. •Mobile App Development •Talks (21 Int’l/100+ Domestic) •Writings (10 Dev/Edu

    Books) •[Of fi cial] Evangelist at NTT TechnoCross e.g. AI-powered call analysis, livestock monitoring, and privileged access management •[Private] iplatform.org About me Kenichi Kambara (X:@korodroid)
  3. Agenda •My Motivation and Vision •Enhancing your Flutter App with

    AR •Common Design Pitfalls in AR UI/UX to Avoid •AI-Driven AR Development •Best Practices Based on Our Experience
  4. My Motivation and Vision  From Smartphones to the Seamless

    Integration of the Virtual ˍ Physical 🚀
  5. Challenges to Overcome  •Steps to Enhance a Flutter App

    with AR •Common Development Challenges and Solutions •Principles for Developing AR Features
  6. About Flutter  A framework that allows simultaneous development of

    apps for multiple platforms from a common source (Cross-platform) https://docs. fl utter.dev/
  7. 3 Unique features of Flutter  1. Beautiful UI &

    High Performance 2. Fast and ef fi cient development process 3. Uses Dart as the programming language
  8. 2. Fast and ef fi cient development process  Hot

    reload https://docs. fl utter.dev/tools/hot-reload
  9. 3. Uses Dart as the programming language  Very similar

    to Java/JavaScript import 'package:flutter/material.dart'; void main() { runApp( Center( child: Text( ‘Hello, Flutter’, textDirection: TextDirection.ltr, ), ), ); }
  10. Use Case 1: Camera Preview & Overlay  (a) Create

    a Camera Preview Screen (b) Stack multiple Layers
  11. (a) Create a Camera Preview Screen  1. Install the

    package 2. Set up required permissions 3. Initialize the camera & show the preview 4. Test the app
  12. How to Stack multiple Layers  ref. Stack: https://api. fl

    utter.dev/ fl utter/widgets/Stack-class.html
  13.  Code Example (Multiple Layers) A B Widget _stackTwoScreen() {

    return Stack( children: [ ScreenA, ScreenB, ], ); }
  14. Use Case 2: Text Recognition and Overlay  (c) Recognize

    Text [Translate recognized Text] (d) Overlay Text on Camera Preview (e) Adjust Text Position Lapte
  15. (c) Recognize Text  1. Install the package 2. Recognize

    Text from Camera Preview 3. Test the app
  16.  1. Install the package pubspec.yaml dependencies: flutter: sdk: flutter

    camera: ^0.10.0+2 permission_handler: ^10.2.0 google_mlkit_text_recognition: ^0.10.0
  17.  2. Recognize Text from Camera Preview CameraImage RecognizedText InputImage

    Convert Recognize Text MLKit - TextRecognizer#processImage
  18.  2. Recognize Text from Camera Preview main.dart final TextRecognizer

    _textRecognizer = TextRecognizer(); void _processCameraImage(CameraImage image) async { if (_isDetecting) return; _isDetecting = true; try { final WriteBuffer allBytes = WriteBuffer(); for (var plane in image.planes) { allBytes.putUint8List(plane.bytes); } final bytes = allBytes.done().buffer.asUint8List(); // Create Metadata final InputImageMetadata metadata = InputImageMetadata( size: Size(image.width.toDouble(), image.height.toDouble()), rotation: InputImageRotation.rotation0deg, format: InputImageFormat.nv21, // Image format bytesPerRow: image.planes[0].bytesPerRow, );
  19.  2. Recognize Text from Camera Preview final InputImage inputImage

    = InputImage.fromBytes( bytes: bytes, metadata: metadata, ); final RecognizedText recognizedText = await _textRecognizer.processImage(inputImage); // Output recognized Text & Coordination for (TextBlock block in recognizedText.blocks) { final Rect boundingBox = block.boundingBox; final String text = block.text; // Output to console print('Text: $text'); print('BoundingBox: ${boundingBox.left}, ${boundingBox.top}, ${boundingBox.right}, $ {boundingBox.bottom}'); } } catch (e) { print('Error in recognizing text: $e'); } finally { _isDetecting = false; } }
  20.  1. Use the advanced Emulator Setting 2. Use the

    static Image instead of Camera Solution: How to test using Emulator
  21. Using the static Image instead of Camera  Camera Image

    (Camera Preview) Static Image (Assets)
  22. Tips. How to test using Asset/Images  final inputImage =

    InputImage.fromFilePath('assets/test_image.png'); final RecognizedText recognizedTextResult = await _textRecognizer.processImage(inputImage); Future<RecognizedText> processImage(InputImage inputImage) async { final result = await _channel.invokeMethod( 'vision#startTextRecognizer', <String, dynamic>{ 'id': id, 'imageData': inputImage.toJson(), 'script': script.index }); return RecognizedText.fromJson(result); }
  23.  Common Design Pitfalls in AR UI/UX to Avoid •Common

    user frustrations →e.g., unreadable text, visual overload, slow response •Accessibility issues in AR →e.g., low contrast, small font sizes ,and so on •What I learned from user feedback in my app →e.g., Couldn’t read the overlay in sunlight
  24.  • Add a Semi-Transparent Background to the Text •

    Add a Shadow to the Text • Use Outlined Text • Dynamically Change the Text Color • Blur Part of the Background Solutions to Improve Text Visibility on Camera Preview
  25.  • Add a Semi-Transparent Background to the Text •

    Add a Shadow to the Text • Use Outlined Text • Dynamically Change the Text Color • Blur Part of the Background Solutions to Avoid Display Issues
  26.  Add a Semi-Transparent Background to the Text Widget _showOverlayTextScreen()

    { return Container( color: Colors.black.withOpacity(0.5), child: Text( text, style: textStyle, ), ); }
  27.  TextElement elementNew = TextElement( text: resultText, // e.g. “Milk”,

    boundingBox: element.boundingBox, cornerPoints: element.cornerPoints, symbols: element.symbols, recognizedLanguages: element.recognizedLanguages, confidence: element.confidence, angle: element.angle); Text: Milk BoundingBox: 123.0, 214.0, 552.0, 269.0 (e) Adjust Text Position
  28.  (e) Adjust Text Position Bounding box coordinates are based

    on the original image dimensions Essential to Scale
  29.  scaleX = constraints.maxWidth / imageSize.width; scaleY = constraints.maxHeight /

    imageSize.height; Positioned( left: element.boundingBox.left * scaleX, top: element.boundingBox.top * scaleY, width: element.boundingBox.width * scaleX, height: element.boundingBox.height * scaleY, child: Text( element.text, …) ); (e) Adjust Text Position
  30. How AI Helped Us Accelerate AR Development  •Real Prompts

    from Our Work fl ow •AI for bug fi xing and optimization •Development speed boost
  31. Mobile Apps Development with Generative AI  Natural language prompts

    for: •Cultural UX Guidance •AR Story Generation •Natural Language Tech Support $POWFSTBUJPOBM"* 🧠Gemini 🧠ChatGPT 🧠Claude *%&*OUFHSBUFE"* 🛠Cursor 🛠Cline 🛠GitHub Copilot Embedded in your IDE for: •AR Code Optimization •Localization Bug Detection •AR Asset Integration
  32. Examples of Language Resources  // English Resource "en": {

    // Top Screen "appName": "SekaiPhone Pro", "modeTalkSpeech": "Talk Mode\n(Speech)", "modeTalkText": "Talk Mode\n(Text)", "modePhone": "Phone Mode", "modeCamera": "Camera Mode", // Hoge Screen // … },
  33. Use Case 2: Using IDE-Integrated AI  Camera Preview "EEJOHUIFDBNFSBQBDLBHF

    8SJUJOHUIFDBNFSBMPHJD #VJMEJOHUIF6*GPSQSFWJFXEJTQMBZ BOENPSF
  34. Best Practices based on my experience •Behaviours depend on each

    device →Testing on many devices is essential •Many operations related on AR are heavier →Performance Tuning is also crucial •On-Device vs Cloud: Considerations →Depending on Use Case