Sunday, December 4, 2022

#1 2022-10-03 07:48:04 am

Fredrik71
Member
Registered: 2019-10-23
Posts: 1091

Capture text from image

Simple example of using capture text on image...
The credit goes to https://github.com/schappim/macOCR

You need ocr command you could compile it with Xcode.

This example will open an tab in Safari to display a image of Whisky bottle.
Capture the text on the bottle and it will show: CHIVAS REGAL 12

I do not think it would be possible to do it in AppleScriptObjC, the code use vision framework
but maybe there is other solutions.

Applescript:

tell application "Safari" to tell front window
   set current tab to (make new tab with properties {URL:"https://unsplash.com/photos/ujxHGISveak"})
end tell

do shell script "/usr/local/bin/ocr"

set captureText to (the clipboard) as text
display dialog captureText


Node-RED makes it easy to automate IoT

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)