fasdfsa commited on
Commit
0f5e3b4
·
1 Parent(s): 1779b47

json img 在当前打开图片的路径下找

Browse files
.gitattributes CHANGED
@@ -1,6 +1,6 @@
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.pdf filter=lfs diff=lfs merge=lfs -text
3
- data/img/*.txt filter=lfs diff=lfs merge=lfs -text
4
  src/WeChatOcrCpp/wco_data/**/* filter=lfs diff=lfs merge=lfs -text
5
  *.aps filter=lfs diff=lfs merge=lfs -text
6
  *.ico filter=lfs diff=lfs merge=lfs -text
 
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.pdf filter=lfs diff=lfs merge=lfs -text
3
+ **/data/img/*.txt filter=lfs diff=lfs merge=lfs -text
4
  src/WeChatOcrCpp/wco_data/**/* filter=lfs diff=lfs merge=lfs -text
5
  *.aps filter=lfs diff=lfs merge=lfs -text
6
  *.ico filter=lfs diff=lfs merge=lfs -text
pdfs/jp/高木直子学日语文法不要想太多/data/img/5e192ee8257d16e00dea6cb9f9a317e9.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbefe28054dff54eab453efa9eefbbaadd9f2016334cfe9d6130805e0eca35ff
3
+ size 758388
pdfs/jp/高木直子学日语文法不要想太多/data/json/5e192ee8257d16e00dea6cb9f9a317e9.json ADDED
@@ -0,0 +1,1206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "width": 1535,
3
+ "height": 2352,
4
+ "prism_wordsInfo": [
5
+ {
6
+ "word": "も分かる",
7
+ "prob": 0.9290181398391724,
8
+ "x": 1328,
9
+ "y": 179,
10
+ "width": 203,
11
+ "height": 63,
12
+ "pos": [
13
+ {
14
+ "x": 1328,
15
+ "y": 179
16
+ },
17
+ {
18
+ "x": 1531,
19
+ "y": 179
20
+ },
21
+ {
22
+ "x": 1531,
23
+ "y": 242
24
+ },
25
+ {
26
+ "x": 1328,
27
+ "y": 242
28
+ }
29
+ ],
30
+ "charInfo": [
31
+ {
32
+ "h": 63,
33
+ "w": 48,
34
+ "word": "も",
35
+ "x": 1327,
36
+ "y": 195,
37
+ "guid": "ab74c7ce-3ff2-41e9-9597-7dafbdd31e58",
38
+ "isDeleted": 0
39
+ },
40
+ {
41
+ "h": 63,
42
+ "w": 53,
43
+ "word": "分",
44
+ "x": 1375,
45
+ "y": 191,
46
+ "guid": "a99644e5-dbd1-4b3a-9e54-a9e8a20758e6",
47
+ "isDeleted": 0
48
+ },
49
+ {
50
+ "h": 63,
51
+ "w": 53,
52
+ "word": "か",
53
+ "x": 1428,
54
+ "y": 187,
55
+ "guid": "035ec4ea-0f2f-4923-8581-af61362e393a",
56
+ "isDeleted": 0
57
+ },
58
+ {
59
+ "h": 63,
60
+ "w": 50,
61
+ "word": "る",
62
+ "x": 1481,
63
+ "y": 183,
64
+ "guid": "491abebe-56bb-4245-b802-35ce9bbca5ba",
65
+ "isDeleted": 0
66
+ }
67
+ ]
68
+ },
69
+ {
70
+ "word": "学日语文造",
71
+ "prob": 0.48906731605529785,
72
+ "x": 20,
73
+ "y": 245,
74
+ "width": 1514,
75
+ "height": 677,
76
+ "pos": [
77
+ {
78
+ "x": 20,
79
+ "y": 245
80
+ },
81
+ {
82
+ "x": 1534,
83
+ "y": 245
84
+ },
85
+ {
86
+ "x": 1534,
87
+ "y": 922
88
+ },
89
+ {
90
+ "x": 20,
91
+ "y": 922
92
+ }
93
+ ],
94
+ "charInfo": [
95
+ {
96
+ "h": 677,
97
+ "w": 266,
98
+ "word": "学",
99
+ "x": 73,
100
+ "y": 245,
101
+ "guid": "d69f757d-63c3-433b-8443-9c252f740454",
102
+ "isDeleted": 0
103
+ },
104
+ {
105
+ "h": 677,
106
+ "w": 199,
107
+ "word": "日",
108
+ "x": 339,
109
+ "y": 272,
110
+ "guid": "fa56c470-487a-413d-a01c-5ee398b5327d",
111
+ "isDeleted": 0
112
+ },
113
+ {
114
+ "h": 677,
115
+ "w": 266,
116
+ "word": "语",
117
+ "x": 538,
118
+ "y": 292,
119
+ "guid": "87432838-c25f-4f9c-9c58-f5960052ade6",
120
+ "isDeleted": 0
121
+ },
122
+ {
123
+ "h": 677,
124
+ "w": 265,
125
+ "word": "文",
126
+ "x": 804,
127
+ "y": 318,
128
+ "guid": "027f5799-4616-4b50-a354-79b40ab357ca",
129
+ "isDeleted": 0
130
+ },
131
+ {
132
+ "h": 677,
133
+ "w": 465,
134
+ "word": "造",
135
+ "x": 1069,
136
+ "y": 345,
137
+ "guid": "e941c62e-fd61-4759-96ca-daddddeea9ca",
138
+ "isDeleted": 0
139
+ }
140
+ ]
141
+ },
142
+ {
143
+ "word": "不要想太之",
144
+ "prob": 0.8675351142883301,
145
+ "x": 149,
146
+ "y": 798,
147
+ "width": 1354,
148
+ "height": 481,
149
+ "pos": [
150
+ {
151
+ "x": 149,
152
+ "y": 798
153
+ },
154
+ {
155
+ "x": 1503,
156
+ "y": 798
157
+ },
158
+ {
159
+ "x": 1503,
160
+ "y": 1279
161
+ },
162
+ {
163
+ "x": 149,
164
+ "y": 1279
165
+ }
166
+ ],
167
+ "charInfo": [
168
+ {
169
+ "h": 481,
170
+ "w": 195,
171
+ "word": "不",
172
+ "x": 176,
173
+ "y": 797,
174
+ "guid": "de9ea5ca-7d0a-4c81-b380-bb93a28cd07e",
175
+ "isDeleted": 0
176
+ },
177
+ {
178
+ "h": 481,
179
+ "w": 243,
180
+ "word": "要",
181
+ "x": 371,
182
+ "y": 811,
183
+ "guid": "cd455d41-485d-4d1c-8d22-12a67e898227",
184
+ "isDeleted": 0
185
+ },
186
+ {
187
+ "h": 481,
188
+ "w": 244,
189
+ "word": "想",
190
+ "x": 614,
191
+ "y": 828,
192
+ "guid": "d3de30d5-0b19-464c-89e3-7b3975130710",
193
+ "isDeleted": 0
194
+ },
195
+ {
196
+ "h": 481,
197
+ "w": 243,
198
+ "word": "太",
199
+ "x": 858,
200
+ "y": 846,
201
+ "guid": "920bd691-2e92-45d3-9a5a-c95d2d818807",
202
+ "isDeleted": 0
203
+ },
204
+ {
205
+ "h": 481,
206
+ "w": 402,
207
+ "word": "之",
208
+ "x": 1101,
209
+ "y": 863,
210
+ "guid": "5dbae413-6395-42c4-9bb2-f710f81602be",
211
+ "isDeleted": 0
212
+ }
213
+ ]
214
+ },
215
+ {
216
+ "word": "日本語の文法をl",
217
+ "prob": 0.9396494626998901,
218
+ "x": 545,
219
+ "y": 381,
220
+ "width": 395,
221
+ "height": 151,
222
+ "pos": [
223
+ {
224
+ "x": 545,
225
+ "y": 381
226
+ },
227
+ {
228
+ "x": 940,
229
+ "y": 381
230
+ },
231
+ {
232
+ "x": 940,
233
+ "y": 532
234
+ },
235
+ {
236
+ "x": 545,
237
+ "y": 532
238
+ }
239
+ ],
240
+ "charInfo": [
241
+ {
242
+ "h": 151,
243
+ "w": 40,
244
+ "word": "日",
245
+ "x": 545,
246
+ "y": 467,
247
+ "guid": "daa4a13f-ac17-4247-a7fd-e3fe4427199a",
248
+ "isDeleted": 0
249
+ },
250
+ {
251
+ "h": 151,
252
+ "w": 49,
253
+ "word": "本",
254
+ "x": 585,
255
+ "y": 458,
256
+ "guid": "aff35d16-2a9c-418b-912b-cdf9c8ea6aaa",
257
+ "isDeleted": 0
258
+ },
259
+ {
260
+ "h": 151,
261
+ "w": 48,
262
+ "word": "語",
263
+ "x": 634,
264
+ "y": 447,
265
+ "guid": "b70bf3b4-c431-4d68-bce3-c6fa55e0f28f",
266
+ "isDeleted": 0
267
+ },
268
+ {
269
+ "h": 151,
270
+ "w": 57,
271
+ "word": "の",
272
+ "x": 682,
273
+ "y": 436,
274
+ "guid": "3d0bd481-2450-45c1-9bbb-aad7afc80407",
275
+ "isDeleted": 0
276
+ },
277
+ {
278
+ "h": 151,
279
+ "w": 40,
280
+ "word": "文",
281
+ "x": 739,
282
+ "y": 423,
283
+ "guid": "147ddd89-4608-4657-8395-ff46b3727568",
284
+ "isDeleted": 0
285
+ },
286
+ {
287
+ "h": 151,
288
+ "w": 57,
289
+ "word": "法",
290
+ "x": 779,
291
+ "y": 414,
292
+ "guid": "ef135820-c50e-4741-ac9b-271647aeb40d",
293
+ "isDeleted": 0
294
+ },
295
+ {
296
+ "h": 151,
297
+ "w": 56,
298
+ "word": "を",
299
+ "x": 836,
300
+ "y": 401,
301
+ "guid": "63bc11e7-8a5f-4c14-bd9d-fc9bb5870b5b",
302
+ "isDeleted": 0
303
+ },
304
+ {
305
+ "h": 151,
306
+ "w": 48,
307
+ "word": "l",
308
+ "x": 892,
309
+ "y": 388,
310
+ "guid": "0d75c2fa-7177-44f2-9efc-e358ec78c55d",
311
+ "isDeleted": 0
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "word": "著◎高木直子",
317
+ "prob": 0.8583791255950928,
318
+ "x": 102,
319
+ "y": 1572,
320
+ "width": 359,
321
+ "height": 69,
322
+ "pos": [
323
+ {
324
+ "x": 102,
325
+ "y": 1572
326
+ },
327
+ {
328
+ "x": 461,
329
+ "y": 1572
330
+ },
331
+ {
332
+ "x": 461,
333
+ "y": 1641
334
+ },
335
+ {
336
+ "x": 102,
337
+ "y": 1641
338
+ }
339
+ ],
340
+ "charInfo": [
341
+ {
342
+ "h": 69,
343
+ "w": 49,
344
+ "word": "著",
345
+ "x": 103,
346
+ "y": 1572,
347
+ "guid": "8a075697-8989-41c0-aaac-efb52bfe5ac7",
348
+ "isDeleted": 0
349
+ },
350
+ {
351
+ "h": 69,
352
+ "w": 57,
353
+ "word": "◎",
354
+ "x": 152,
355
+ "y": 1572,
356
+ "guid": "2ee334bc-2ea7-4d90-bb5a-2386e019549b",
357
+ "isDeleted": 0
358
+ },
359
+ {
360
+ "h": 69,
361
+ "w": 57,
362
+ "word": "高",
363
+ "x": 209,
364
+ "y": 1573,
365
+ "guid": "d782f9fb-de03-4066-9999-7d2db0b35b74",
366
+ "isDeleted": 0
367
+ },
368
+ {
369
+ "h": 69,
370
+ "w": 57,
371
+ "word": "木",
372
+ "x": 266,
373
+ "y": 1573,
374
+ "guid": "eb0c8856-2238-4539-bc6f-256a3f38818b",
375
+ "isDeleted": 0
376
+ },
377
+ {
378
+ "h": 69,
379
+ "w": 58,
380
+ "word": "直",
381
+ "x": 323,
382
+ "y": 1574,
383
+ "guid": "ade4bc6c-73da-4a68-b66e-5268ca87f98f",
384
+ "isDeleted": 0
385
+ },
386
+ {
387
+ "h": 69,
388
+ "w": 80,
389
+ "word": "子",
390
+ "x": 381,
391
+ "y": 1574,
392
+ "guid": "84349c98-228e-47a1-b7c5-c4edb9820b6e",
393
+ "isDeleted": 0
394
+ }
395
+ ]
396
+ },
397
+ {
398
+ "word": "日语能力考试3级文法、生",
399
+ "prob": 0.9915241599082947,
400
+ "x": 54,
401
+ "y": 1676,
402
+ "width": 453,
403
+ "height": 39,
404
+ "pos": [
405
+ {
406
+ "x": 54,
407
+ "y": 1676
408
+ },
409
+ {
410
+ "x": 507,
411
+ "y": 1676
412
+ },
413
+ {
414
+ "x": 507,
415
+ "y": 1715
416
+ },
417
+ {
418
+ "x": 54,
419
+ "y": 1715
420
+ }
421
+ ],
422
+ "charInfo": [
423
+ {
424
+ "h": 39,
425
+ "w": 30,
426
+ "word": "日",
427
+ "x": 53,
428
+ "y": 1675,
429
+ "guid": "74a17848-400b-4e6e-9ddb-892931196f9e",
430
+ "isDeleted": 0
431
+ },
432
+ {
433
+ "h": 39,
434
+ "w": 39,
435
+ "word": "语",
436
+ "x": 83,
437
+ "y": 1675,
438
+ "guid": "f4a3f3cc-9ce4-4f27-939c-9cbef8c31cce",
439
+ "isDeleted": 0
440
+ },
441
+ {
442
+ "h": 39,
443
+ "w": 34,
444
+ "word": "能",
445
+ "x": 122,
446
+ "y": 1675,
447
+ "guid": "8cbe284a-cd44-4d21-ac19-5d94c44d27df",
448
+ "isDeleted": 0
449
+ },
450
+ {
451
+ "h": 39,
452
+ "w": 39,
453
+ "word": "力",
454
+ "x": 156,
455
+ "y": 1675,
456
+ "guid": "01d70b32-e4c9-4e35-9065-e5f0a67a92b0",
457
+ "isDeleted": 0
458
+ },
459
+ {
460
+ "h": 39,
461
+ "w": 39,
462
+ "word": "考",
463
+ "x": 195,
464
+ "y": 1675,
465
+ "guid": "dcc97f34-6f06-49c0-9fd7-7696cf2ceb3a",
466
+ "isDeleted": 0
467
+ },
468
+ {
469
+ "h": 39,
470
+ "w": 44,
471
+ "word": "试",
472
+ "x": 234,
473
+ "y": 1675,
474
+ "guid": "d718af5d-940e-4deb-af50-10e06c533374",
475
+ "isDeleted": 0
476
+ },
477
+ {
478
+ "h": 39,
479
+ "w": 20,
480
+ "word": "3",
481
+ "x": 278,
482
+ "y": 1675,
483
+ "guid": "7f54fdb9-1d2a-417d-8658-eeffb6aa8e8d",
484
+ "isDeleted": 0
485
+ },
486
+ {
487
+ "h": 39,
488
+ "w": 39,
489
+ "word": "级",
490
+ "x": 298,
491
+ "y": 1675,
492
+ "guid": "91b9b214-ebb6-41a7-9c94-964523a89243",
493
+ "isDeleted": 0
494
+ },
495
+ {
496
+ "h": 39,
497
+ "w": 34,
498
+ "word": "文",
499
+ "x": 337,
500
+ "y": 1675,
501
+ "guid": "b1faa18b-3414-4ce4-be99-a55c40f7b8dd",
502
+ "isDeleted": 0
503
+ },
504
+ {
505
+ "h": 39,
506
+ "w": 39,
507
+ "word": "法",
508
+ "x": 371,
509
+ "y": 1675,
510
+ "guid": "8d428034-a45b-4c79-88fd-76d17c08230f",
511
+ "isDeleted": 0
512
+ },
513
+ {
514
+ "h": 39,
515
+ "w": 39,
516
+ "word": "、",
517
+ "x": 410,
518
+ "y": 1675,
519
+ "guid": "8c8a1c74-dce9-47b4-8ca0-5b6309f1c4f2",
520
+ "isDeleted": 0
521
+ },
522
+ {
523
+ "h": 39,
524
+ "w": 58,
525
+ "word": "生",
526
+ "x": 449,
527
+ "y": 1675,
528
+ "guid": "50d98b62-6f90-49fc-8ffd-cc166e8d44f5",
529
+ "isDeleted": 0
530
+ }
531
+ ]
532
+ },
533
+ {
534
+ "word": "出差皆适用!",
535
+ "prob": 0.9982583522796631,
536
+ "x": 51,
537
+ "y": 1747,
538
+ "width": 212,
539
+ "height": 48,
540
+ "pos": [
541
+ {
542
+ "x": 51,
543
+ "y": 1747
544
+ },
545
+ {
546
+ "x": 263,
547
+ "y": 1747
548
+ },
549
+ {
550
+ "x": 263,
551
+ "y": 1795
552
+ },
553
+ {
554
+ "x": 51,
555
+ "y": 1795
556
+ }
557
+ ],
558
+ "charInfo": [
559
+ {
560
+ "h": 48,
561
+ "w": 35,
562
+ "word": "出",
563
+ "x": 52,
564
+ "y": 1746,
565
+ "guid": "3fbf6d4b-afd0-44b1-9c8c-baf8a144d884",
566
+ "isDeleted": 0
567
+ },
568
+ {
569
+ "h": 48,
570
+ "w": 35,
571
+ "word": "差",
572
+ "x": 87,
573
+ "y": 1748,
574
+ "guid": "44a59e0b-5497-4310-9b75-3592af3ec059",
575
+ "isDeleted": 0
576
+ },
577
+ {
578
+ "h": 48,
579
+ "w": 35,
580
+ "word": "皆",
581
+ "x": 122,
582
+ "y": 1749,
583
+ "guid": "4b5e867c-75f6-491b-afe6-e4812d2b3b9b",
584
+ "isDeleted": 0
585
+ },
586
+ {
587
+ "h": 48,
588
+ "w": 40,
589
+ "word": "适",
590
+ "x": 157,
591
+ "y": 1750,
592
+ "guid": "120a73fe-bb34-48a3-b5c8-d3c0df577b5a",
593
+ "isDeleted": 0
594
+ },
595
+ {
596
+ "h": 48,
597
+ "w": 40,
598
+ "word": "用",
599
+ "x": 197,
600
+ "y": 1751,
601
+ "guid": "0bec470e-53be-4f9e-89a9-c67e4b4a144b",
602
+ "isDeleted": 0
603
+ },
604
+ {
605
+ "h": 48,
606
+ "w": 26,
607
+ "word": "!",
608
+ "x": 237,
609
+ "y": 1753,
610
+ "guid": "b97705af-766a-4b0a-9b1d-79ac04413af5",
611
+ "isDeleted": 0
612
+ }
613
+ ]
614
+ },
615
+ {
616
+ "word": "常用文法轻松学!活泼漫画助您学!",
617
+ "prob": 0.9993516206741333,
618
+ "x": 51,
619
+ "y": 1825,
620
+ "width": 596,
621
+ "height": 42,
622
+ "pos": [
623
+ {
624
+ "x": 51,
625
+ "y": 1825
626
+ },
627
+ {
628
+ "x": 647,
629
+ "y": 1825
630
+ },
631
+ {
632
+ "x": 647,
633
+ "y": 1867
634
+ },
635
+ {
636
+ "x": 51,
637
+ "y": 1867
638
+ }
639
+ ],
640
+ "charInfo": [
641
+ {
642
+ "h": 42,
643
+ "w": 31,
644
+ "word": "常",
645
+ "x": 51,
646
+ "y": 1825,
647
+ "guid": "42f259d8-ee32-4127-8cee-64881548aeff",
648
+ "isDeleted": 0
649
+ },
650
+ {
651
+ "h": 42,
652
+ "w": 36,
653
+ "word": "用",
654
+ "x": 82,
655
+ "y": 1825,
656
+ "guid": "4df7b345-d327-423a-b2b5-418471bc98ef",
657
+ "isDeleted": 0
658
+ },
659
+ {
660
+ "h": 42,
661
+ "w": 36,
662
+ "word": "文",
663
+ "x": 118,
664
+ "y": 1825,
665
+ "guid": "cc71fcab-078c-4061-97f3-d8b95437cd4b",
666
+ "isDeleted": 0
667
+ },
668
+ {
669
+ "h": 42,
670
+ "w": 36,
671
+ "word": "法",
672
+ "x": 154,
673
+ "y": 1825,
674
+ "guid": "ac6e141f-f190-4c77-9c69-c555fc51905e",
675
+ "isDeleted": 0
676
+ },
677
+ {
678
+ "h": 42,
679
+ "w": 41,
680
+ "word": "轻",
681
+ "x": 190,
682
+ "y": 1825,
683
+ "guid": "4ff6d691-1103-4a2e-b9ea-ebfe66d7166f",
684
+ "isDeleted": 0
685
+ },
686
+ {
687
+ "h": 42,
688
+ "w": 36,
689
+ "word": "松",
690
+ "x": 231,
691
+ "y": 1825,
692
+ "guid": "0eb2fd53-0829-40c3-aa32-82f005769640",
693
+ "isDeleted": 0
694
+ },
695
+ {
696
+ "h": 42,
697
+ "w": 56,
698
+ "word": "学",
699
+ "x": 267,
700
+ "y": 1825,
701
+ "guid": "6006168a-e6d8-46f8-9032-0b91fe8c5a20",
702
+ "isDeleted": 0
703
+ },
704
+ {
705
+ "h": 42,
706
+ "w": 20,
707
+ "word": "!",
708
+ "x": 323,
709
+ "y": 1825,
710
+ "guid": "ab1fc6fb-4b1c-452e-be32-febf48c33723",
711
+ "isDeleted": 0
712
+ },
713
+ {
714
+ "h": 42,
715
+ "w": 36,
716
+ "word": "活",
717
+ "x": 343,
718
+ "y": 1825,
719
+ "guid": "9627c80b-0fc5-429d-915e-466e77d6dadd",
720
+ "isDeleted": 0
721
+ },
722
+ {
723
+ "h": 42,
724
+ "w": 36,
725
+ "word": "泼",
726
+ "x": 379,
727
+ "y": 1825,
728
+ "guid": "73533f6e-9ab2-4f46-8590-764b3ec7c23f",
729
+ "isDeleted": 0
730
+ },
731
+ {
732
+ "h": 42,
733
+ "w": 41,
734
+ "word": "漫",
735
+ "x": 415,
736
+ "y": 1825,
737
+ "guid": "8aeeef20-c50c-4d49-b041-5528dbe0a423",
738
+ "isDeleted": 0
739
+ },
740
+ {
741
+ "h": 42,
742
+ "w": 36,
743
+ "word": "画",
744
+ "x": 456,
745
+ "y": 1825,
746
+ "guid": "ad5d68d8-e458-4f6e-bda9-ef0499f1e99e",
747
+ "isDeleted": 0
748
+ },
749
+ {
750
+ "h": 42,
751
+ "w": 36,
752
+ "word": "助",
753
+ "x": 492,
754
+ "y": 1825,
755
+ "guid": "3103c49c-ec18-4b67-8d7e-0a8f0607b239",
756
+ "isDeleted": 0
757
+ },
758
+ {
759
+ "h": 42,
760
+ "w": 41,
761
+ "word": "您",
762
+ "x": 528,
763
+ "y": 1825,
764
+ "guid": "5df18dfb-bc08-405b-8690-363a90a1172a",
765
+ "isDeleted": 0
766
+ },
767
+ {
768
+ "h": 42,
769
+ "w": 52,
770
+ "word": "学",
771
+ "x": 569,
772
+ "y": 1825,
773
+ "guid": "cf399677-858f-491c-8866-26aa3459ed16",
774
+ "isDeleted": 0
775
+ },
776
+ {
777
+ "h": 42,
778
+ "w": 26,
779
+ "word": "!",
780
+ "x": 621,
781
+ "y": 1825,
782
+ "guid": "760d65d7-1b4f-4366-a018-b98cd73b4abd",
783
+ "isDeleted": 0
784
+ }
785
+ ]
786
+ },
787
+ {
788
+ "word": "趣味逗人开心学!满怀信心加油学!",
789
+ "prob": 0.9988287687301636,
790
+ "x": 49,
791
+ "y": 1898,
792
+ "width": 600,
793
+ "height": 47,
794
+ "pos": [
795
+ {
796
+ "x": 49,
797
+ "y": 1898
798
+ },
799
+ {
800
+ "x": 649,
801
+ "y": 1898
802
+ },
803
+ {
804
+ "x": 649,
805
+ "y": 1945
806
+ },
807
+ {
808
+ "x": 49,
809
+ "y": 1945
810
+ }
811
+ ],
812
+ "charInfo": [
813
+ {
814
+ "h": 47,
815
+ "w": 30,
816
+ "word": "趣",
817
+ "x": 49,
818
+ "y": 1898,
819
+ "guid": "1ee572f3-0ba8-49f1-94a7-c9d05aad6e1a",
820
+ "isDeleted": 0
821
+ },
822
+ {
823
+ "h": 47,
824
+ "w": 36,
825
+ "word": "味",
826
+ "x": 79,
827
+ "y": 1898,
828
+ "guid": "b499103e-3eef-4587-aca6-8d93cdb08977",
829
+ "isDeleted": 0
830
+ },
831
+ {
832
+ "h": 47,
833
+ "w": 41,
834
+ "word": "逗",
835
+ "x": 115,
836
+ "y": 1898,
837
+ "guid": "14950231-a860-4afd-ae12-1f7ba8186557",
838
+ "isDeleted": 0
839
+ },
840
+ {
841
+ "h": 47,
842
+ "w": 36,
843
+ "word": "人",
844
+ "x": 156,
845
+ "y": 1899,
846
+ "guid": "d4e2302e-536d-4bfd-b0f3-3e2b7c0151a0",
847
+ "isDeleted": 0
848
+ },
849
+ {
850
+ "h": 47,
851
+ "w": 36,
852
+ "word": "开",
853
+ "x": 192,
854
+ "y": 1899,
855
+ "guid": "a77a404b-4c7b-4444-b6e3-3d9a08eb7c4d",
856
+ "isDeleted": 0
857
+ },
858
+ {
859
+ "h": 47,
860
+ "w": 41,
861
+ "word": "心",
862
+ "x": 228,
863
+ "y": 1899,
864
+ "guid": "d90db7f3-2b0c-42ef-b824-e33bdb3e6be2",
865
+ "isDeleted": 0
866
+ },
867
+ {
868
+ "h": 47,
869
+ "w": 52,
870
+ "word": "学",
871
+ "x": 269,
872
+ "y": 1900,
873
+ "guid": "cde02775-0c40-42aa-857b-cee95b06d0ec",
874
+ "isDeleted": 0
875
+ },
876
+ {
877
+ "h": 47,
878
+ "w": 25,
879
+ "word": "!",
880
+ "x": 321,
881
+ "y": 1900,
882
+ "guid": "01c371a2-deb9-448c-a949-07f1772a29e1",
883
+ "isDeleted": 0
884
+ },
885
+ {
886
+ "h": 47,
887
+ "w": 31,
888
+ "word": "满",
889
+ "x": 346,
890
+ "y": 1900,
891
+ "guid": "67fa860c-f8ad-491b-9e3a-2f12f4fe4d9e",
892
+ "isDeleted": 0
893
+ },
894
+ {
895
+ "h": 47,
896
+ "w": 41,
897
+ "word": "怀",
898
+ "x": 377,
899
+ "y": 1901,
900
+ "guid": "0d319c46-e261-47ee-a535-a649ba9abb9c",
901
+ "isDeleted": 0
902
+ },
903
+ {
904
+ "h": 47,
905
+ "w": 36,
906
+ "word": "信",
907
+ "x": 418,
908
+ "y": 1901,
909
+ "guid": "7c8b1a0d-91f9-4465-b085-044c198f17dd",
910
+ "isDeleted": 0
911
+ },
912
+ {
913
+ "h": 47,
914
+ "w": 41,
915
+ "word": "心",
916
+ "x": 454,
917
+ "y": 1901,
918
+ "guid": "7deb401d-7153-40c2-89eb-ba675e698e16",
919
+ "isDeleted": 0
920
+ },
921
+ {
922
+ "h": 47,
923
+ "w": 36,
924
+ "word": "加",
925
+ "x": 495,
926
+ "y": 1902,
927
+ "guid": "18c74fb7-f0bf-4ea0-8e92-8d97bdab7a41",
928
+ "isDeleted": 0
929
+ },
930
+ {
931
+ "h": 47,
932
+ "w": 36,
933
+ "word": "油",
934
+ "x": 531,
935
+ "y": 1902,
936
+ "guid": "25aacd9b-9cc0-4083-853b-e4d905238795",
937
+ "isDeleted": 0
938
+ },
939
+ {
940
+ "h": 47,
941
+ "w": 56,
942
+ "word": "学",
943
+ "x": 567,
944
+ "y": 1903,
945
+ "guid": "560e24e7-f28d-442d-b69c-ffa635c4d8b7",
946
+ "isDeleted": 0
947
+ },
948
+ {
949
+ "h": 47,
950
+ "w": 26,
951
+ "word": "!",
952
+ "x": 623,
953
+ "y": 1903,
954
+ "guid": "d894e330-df63-4147-a030-5ec059a04ff2",
955
+ "isDeleted": 0
956
+ }
957
+ ]
958
+ },
959
+ {
960
+ "word": "附",
961
+ "prob": 0.9999368786811829,
962
+ "x": 1367,
963
+ "y": 1847,
964
+ "width": 142,
965
+ "height": 103,
966
+ "pos": [
967
+ {
968
+ "x": 1367,
969
+ "y": 1847
970
+ },
971
+ {
972
+ "x": 1509,
973
+ "y": 1847
974
+ },
975
+ {
976
+ "x": 1509,
977
+ "y": 1950
978
+ },
979
+ {
980
+ "x": 1367,
981
+ "y": 1950
982
+ }
983
+ ],
984
+ "charInfo": [
985
+ {
986
+ "h": 103,
987
+ "w": 142,
988
+ "word": "附",
989
+ "x": 1367,
990
+ "y": 1847,
991
+ "guid": "2725152d-3879-4981-9dfc-96a774d63c51",
992
+ "isDeleted": 0
993
+ }
994
+ ]
995
+ },
996
+ {
997
+ "word": "MP3光盘",
998
+ "prob": 0.9988929629325867,
999
+ "x": 1338,
1000
+ "y": 1943,
1001
+ "width": 196,
1002
+ "height": 71,
1003
+ "pos": [
1004
+ {
1005
+ "x": 1338,
1006
+ "y": 1943
1007
+ },
1008
+ {
1009
+ "x": 1534,
1010
+ "y": 1943
1011
+ },
1012
+ {
1013
+ "x": 1534,
1014
+ "y": 2014
1015
+ },
1016
+ {
1017
+ "x": 1338,
1018
+ "y": 2014
1019
+ }
1020
+ ],
1021
+ "charInfo": [
1022
+ {
1023
+ "h": 71,
1024
+ "w": 54,
1025
+ "word": "M",
1026
+ "x": 1346,
1027
+ "y": 1942,
1028
+ "guid": "db9ebae2-2747-4d21-b5ef-6e4521c53520",
1029
+ "isDeleted": 0
1030
+ },
1031
+ {
1032
+ "h": 71,
1033
+ "w": 54,
1034
+ "word": "P",
1035
+ "x": 1346,
1036
+ "y": 1942,
1037
+ "guid": "7e1b2139-9b01-4dcd-afb2-bc220deb0bf5",
1038
+ "isDeleted": 0
1039
+ },
1040
+ {
1041
+ "h": 71,
1042
+ "w": 18,
1043
+ "word": "3",
1044
+ "x": 1400,
1045
+ "y": 1942,
1046
+ "guid": "4cb9e498-12cc-4f7b-a681-9446cb80bd24",
1047
+ "isDeleted": 0
1048
+ },
1049
+ {
1050
+ "h": 71,
1051
+ "w": 44,
1052
+ "word": "光",
1053
+ "x": 1418,
1054
+ "y": 1942,
1055
+ "guid": "7b5531b8-bb2c-4f7a-92fa-309148b8c22d",
1056
+ "isDeleted": 0
1057
+ },
1058
+ {
1059
+ "h": 71,
1060
+ "w": 72,
1061
+ "word": "盘",
1062
+ "x": 1462,
1063
+ "y": 1942,
1064
+ "guid": "c283bbe3-9534-4b47-a9c9-f3d9223266ff",
1065
+ "isDeleted": 0
1066
+ }
1067
+ ]
1068
+ },
1069
+ {
1070
+ "word": "(@)大连理工大学出版社",
1071
+ "prob": 0.9589223265647888,
1072
+ "x": 549,
1073
+ "y": 2193,
1074
+ "width": 411,
1075
+ "height": 44,
1076
+ "pos": [
1077
+ {
1078
+ "x": 549,
1079
+ "y": 2193
1080
+ },
1081
+ {
1082
+ "x": 960,
1083
+ "y": 2193
1084
+ },
1085
+ {
1086
+ "x": 960,
1087
+ "y": 2237
1088
+ },
1089
+ {
1090
+ "x": 549,
1091
+ "y": 2237
1092
+ }
1093
+ ],
1094
+ "charInfo": [
1095
+ {
1096
+ "h": 44,
1097
+ "w": 11,
1098
+ "word": "(",
1099
+ "x": 548,
1100
+ "y": 2192,
1101
+ "guid": "427388ca-183d-4c18-b32d-3141d7ffcf1e",
1102
+ "isDeleted": 0
1103
+ },
1104
+ {
1105
+ "h": 44,
1106
+ "w": 28,
1107
+ "word": "@",
1108
+ "x": 559,
1109
+ "y": 2192,
1110
+ "guid": "c70c3d19-d402-4278-a505-9d586f561e2e",
1111
+ "isDeleted": 0
1112
+ },
1113
+ {
1114
+ "h": 44,
1115
+ "w": 11,
1116
+ "word": ")",
1117
+ "x": 587,
1118
+ "y": 2192,
1119
+ "guid": "c98e482d-2916-46da-9ef4-778826e2751f",
1120
+ "isDeleted": 0
1121
+ },
1122
+ {
1123
+ "h": 44,
1124
+ "w": 33,
1125
+ "word": "大",
1126
+ "x": 598,
1127
+ "y": 2192,
1128
+ "guid": "e8b01f57-fcbd-4c2e-9283-b254dc9cf86f",
1129
+ "isDeleted": 0
1130
+ },
1131
+ {
1132
+ "h": 44,
1133
+ "w": 44,
1134
+ "word": "连",
1135
+ "x": 631,
1136
+ "y": 2192,
1137
+ "guid": "4f6695c9-4726-4ca8-84bb-609847976dd7",
1138
+ "isDeleted": 0
1139
+ },
1140
+ {
1141
+ "h": 44,
1142
+ "w": 34,
1143
+ "word": "理",
1144
+ "x": 675,
1145
+ "y": 2192,
1146
+ "guid": "d1dee420-6098-456c-bf23-1fe8b988dedf",
1147
+ "isDeleted": 0
1148
+ },
1149
+ {
1150
+ "h": 44,
1151
+ "w": 38,
1152
+ "word": "工",
1153
+ "x": 709,
1154
+ "y": 2192,
1155
+ "guid": "91226e18-4b01-46b0-8552-e571cad053bc",
1156
+ "isDeleted": 0
1157
+ },
1158
+ {
1159
+ "h": 44,
1160
+ "w": 39,
1161
+ "word": "大",
1162
+ "x": 747,
1163
+ "y": 2192,
1164
+ "guid": "de0e35be-e7c8-45a8-9a2b-0e18b682ebc3",
1165
+ "isDeleted": 0
1166
+ },
1167
+ {
1168
+ "h": 44,
1169
+ "w": 39,
1170
+ "word": "学",
1171
+ "x": 786,
1172
+ "y": 2192,
1173
+ "guid": "ebb1c8ab-01fb-48ac-8e31-985a05904149",
1174
+ "isDeleted": 0
1175
+ },
1176
+ {
1177
+ "h": 44,
1178
+ "w": 38,
1179
+ "word": "出",
1180
+ "x": 825,
1181
+ "y": 2192,
1182
+ "guid": "2188b686-6a9c-442f-af80-5e370673cbbf",
1183
+ "isDeleted": 0
1184
+ },
1185
+ {
1186
+ "h": 44,
1187
+ "w": 33,
1188
+ "word": "版",
1189
+ "x": 863,
1190
+ "y": 2192,
1191
+ "guid": "928db8a9-00b3-4e31-9028-3eae0bf7094e",
1192
+ "isDeleted": 0
1193
+ },
1194
+ {
1195
+ "h": 44,
1196
+ "w": 64,
1197
+ "word": "社",
1198
+ "x": 896,
1199
+ "y": 2192,
1200
+ "guid": "002b6673-080a-4f03-ac89-688e5cc15c0c",
1201
+ "isDeleted": 0
1202
+ }
1203
+ ]
1204
+ }
1205
+ ]
1206
+ }
src/WpfEditor/MainWindow.xaml.cs CHANGED
@@ -323,64 +323,68 @@ namespace WpfEditor
323
  }
