Google Drive OCR Android - android

I've downloaded Google drive sdk for Android,
the API is not well documented, so I didn't manage to get to conclusion if what I want to do is possible.
I want to capture an image with the camera convert it to black and white pdf, and then perform OCR on it to get the fields I need as String.
Do I need to send a server request for it or maybe I can Do it on the client side only using Drive api?
sample code will be helpful.

Google's docs don't specify what happens to an uploaded file when you request OCR, specifically, they don't tell you if there is a response string.
However, a little experimenting shows that the only way to get the OCR data is to lookup the document after OCR is complete and grab the text.
You'll find the data structure for 'Files' here: https://developers.google.com/drive/v2/reference/files#resource - what your are after will be in "indexableText" as a string.
Unfortunately, it won't parse out any sort of 'fields'. That would require an understanding of the content... Also, it doesn't seem to capture any email addresses, which is an issue if you are trying to do business cards.
BTW, you will have to wait some time, upto 2 minutes, before the data is available. I'm not entirely sure, but it could also be that object id will not be available for that amount of time, so you might have to either run a background process or do something else.

Sorry that you didn't find the documentation, it is plentiful and available here: https://developers.google.com/drive/
The entire Drive API functions by making server calls, please check here: https://developers.google.com/drive/v2/reference/files/insert for how to perform OCR on uploading files to Drive. Look at the cunningly named "ocr" parameter.

Related

How to make a framework to collect data from a website to be displayed in a flutter app

I have been looking at similar questions on this website and Im looking to try to get certain pieces of information from a .xml file on a website that I then duplicate for each individual lake. I am trying to make something that will be able to get the current water level for each of these lakes. I found this tool that can generate .xml of the data but I dont know how to have flutter read that and update it every so often if that makes sense.
https://waterservices.usgs.gov/rest/DV-Test-Tool.html
I was testing this site using Neosho River with the Site number: 07179500. This gives me the following url that seems to contain relevant updated information such as the current discharge rate.
https://waterservices.usgs.gov/nwis/dv/?format=waterml,2.0&sites=07179500&siteStatus=all
How can I have it pull information like this and then re-check every x time to update the current water level etc? I was looking at json? but most guides I found use a file you upload and not a website.
Additionally, there are several other links that may be helpful and might have a better type of data
https://waterservices.usgs.gov/rest/
https://waterservices.usgs.gov/rest/DV-Service.html
https://help.waterdata.usgs.gov/faq/automated-retrievals
https://waterdata.usgs.gov/nwis/dvstat?&site_no=07179500&agency_cd=USGS&por_07179500_55652=92891,00060,55652,1938-10-01,2021-11-21&stat_cds=mean_va&referred_module=sw&format=html_table
https://waterdata.usgs.gov/nc/nwis/uv?cb_00062=on&format=html&site_no=02098197&period=&begin_date=2022-02-28&end_date=2022-03-01
https://www.swt-wc.usace.army.mil/
If flutter can not do this is there something else I can use to work with flutter?

Android OCR result matching with database

So I am trying to use a OCR to translate text that I record with my phone's camera to a string, I am currently using Google vision OCR for android and have implemented the OCR correctly, the problem is that sometimes the result is not as good as expected thats why a solution I think might work is matching the result given by the OCR with my database. For example if my camera reads "How you?" then I would find in my database a entry that is similar "How are you?" and would display this instead. So the real problem is that the OCR is constantly reading from the camera, so that means that I would need to make an HTTP request to a server and query the database for a similar match every second or two and wait for the response, that could be very bad execution if there are many users overloading the server. One solution that I thought was downloading the list of all strings in the database and make the matching locally, but what if the data changes after that in the database? What would be a good approach to this?
I'm using this to read text from supermarket products such as name and description, so what I thought was match the products name and then query my database for all complementary information. Its important to note that this is going to be used by visually impaired people so reading bar codes is not a good choice right now.
Here is my 2 cents.
One solution that I thought was downloading the list of all strings in the database and make the matching locally, but what if the data changes after that in the database? What would be a good approach to this?
It depends how big is your database. If it is not too big then you can download it on user's device. If there is an update to the database, then you can implement a push mechanism using FCM, letting the app know that there is a new version of database to fetch. Then you can fetch it in the background and update your local database. Also I understand that since you are creating the app for visually impaired people, it might not work if you just ask your users to take a picture and perform OCR on it. This way it would have prevented the calls every second.

