Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 22.4 ('Spy On Your Variables')
Instant purchase and download via GumRoad!

COLUMN

Text Recognition

Using Apple's Vision to Extract Text from an Image

Issue: 22.4 (July/August 2024)
Author: Stefanie Juchmes-Simonis
Author Bio: Stefanie studied computer science at the university in Bonn. She came in touch with Xojo due to the work of her brother-in-law and got a junior developer position in early 2019 at Monkeybread Software.
Article Description: No description available.
Article Length (in bytes): 11,269
Starting Page Number: 55
Article Number: 22408
Resource File(s):

Download Icon project224008.zip Updated: 2024-07-01 10:15:42

Related Web Link(s):

http://xdevmag.com/browse/21.3/21304/

Excerpt of article text...

In a previous article in xDev 21.3, I showed you how you can recognize text under Windows using the built-in OCR functions (http://xdevmag.com/browse/21.3/21304/). Now I would like to show you how you can also work with Mac and iOS using Apple's Vision built-in functions and the MBS Plugins.

You are probably already familiar with Vision from text recognition on your iPhone or Mac if you have an image with text printed on it. You can also use this technology in Xojo with the MBS plugin. Vision can do a bit more than just recognize text, because it can also recognize barcodes or assign images to a specific category. But perhaps more about that in a later Spotlight. Today we would like to concentrate fully on text recognition in an image (see Figure 1).

First of all, we have to load the image from where we want to recognize the text into our program. To do this, we used an Open dialog that is located behind the "Load Image" button. After we have loaded our image as a folderitem, this folderitem is passed to a method that we will write up ourselves in a moment. We call this method VisionOCR.

In this method, we first open our folderitem and write our image to a variable of type Picture. We now want to continue working with this data type.

Dim pic As Picture = Picture.Open(f)

...End of Excerpt. Please purchase the magazine to read the full article.