324
  else
325
  {
326
- string m5 = MD5.ComputeFileHash(openFileDialog.FileName);
327
 
328
- var (pth_img, pth_json) = Global.get_img_json_pth(m5);
329
 
330
- if (!Path.Exists(pth_json) || !Path.Exists(pth_img))
331
- {
332
- string result = WeChatOcr.RecognizeImage(openFileDialog.FileName);
333
 
334
- string b64_str = Base64.Base64Encode(openFileDialog.FileName);
335
 
336
- using (FileStream fs = new FileStream(pth_json, FileMode.OpenOrCreate, FileAccess.Write))
337
- {
338
- byte[] bytes = System.Text.Encoding.UTF8.GetBytes(result);
339
- fs.Write(bytes, 0, bytes.Length);
340
- }
341
 
342
- using (FileStream fs = new FileStream(pth_img, FileMode.OpenOrCreate, FileAccess.Write))
343
- {
344
- byte[] bytes = System.Text.Encoding.UTF8.GetBytes(b64_str);
345
- fs.Write(bytes, 0, bytes.Length);
346
- }
347
 
348
- // 应用程序退出时释放资源
349
- //WeChatOcr.FreeDll();
350
 
351
- if (!Path.Exists(pth_json) || !Path.Exists(pth_img))
352
- {
353
- MessageBox.Show("不存在 json 或 image", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
354
- return;
355
- }
356
 
357
- }
358
 
359
- var jsonstr = File.ReadAllText(pth_json, new System.Text.UTF8Encoding(false));
360
 
361
- JObject jsn = null;
362
- try
363
- {
364
- jsn = JObject.Parse(jsonstr);
365
- } catch (Exception ex)
366
- {
367
- MessageBox.Show("json 解析失败", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
368
- return;
369
- }
370
 
371
- if (!jsonstr.Contains("guid"))
372
- {
373
- // 可能是阿里云的OCR结果,没有guid (坚排的坐标对不上)
374
- jsn = Global.set_guid_md5(jsn, m5);
375
- string jsn_str = jsn.ToString(Formatting.Indented).Replace("\r\n", "\n");
376
- File.WriteAllText(pth_json, jsn_str);
377
- }
 
 
378
 
379
  if (this._mode == EditorMode.ImageOCR)
380
  {
381
  try
382
  {
 
383
  Editor.SetText(jsn, m5);
 
384
  _currentFilePath = openFileDialog.FileName;
385
  _textChanged = false;
386
  UpdateTitle();
 
323
  }
324
  else
325
  {
326
+ //string m5 = MD5.ComputeFileHash(openFileDialog.FileName);
327
 
328
+ //var (pth_img, pth_json) = Global.get_img_json_pth(m5);
329
 
330
+ //if (!Path.Exists(pth_json) || !Path.Exists(pth_img))
331
+ //{
332
+ // string result = WeChatOcr.RecognizeImage(openFileDialog.FileName);
333
 
334
+ // string b64_str = Base64.Base64Encode(openFileDialog.FileName);
335
 
336
+ // using (FileStream fs = new FileStream(pth_json, FileMode.OpenOrCreate, FileAccess.Write))
337
+ // {
338
+ // byte[] bytes = System.Text.Encoding.UTF8.GetBytes(result);
339
+ // fs.Write(bytes, 0, bytes.Length);
340
+ // }
341
 
342
+ // using (FileStream fs = new FileStream(pth_img, FileMode.OpenOrCreate, FileAccess.Write))
343
+ // {
344
+ // byte[] bytes = System.Text.Encoding.UTF8.GetBytes(b64_str);
345
+ // fs.Write(bytes, 0, bytes.Length);
346
+ // }
347
 
348
+ // // 应用程序退出时释放资源
349
+ // //WeChatOcr.FreeDll();
350
 
351
+ // if (!Path.Exists(pth_json) || !Path.Exists(pth_img))
352
+ // {
353
+ // MessageBox.Show("不存在 json 或 image", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
354
+ // return;
355
+ // }
356
 
357
+ //}
358
 
359
+ //var jsonstr = File.ReadAllText(pth_json, new System.Text.UTF8Encoding(false));
360
 
361
+ //JObject jsn = null;
362
+ //try
363
+ //{
364
+ // jsn = JObject.Parse(jsonstr);
365
+ //} catch (Exception ex)
366
+ //{
367
+ // MessageBox.Show("json 解析失败", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
368
+ // return;
369
+ //}
370
 
371
+ //if (!jsonstr.Contains("guid"))
372
+ //{
373
+ // // 可能是阿里云的OCR结果,没有guid (坚排的坐标对不上)
374
+ // jsn = Global.set_guid_md5(jsn, m5);
375
+ // string jsn_str = jsn.ToString(Formatting.Indented).Replace("\r\n", "\n");
376
+ // File.WriteAllText(pth_json, jsn_str);
377
+ //}
378
+
379
+ var (jsn, m5, pth_img, pth_json) = Global.img_md5_jsn(openFileDialog.FileName);
380
 
381
  if (this._mode == EditorMode.ImageOCR)
382
  {
383
  try
384
  {
385
+ Editor._pthimg = openFileDialog.FileName;
386
  Editor.SetText(jsn, m5);
387
+
388
  _currentFilePath = openFileDialog.FileName;
389
  _textChanged = false;
390
  UpdateTitle();
src/WpfEditor/TextEditorControl.cs CHANGED
@@ -36,6 +36,8 @@ namespace WpfEditor
36
  public string _md5_OpenImg;
37
  public Dictionary<string, string> _dic_deleted_char = new Dictionary<string, string>(); // 被删除的字符存它的 guid,保存的时侯标记它逻辑删除
38
 
 
 
39
  public static BitmapSource MatToBitmapSource(Mat mat)
40
  {
41
  // Detect pixel format (BGR24 for color, Gray8 for grayscale)
@@ -512,7 +514,8 @@ namespace WpfEditor
512
  string m5 = chr.ImageMD5;
513
  if (m5 != "")
514
  {
515
- var (pth_img, pth_json) = Global.get_img_json_pth(m5);
 
516
  if (Path.Exists(pth_json) && Path.Exists(pth_img))
517
  {
518
  string jsn_str = File.ReadAllText(pth_json, Encoding.UTF8);
 
36
  public string _md5_OpenImg;
37
  public Dictionary<string, string> _dic_deleted_char = new Dictionary<string, string>(); // 被删除的字符存它的 guid,保存的时侯标记它逻辑删除
38
 
39
+ public string _pthimg; // 当前打开的图片路径
40
+
41
  public static BitmapSource MatToBitmapSource(Mat mat)
42
  {
43
  // Detect pixel format (BGR24 for color, Gray8 for grayscale)
 
514
  string m5 = chr.ImageMD5;
515
  if (m5 != "")
516
  {
517
+ //var (pth_img, pth_json) = Global.get_img_json_pth(m5);
518
+ var (pth_img, pth_json) = Global.get_img_json_pthv2(_pthimg);
519
  if (Path.Exists(pth_json) && Path.Exists(pth_img))
520
  {
521
  string jsn_str = File.ReadAllText(pth_json, Encoding.UTF8);
src/WpfEditor/global.cs CHANGED
@@ -1,4 +1,5 @@
1
- using Newtonsoft.Json;
 
2
  using Newtonsoft.Json.Linq;
3
  using System;
4
  using System.Collections.Generic;
@@ -7,6 +8,7 @@ using System.Linq;
7
  using System.Security.Cryptography;
8
  using System.Text;
9
  using System.Threading.Tasks;
 
10
  using System.Windows.Shapes;
11
 
12
  using Path = System.IO.Path;
@@ -35,6 +37,23 @@ namespace WpfEditor
35
  return (ImagePath: pth_img, JsonPath: pth_json);
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  // 阿里 ocr的 JSON 需要添加 guid
39
  public static JObject set_guid_md5(JObject jsn, string md5)
40
  {
@@ -212,5 +231,71 @@ namespace WpfEditor
212
 
213
  return jsn_new;
214
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  }
216
  }
 
1
+ using Microsoft.Win32;
2
+ using Newtonsoft.Json;
3
  using Newtonsoft.Json.Linq;
4
  using System;
5
  using System.Collections.Generic;
 
8
  using System.Security.Cryptography;
9
  using System.Text;
10
  using System.Threading.Tasks;
11
+ using System.Windows;
12
  using System.Windows.Shapes;
13
 
14
  using Path = System.IO.Path;
 
37
  return (ImagePath: pth_img, JsonPath: pth_json);
38
  }
39
 
40
+ public static (string ImagePath, string JsonPath) get_img_json_pthv2(string pthimg)
41
+ {
42
+ string m5 = MD5.ComputeFileHash(pthimg);
43
+
44
+ string dir = Path.GetDirectoryName(pthimg);
45
+
46
+ string pth_img = Path.Combine(dir, "data", "img", $"{m5}.txt"); // .parent_path().parent_path() 在C#中不需要
47
+ string pth_json = Path.Combine(dir, "data", "json", $"{m5}.json"); // .parent_path().parent_path() 在C#中不需要
48
+
49
+ // C#中不需要lexically_normal(),Path.GetFullPath可以规范化路径
50
+ pth_img = Path.GetFullPath(pth_img);
51
+ pth_json = Path.GetFullPath(pth_json);
52
+
53
+ // 使用C# 7.0引入的命名元组返回结果
54
+ return (ImagePath: pth_img, JsonPath: pth_json);
55
+ }
56
+
57
  // 阿里 ocr的 JSON 需要添加 guid
58
  public static JObject set_guid_md5(JObject jsn, string md5)
59
  {
 
231
 
232
  return jsn_new;
233
  }
234
+
235
+ public static Tuple<JObject, string, string, string> img_md5_jsn(string pthimg)
236
+ {
237
+
238
+ string m5 = MD5.ComputeFileHash(pthimg);
239
+
240
+ var (pth_img, pth_json) = Global.get_img_json_pthv2(pthimg);
241
+
242
+ if (!Path.Exists(pth_json) || !Path.Exists(pth_img))
243
+ {
244
+ string result = WeChatOcr.RecognizeImage(pthimg);
245
+
246
+ string b64_str = Base64.Base64Encode(pthimg);
247
+
248
+ DirectoryInfo di = Directory.CreateDirectory( Path.GetDirectoryName(pth_json) );
249
+ DirectoryInfo di2 = Directory.CreateDirectory(Path.GetDirectoryName(pth_img) );
250
+
251
+ using (FileStream fs = new FileStream(pth_json, FileMode.OpenOrCreate, FileAccess.Write))
252
+ {
253
+ byte[] bytes = System.Text.Encoding.UTF8.GetBytes(result);
254
+ fs.Write(bytes, 0, bytes.Length);
255
+ }
256
+
257
+ using (FileStream fs = new FileStream(pth_img, FileMode.OpenOrCreate, FileAccess.Write))
258
+ {
259
+ byte[] bytes = System.Text.Encoding.UTF8.GetBytes(b64_str);
260
+ fs.Write(bytes, 0, bytes.Length);
261
+ }
262
+
263
+ // 应用程序退出时释放资源
264
+ //WeChatOcr.FreeDll();
265
+
266
+ if (!Path.Exists(pth_json) || !Path.Exists(pth_img))
267
+ {
268
+ MessageBox.Show("不存在 json 或 image", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
269
+ return null;
270
+ }
271
+
272
+ }
273
+
274
+ var jsonstr = File.ReadAllText(pth_json, new System.Text.UTF8Encoding(false));
275
+
276
+ JObject jsn = null;
277
+ try
278
+ {
279
+ jsn = JObject.Parse(jsonstr);
280
+ }
281
+ catch (Exception ex)
282
+ {
283
+ MessageBox.Show("json 解析失败", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
284
+ return null;
285
+ }
286
+
287
+ if (!jsonstr.Contains("guid"))
288
+ {
289
+ // 可能是阿里云的OCR结果,没有guid (坚排的坐标对不上)
290
+ jsn = Global.set_guid_md5(jsn, m5);
291
+ string jsn_str = jsn.ToString(Formatting.Indented).Replace("\r\n", "\n");
292
+ File.WriteAllText(pth_json, jsn_str);
293
+ }
294
+
295
+ return new Tuple<JObject, string, string, string>(jsn, m5, pth_img, pth_json);
296
+
297
+ }
298
+
299
+
300
  }
301
  }