質問編集履歴
1
brake pointを使ってエラーを起こしている箇所を探し、その箇所について質問しなおさせていただきました。
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
OCR swift
|
1
|
+
OCR swift 関数呼び出し
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
###概要
|
2
2
|
|
3
|
-
|
3
|
+
OCRアプリをiosで実現しようと試みているのですが、関数呼び出しの箇所で行き詰っています。
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -8,65 +8,15 @@
|
|
8
8
|
|
9
9
|
エラーメッセージはとくにありません。
|
10
10
|
|
11
|
-
実行時、写真を撮影した後、
|
11
|
+
実行時、関数"Camera"で写真を撮影した後、関数"ImagePickerController"を呼び出したいのですが、
|
12
12
|
|
13
|
-
|
13
|
+
関数"ImagePickerController"が呼び出されず、関数"Camera"の実行までで終了してしまいます。
|
14
14
|
|
15
|
-
|
15
|
+
|
16
16
|
|
17
17
|
|
18
18
|
|
19
19
|
###該当のソースコード
|
20
|
-
|
21
|
-
import UIKit
|
22
|
-
|
23
|
-
import TesseractOCR
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
class ViewController: UIViewController, G8TesseractDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate{
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
@IBOutlet var Imageview: UIImageView!
|
32
|
-
|
33
|
-
@IBOutlet var Textview: UITextView!
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
var selectedImage:UIImage?
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
override func viewDidLoad() {
|
48
|
-
|
49
|
-
super.viewDidLoad()
|
50
|
-
|
51
|
-
// Do any additional setup after loading the view, typically from a nib.
|
52
|
-
|
53
|
-
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
override func didReceiveMemoryWarning() {
|
58
|
-
|
59
|
-
super.didReceiveMemoryWarning()
|
60
|
-
|
61
|
-
// Dispose of any resources that can be recreated.
|
62
|
-
|
63
|
-
}
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
20
|
|
71
21
|
@IBAction func Camera(sender: AnyObject) {
|
72
22
|
|
@@ -166,62 +116,6 @@
|
|
166
116
|
|
167
117
|
}
|
168
118
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
func analyze() {
|
176
|
-
|
177
|
-
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), {
|
178
|
-
|
179
|
-
let tesseract = G8Tesseract(language: "jpn")
|
180
|
-
|
181
|
-
tesseract.delegate = self
|
182
|
-
|
183
|
-
tesseract.image = self.selectedImage
|
184
|
-
|
185
|
-
tesseract.recognize()
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
self.Textview.text = tesseract.recognizedText
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
print("----------------------------")
|
194
|
-
|
195
|
-
print(tesseract.recognizedText)
|
196
|
-
|
197
|
-
print("----------------------------")
|
198
|
-
|
199
|
-
})
|
200
|
-
|
201
|
-
}
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
func shouldCancelImageRecognitionForTesseract(tesseract: G8Tesseract!) -> Bool {
|
210
|
-
|
211
|
-
return false; // return true if you need to interrupt tesseract before it finishes
|
212
|
-
|
213
|
-
}
|
214
|
-
|
215
|
-
}
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
119
|
|
226
120
|
|
227
121
|
###
|