Article Preview
Buy Now
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):
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 afolderitem
, thisfolderitem
is passed to a method that we will write up ourselves in a moment. We call this methodVisionOCR
.In this method, we first open our
folderitem
and write our image to a variable of typePicture
. 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.