‫Hello, my friends.
‫In the previous videos we have created these methods and we have talked about the capture image method.
‫The last method that we are going to configure and create is that detect text.
‫So inside this detect method, when the user select the image correctly, after granting the permission
‫for requesting the camera access, we need to detect the text inside this image.
‫So we start by input image input image which is from the Google.
‫From the Google Dot meal kit.
‫So you can see here if we see four or requesting the input image here.
‫Input image google dot ml dot vision dot com on the input image.
‫So this is the input image.
‫This is the image that we need to analyze.
‫So input image from bitmap image, bitmap and Z.
‫This is the rotation degrees text recognizer
‫recognizer and plus enter to import the package equal to text recognition.
‫You get client and text recognition
‫and you can see here we can use the text recognizer
‫recog nicer options dot default options.
‫I prefer using the default options task of text a result equal to recognizer dot process the image that
‫I have passed to you.
‫So the add on success listener.
‫On Success Listener.
‫New on Success Listener.
‫And here.
‫We have selected this.
‫And I will make the text here.
‫Okay.
‫I can.
‫Do it on success.
‫Listener I prefer using the text and string.
‫I really do.
‫I keep it as if they understand it.
‫String builder.
‫A result.
‫Equal to new string builder.
‫Now I will loop through all the text to in order inside this image in order to display it.
‫So for text.
‫Dot text.
‫BLOCK or this text
‫is the text.
‫BLOCK.
‫I will remove the scum that Google and I will remove the still here.
‫Text.
‫Text block.
‫Here.
‫Text dot.
‫Text block.
‫I have imported this text.
‫Let me check up.
‫Up.
‫I have imported the wrong.
‫You see, guys, I have imported the wrong package, so l plus enter to import the m l kit and not the
‫org the w3c dom.
‫I will import this oc so.
‫Four text dot.
‫Text dot.
‫Text block.
‫Love every side.
‫Everything inside the block.
‫Text dot.
‫Get text blocks.
‫Then what we will do.
‫We will do by making a string block.
‫Text equal to block dot.
‫BLOCK the get text.
‫We start by getting the text, then I will make a point array here called the block coordinate point
‫equal to block to get corner points and then a rectangle rect.
‫Look frame
‫equal to block dot get bounding box plus enter to import it and inside this for loop I will make another
‫nested for loop text dot text dot line text dot line
‫inside the Google package block and get the lines.
‫You see guys how we are making these as simply by recognizing every block, every simple and every single
‫line inside the captured image and transform it into the the text that we need to be extracted inside
‫the image, the text view.
‫So string line text equal to line dot get text.
‫We are getting the text inside the lines and another point array will be configured line coordinate
‫point coordinate point would be created getting the coordinate points.
‫We are analyzing every segment inside this image.
‫Rect
‫line rect equal to line dot get bounding box another nested loop.
‫Inside this nested loop I will make a text dot element and I will start by by getting and looping through
‫all the elements of this.
‫The text element line dot get elements
‫string element text equal to element to get.
‫Text result
‫dot append.
‫Element text.
‫Then we will use the result of text to view the set text to block text.
‫Here we are displaying the results.
‫Displaying the results.
‫Okay.
‫So.
‫We go down to here.
‫Add on failure.
‫Listener New on failure.
‫Listener Toast a message and get application context and what we will display a text called failed to
‫detect text from image.
‫And here we go.
‫This is very simple.
‫We have done it.
‫Now let's start start making all of these running into the app, into a real app.
‫So I will run this application into my real phone.