I would like to know how I can filter to detect numbers (integers) only? e.g 1,2,....,10. Currently the api detects all formats of "text".
Asked
Active
Viewed 2,701 times
2 Answers
0
You should do that processing on your side. Use Regex to filter out numbers from string received from Vision API:
str="Text received 123,0";
number = str.replace(/\D/g,'');
result: 123

Jalle
- 1,566
- 5
- 22
- 42
-
I don't think this is what he asked for. – eden Jul 11 '17 at 10:33
0
Google vision API will detect all character, google vision does not have separate API(which can detect only number at the point of scanning) for only numbers till now, But after scanning the image using google vision api we will get the text in response example "23XA3783", so now we can replace the character we don't want.
Store the google api response in temp variable
source_str = "23XA3783"
In my case I get the required string from google api response using js
source_str= temp["responses"][0].textAnnotations[0].description
final_output = source_str.replace(/\D/g,'');

Vinay Kumar
- 1,199
- 13
- 16