• Courses
  • YouTube
  • Dev News
  • Technology
  • Blogs
  • Flutter Jobs
  • Contact
    • About Us
    • RegisterLogin
    Navoki
    • Courses
    • YouTube
    • Dev News
    • Technology
    • Blogs
    • Flutter Jobs
    • Contact
      • About Us
    • RegisterLogin

      Developers

      • Home
      • Blog
      • Developers
      • DETECT TEXT FROM IMAGE USING FIREBASE
      Text Reader 700X400

      DETECT TEXT FROM IMAGE USING FIREBASE

      • Posted by Shivam Srivastava
      • Categories Developers, Flutter
      • Date March 24, 2020
      Spread the love

      Introduction

      So, I know Machine Learning is there in open and it’s been there for quite long. It goes means back in the previous century once it had been initially coined and brought into existence, currently, you discover it every place in existence therefore vital that your life is perhaps enclosed by it and you will even not understand, consider your smartphones they’re referred to as “smart” for a specific reason and nowadays they’re “smartest” while getting even more n more from day to day, as a result of they’re learning regarding you from you itself the additional you’re using it the more your smartphone gets to grasp you and every one of that’s simply the machine with lines of code evolving with time like humans. It’s not simply restricted to smartphones, it’s in-depth in technology.


      Purpose of this article?

      Nowadays every developer familiar with the term Machine Learning In this article, today we create a simple text detector from image application using Flutter and Firebase ML kit, also I explain all the steps in a simple manner so anybody can use the Firebase ML kit in a flutter project.

      If you don’t have a flutter set up in your machine so you have to need to install it first. Click here to learn how to set up flutter on Windows and for Linux click here.


      Create a Firebase Project

      For use firebase properties you have to need to register your app in firebase. First, integrate your flutter project to firebase, if you don’t know how to do it, read my Flutter Firebase Integration article.


      Let’s Begin for the code.


      • Add firebase_ml_vision and image_picker dependency in your project pubspec.yaml file.
      dependencies:
        flutter:
          sdk: flutter
        firebase_ml_vision: <latest_version>
        image_picker: <latest_version>
        translator: <latest_version>

      firebase_ml_vision: This dependency used for access Firebase ML kit.
      image_picker: This dependency used to pick an image.
      translator: This dependency used to convert the text into your language.


      • Add the below code in your main.dart file for import dependency.
      import 'package:image_picker/image_picker.dart';
      import 'package:firebase_ml_vision/firebase_ml_vision.dart';
      import 'package:translator/translator.dart';

      Now we are ready for Coding the component.

      Now we are ready to code the components, as in the below code I am taking image from the gallery, you can get from the camera also as you need, after getting the image we store all the text in List.


      Creating a variable which we have needed for code.


        bool _isImageLoaded = false;
        bool _isTextLoaded = false;
        String _text = "";
        File _pickedImage;

       Future<void> geTextImage() async {
          var tempStore = await ImagePicker.pickImage(source: ImageSource.gallery);
      
          setState(() {
            _pickedImage = tempStore;
            _isImageLoaded = true;
          });
      
          FirebaseVisionImage ourImage = FirebaseVisionImage.fromFile(_pickedImage);
          TextRecognizer recognizeText = FirebaseVision.instance.textRecognizer();
          VisionText readText = await recognizeText.processImage(ourImage);
          GoogleTranslator translator = GoogleTranslator();
      
          String input = readText.text;
      
          translator.translate(input, to: 'en').then((_translatedText) => {   
                setState(() {
                  _text = _translatedText;
                  _isTextLoaded = true;
                })
              });
        }

      Now call this function in your flutter application the same as calling other functions. You can modify the text language as you need, for change the language changes the parameter value “en” to another. i.e. to convert the text language write “hi” instead of “en”.


      Done
      Bookmark(0)

      Please login to bookmark

      Continue with Google
      0

      Tag:firebase text from image, firebase text recognition example, firebase text recognize, firebase vision text

      • Share:
      author avatar
      Shivam Srivastava

      Mobile Solution Architect@EnrichAI, Android and Flutter Dev, Dart ,Founder of @Navoki, Instructor

      Previous post

      Key features of Android 11 -BGR
      March 24, 2020

      Next post

      Open Street Map Using Flutter
      March 25, 2020

      You may also like

      everything-about-flutter-3-in-google-i-o-2022 navoki.com
      Everything about Flutter 3 in Google I/O 2022
      12 May, 2022
      Flutter-Web-CORS-Error-SOLVED-Navoki.com
      [SOLVED] Flutter Web CORS Error
      4 May, 2022
      How Video Call works in Flutter
      How Incoming Video Call Notification works in Flutter
      15 April, 2022


      Categories

      • Android
      • Dart
      • Dart Server
      • Dart Web
      • Developers
      • Flutter
      • Flutter Desktop
      • Flutter Mobile
      • Flutter Web
      • Fuchsia
      • Go Lang
      • Technology
      • Uncategorized

      Recent Post

      • Everything-About-Flutter-3-In-Google-I-O-2022 Navoki.comEverything about Flutter 3 in Google I/O 2022
      • Flutter-Web-Cors-Error-Solved-Navoki.com[SOLVED] Flutter Web CORS Error
      • How Video Call Works In FlutterHow Incoming Video Call Notification works in Flutter

      Subscribe Now

       

      Recent Courses

      Single And Multi Selection Listview In Flutter

      Single and Multi Selection ListView in Flutter

      Go Installation And Variables

      Go Installation and Variables

      List In Dart Programming Language

      List in Dart Programming language

      Variables In Dart Programming Language

      Variables in Dart Programming language

      View All

      DON’T MISS
      FLUTTER UPDATES

      Be the first to know when our blog is published.

      flutter-mobile-mockup

      Check your inbox or spam folder to confirm your subscription.

      Contact

      •   Navoki Technologies Pvt. Ltd.
        JMD Megapolis , Sector 48, Gurugram, Haryana 122018

      Company

      • About Us
      • Blogs
      • Contact
      • Privacy policy
      • Terms & Condition

      Useful Links

      • Courses
      • Youtube
      • Dev News

      Mobile

      Click and Get started in seconds

      "Navoki" is a registered trademark of Navoki.com ® 2020–2030 Navoki Technologies Pvt Ltd.

      • Terms & Condition

      Login with your site account

      Continue with Google

      By "Sign in” above to accept Navoki’s Terms of Service & Privacy Policy.

      Not a member yet? Register now

      Register a new account

      Continue with Google

      By "Sign Up” above to accept Navoki’s Terms of Service & Privacy Policy.

      Are you a member? Login now