Parsing dota2.gamepedia.com - Android

I would like to get all information about Dota2 items I can get. Essential ones are their prices, names, thumbnail picture URLs, but other information are also welcome, like the way you buy them (for instance, you buy a Moon Shard by buying two Hyperstones).
There is a Dota2 Wiki page and there is a way to parse Wiki pages, but this didn't work. Apparently Wiki's APIs doesn't work on http://dota2.gamepedia.com.
I need this information on Android platform.
Any help?
I have actually been actively researching this same thing.
Scraping from a wiki is far too brittle (layout/website updates), why not get the data straight from valve's mouth? They have an online item viewer which consumes json item data, I was able to track down where exactly this gets published and plan on using it in a future android app as well.
The json data can be retreived via this link.
Once you have that look into something like retrofit to parse this data directly into objects.
Personally however, I would consume it through some other method and store it in your own database so your app isn't dictated by the structure of the data they push.
Hope this helps!

Uploading to Blobstore - Android

I am trying to create an Android app where people can read short stories. The stories will be in the form of images since it will include some arts to accompany the text. That is the reason of why I decided to use Google App Engine. I want to store the images in the App Engine then let the client device retrieve all the stories(or images). I can then somehow organise the images into the proper sequence (which I have not an idea on how to do).
I am completely new to Cloud computing or doing backend stuff so there is a lot of stuff that I am not wrapping my head around.
I did a tutorial on creating a mobile assistant app. In the end I got it working and deployed to App Engine. Whenever I upload the files I did it through the command line using "appcfg.py" however after looking at Blobstorage it seems to work a bit differently.
How exactly do you upload images to Blobstore? So far all the thing I've read is on uploading data from the client device/web application and I can't seem to find anything that is very detailed on using Blobstore and Android together. What I am trying to ask is, is there a way to upload the images to the Blobstore directly from the command line (if that is possible)? And how to handle those images once it's up in Blobstore?
Can someone give me some advice please?

How to detect New Version Of Website using Android Application?

I have an android application that's a "link" to a magazine website.
The activity of the application would be the magazine website itself.
I've made a widget for it and I run a service that as one sole purpose: to detect when a new magazine is online. When the service detects it changes the widget icon.
Now my doubt is how can I detect a new magazine. I was thinking about download a file from the website every 6 hours and compare the version of the last magazine (I may start with 0 as a local variable for the application and compare with the number provided by the document downloaded).
Is there a better way to do it?
It depends what you consider to be a "change". Assuming you want to detect any changes, download the magazine homepage/other file and perform an MD5 or similar hash on it. Store the hash.
Next time you do a download, you hash it again then compare hashes. If the hashes are identical, the page is unchanged. The benefit of the hash is the reduced storage requirements - you only need to save a handful of bytes, not a whole document.
Be aware, however, that most pages are NOT static - imagine a page with a clock in the corner or any dynamic content - in this scenario, your page will always appear to be different.
For some well-run sites and servers, you may be able to look at the HTTP headers to get information about when the page was created/modified/is set to expire. This won't be provided by everyone and can sometimes just be plain wrong.
The ideal solution is to find one particular page (or part of a page) which will onlu change once with every new issue - then you can just keep checking that one thing. An example of this might be a link that always points at the latest issue or the url for the main image which changes with each issue.
Of course, if the magazines are willing to help, they could expose the information to you in a number of ways from a simple file with just an issue number inside to a full-on webservice.
Edit: Assuming multiple magazines under your control, I'd suggest you have a single page that returns a list of the latest issues for each magazine in a readily parsable format (JSON, XML). This list could be static if issues are infrequent/a very manual process - in which case, edit it by hand. Even better would be a simple database table which is read to generate the list - This way you can have a nice UI to update it and allow someone else to maintain it without giving them access to the server file system.
I'd also suggest that you assign a truly unique id/key to each magazine and to each issue of that magazine - so that in future, you can add other functionality like downloading locally for offline reading / syncing back issues.

Categories

Resources