質問編集履歴
1
コード追加
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
PDF等の画像の文字の文字サイズを取得す
|
1
|
+
PDF等の画像の文字の文字サイズを取得できず困っています
|
body
CHANGED
@@ -5,5 +5,36 @@
|
|
5
5
|
|
6
6
|
使用したocrはpyocrです。
|
7
7
|
|
8
|
+
文字認識で試したソース一応載せておきます。
|
9
|
+
何の文字なのかまでは認識できてませんが動いたものです。
|
10
|
+
|
11
|
+
このソースに修正や追加を行って対応可能でしょうか?
|
12
|
+
|
13
|
+
|
14
|
+
```python
|
15
|
+
|
16
|
+
from PIL import Image
|
17
|
+
import sys
|
18
|
+
import pyocr
|
19
|
+
import pyocr.builders
|
20
|
+
|
21
|
+
tools = pyocr.get_available_tools()
|
22
|
+
if len(tools) == 0:
|
23
|
+
print("No OCR tool found")
|
24
|
+
sys.exit(1)
|
25
|
+
# The tools are returned in the recommended order of usage
|
26
|
+
tool = tools[0]
|
27
|
+
|
28
|
+
txt = tool.image_to_string(
|
29
|
+
Image.open('D:/sample.png'),
|
30
|
+
lang="jpn+eng",
|
31
|
+
builder=pyocr.builders.TextBuilder(tesseract_layout=6)
|
32
|
+
)
|
33
|
+
|
34
|
+
print(txt)
|
35
|
+
|
36
|
+
```
|
37
|
+
|
38
|
+
|
8
39
|
やり方が分かる方、是非教えていただければ幸いです。
|
9
40
|
何卒宜しくお願い申し上げます。
|