str ss.getfile("$desktop$\1.png");; change to file location
_s.encrypt(4 ss ""2)
str body= F ;access_token=24.b305c9822131e65eda05e29c157dd719.2592000.1559103982.282335-16139329&image={_s}&language_type=CHN_ENG&probability=true&detect_direction=true
str ss.getfile("$desktop$\1.png");; change to file location
_s.encrypt(4 ss ""2)
_s.setfile("$desktop$\1.txt")
str body= F ;access_token=24.b305c9822131e65eda05e29c157dd719.2592000.1559103982.282335-16139329&image={_s}&language_type=CHN_ENG&probability=true&detect_direction=true
05-05-2019, 02:25 AM (This post was last modified: 05-05-2019, 02:51 AM by win.)
Thank you for your help
@kevin
2.png is a multi-line text image, get the result using the following code, ann The following code OK, But need ChilkatAx-9.5.0-win32.dll
j=js.ArrayOf("words_result")
out js.StringOf("log_id")
out js.StringOf("direction")
out js.StringOf("words_result_num")
for int'i 0 j.Size
jr=j.ObjectAt(i)
str words_result=jr.StringOf("words")
out words_result
this is first time I used the chilkat component, it feels easier to understand,
the component is relatively large, 9M size,
thank you again for sharing
Xml x=JsonToXml(r.ResponseText 1) ARRAY(IXmlNode) a1
x.Path("root/words_result").GetAll(0 a1) int i for i 0 a1.len ,if(!empty(a1[i].Value)) ,,out"%s" a1[i].Value
05-05-2019, 11:54 PM (This post was last modified: 05-06-2019, 12:11 AM by win.)
still a little do not understand, can not use the trim function?
Is there an easier way?
use Chilkat's json component code, I can understand, but it is too big
I just found the problem, if there are Chinese or uincode characters in the picture, QM's base64 encoding is wrong, have garbled characters in the recognition result.
I have prepared a picture 3.png in the attachment
Is there a solution? This is the result of postman generation, no garbled, it is correct
05-06-2019, 02:33 AM (This post was last modified: 05-06-2019, 02:43 AM by win.)
Wow, Good code!!
I have not found a better OCR solution at present, I can only use Baidu OCR.
I think it might be what needs to be modified in the unicode code.
Baidu OCR, supports many languages, Support for 50,000 requests per day for free, There are many free features, such as text-to-speech, translation, and image recognition.
- CHN_ENG: mixed in Chinese and English;
- ENG: English;
- POR: Portuguese;
- FRE: French;
- GER: German;
- ITA: Italian;
- SPA: Spanish;
- RUS: Russian;
- JAP: Japanese;
- KOR: Korean
public void GeneralBasicDemo() {
var image = File.ReadAllBytes("Image file path");
// Calling universal text recognition, the image parameters are local images, and may throw an exception such as the network. Please use try/catch to capture
var result = client.GeneralBasic(image);
Console.WriteLine(result);
// If there are optional parameters
var options = new Dictionary<string, object>{
{"language_type", "CHN_ENG"},
{"detect_direction", "true"},
{"detect_language", "true"},
{"probability", "true"}
};
// Calling general text recognition with parameters, picture parameters are local images
result = client.GeneralBasic(image, options);
Console.WriteLine(result);
}
public void GeneralBasicUrlDemo() {
var url = "https//www.x.com/sample.jpg";
// Calling universal text recognition, the image parameter is a remote url image, and may throw an exception such as the network. Please use try/catch to capture
var result = client.GeneralBasicUrl(url);
Console.WriteLine(result);
// If there are optional parameters
var options = new Dictionary<string, object>{
{"language_type", "CHN_ENG"},
{"detect_direction", "true"},
{"detect_language", "true"},
{"probability", "true"}
};
// Calling general text recognition with parameters, image parameters are remote url images
result = client.GeneralBasicUrl(url, options);
Console.WriteLine(result);
}