2014-06-15 56 views
0

你好,我想使用的Tesseract OCR(IOS),但每當我選擇,我已拍攝的相片或者說我已經從我的本地照片中選擇圖像的圖像我得到這個:Tesseract OCR「警告:圖像沒有大小!」

警告:圖像沒有大小! 44:07.613做數學

請嘗試recognition.2014-06-14 20日前致電SetImage [431:60B]內計算

請嘗試recognition.2014-06-14 20:44前致電SetImage: 07.614做數學[431:60b]沒有公認的文字。檢查 - [Tesseract setImage:]是否傳遞大於0x0的圖像。

我的方法 「計算」 是低於以下:

- (void)calculate 
{ 
Tesseract* tesseract = [[Tesseract alloc] initWithLanguage:@"eng+ita"]; 
tesseract.delegate = self; 

[tesseract setVariableValue:@"abcdefghijklmnopqrstuvwxyz" forKey:@"tessedit_char_whitelist"]; 
[tesseract setImage:_image]; 
[tesseract recognize]; 

NSLog(@"%@", [tesseract recognizedText]); 

tesseract = nil; //deallocate and free all memory 

} 

關於

[tesseract setImage:_image]; 

_image是一個實例變量我已經開始爲:

UIImage *_image; 

,並得到在某人拍照後分配或選擇一個ph值OTO通過:https://github.com/gali8/Tesseract-OCR-iOS

我在做什麼錯:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 

UIImage *chosenImage = info[UIImagePickerControllerEditedImage]; 
self.imageView.image = chosenImage; 

chosenImage = _image; 

[picker dismissViewControllerAnimated:YES completion:NULL]; 

} 

我通過的CocoaPods下載呢? _image是一個UIImage,這是setImage所期待的!

+0

我的紅旗:一個說「沒有大小」的圖書館......有些東西感覺不對。 –

+0

我將鏈接到我從此獲得的圖書館。看起來合法,但我同意你的看法! https://github.com/gali8/Tesseract-OCR-iOS – gradedcatfood

回答

1

使用_image = chosenImage而不是chosenImage = _image。

可能工作。

+0

前段時間我放棄了它,但現在看着你的答案,我認爲你的權利,我的一個愚蠢的錯誤。我會盡快嘗試並報告回來! – gradedcatfood

+0

哇,完全工作,愚蠢的錯誤在我的部分,謝謝! – gradedcatfood