https://github.com/miyako/4d-plugin-microsoft-ocr
Use native OCR on Windows.
https://github.com/miyako/4d-plugin-microsoft-ocr
4d-plugin ocr winrt
Last synced: 11 months ago
JSON representation
Use native OCR on Windows.
- Host: GitHub
- URL: https://github.com/miyako/4d-plugin-microsoft-ocr
- Owner: miyako
- License: mit
- Created: 2021-01-03T15:41:43.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-03T23:48:05.000Z (about 5 years ago)
- Last Synced: 2025-01-08T17:57:09.659Z (about 1 year ago)
- Topics: 4d-plugin, ocr, winrt
- Language: C
- Homepage:
- Size: 3.08 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README


[](LICENSE)

# 4d-plugin-microsoft-ocr
Use native OCR on Windows.
Thanks to [C++/WinRT](https://blogs.windows.com/windowsdeveloper/2016/11/28/standard-c-windows-runtime-cwinrt/), it is no longer necessary to use all sorts of [tricks](https://qiita.com/Yukio-Ichikawa/items/f8d3111a60a337adfd48) to call [Universal Windows Platform](https://en.wikipedia.org/wiki/Universal_Windows_Platform) API from C++.
This plugin is using the [Windows.Media.Ocr](https://docs.microsoft.com/en-us/uwp/api/Windows.Media.Ocr?view=winrt-19041) API.
#### Visual Studio 2017
To enable `co_await`
* add the compiler flag `/await` to project
* set the c++ language standard to `ISO C++ Latest Draft Standard (/std:c++latest)`
* add `windowsapp.lib` to additional libraries
The project requires `10.0.17763` SDK, released in conjunction with Windows 10 version 1809.
To use on v17, move manifest.json to contents.
#### Example
```4d
$file:=Folder:C1567(fk resources folder:K87:11).file("4d-website-jpr.jpg")
$data:=$file.getContent()
$status:=ocr get text ($data)
```


#### References
* [Consume APIs with C++/WinRT](https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/consume-apis)
* [More advanced concurrency and asynchrony with C++/WinRT](https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/concurrency-2)