How can I lookup data about a food from its barcode number? - ios

I am currently designing an iOS application for helping diabetics to manage their condition.
One feature I am working on is a barcode scanner, where the user will be able to take a picture of a barcode (as they are shopping) and get back information on the product based on its barcode.
With this information, I will create a nutrition score of 1-10 for the diabetic.
My question is, is there a way I can use the scanned barcode to get information on the particular food product?? I realize that the barcode is just a number, and that in supermarkets barcodes information are stored in a supermarket database. Is there anyway I would have access to an online db of food products?

Use the barcode scanner plugin then query labelcalc to get the info you need.

Related

What is the way to parse a string of a well known format from an image on iOS (some library created specifically for this purpose)?

Local travel cards in Saint-Petersburg, Russia have got huge id numbers that aren't easy to read and type into a web page when topping up the card online. So I want to build a small app that would take a photo of a travel card and parse the number out.
The task is a bit easier than a free form recognition:
card is of the very well known size
id numbers are of known size, are located in the very well known location on a card and they are number only, no letters (okay, there are two variations I think and maybe they will add 1-2 more in the future)
even the font is known in advance
even the first several numbers are the same for most of the card (so far there are only two prefixes used)
How would you do it? Are there any libraries tuned not for the general OCR, but for a "hinted" OCR like I need?
Best regards,
Artem.
P.S.
Actually a free/cheap web service for this task would also be good enough
Yes Google has a library called Tesseract and there is an iOS SDK on Github you can import into your application. So you can use this SDK and it has some documentation that you can read that will explain how to set it up in your app. It has methods that will return you a string with the text of the card in the string. BUT it will be ALL of the text from the card. So best thing to do would be to:
1 "clip" the original image to extract a sub image that displays only the portion of the card you wish to get the numbers from.
2 Process this sub image through Tesseract to retrieve the string you are looking for.
3 Then parse through the string and pick out the data that you need.
But just be warned, it can be a bit quirky. This SDK tends to recognize words best from images that are scanned, not "taken a picture of". Because although it is an advance piece of technology, it isn't perfect. So to get it to work as perfectly as possible for you, try to get scanned copies of the originals.
Best of luck.
The ideal solution for you would have three components:
1) Detection of the card. This is useful because if you have the detection, then the end users have much easier time actually using the scanner, because they can place the phone above the card in an arbitrary direction
2) Accurate OCR component. Ideally, customizable for this exact font you have on the card, for the exact position on the card.
3) Parsing mechanism. This would enable you to obtain the exact string written on the card without writing huge amount of OCR parsing code.
BlinkID SDK has all this. It has a preset for detection cards in the ID-1 format. It has integrated OCR engine. And it provides RegexParser, where you can define the exact format of the text which you're trying to extract from the document.
BlinkID was initially built for scanning ID documents which have very similar properties as the problem you're trying to solve.
Note. I'm one of the developers working on BlinkID.

Save game/user statistic in a central database with swift and sql on IOS 8

I am making a game for IOS 8 using the Swift language. For each level I was planning to save data such as how long it takes to solve the level, what (x,y) position a player dies, how many attempts before solving the level etc. I will then use this information to improve the game by adjusting the difficulty of levels.
So I figured I would have a simple SQlite DB stores locally with this information. And then I wonder how I should upload this information to one central database. Any ideas?
For example, what kind of unique identifier can I use? I don't care about the individual data, just the average time to complete a level and the average nr of attempts to solve a level..
But, if I have in-app purchases, how can a user that delete the app, or get another iphone restore the purchases made? This is again related to a unique identifier that is connected to the user, not just the iphone.
You really should be using analytics tools to do this. I would recommend using Flurry. Its free to use, and goes into your game very easily.
http://www.flurry.com/solutions/analytics
I have used it in a number of products. You can send in the anonymous data you want based on events. So every time a level is complete, you can report it to flurry as an event, and pass parameters of level, score, and completion time.
You can look at a nice dash board to see the results and averages.
Its easy to incorporate it into a Swift app. Another SO answer goes through this in detail.

iOS:Image to string conversion

I want to develop a feature, wherein user can take a picture of a serial number which has printed in a product or any things, using native camera and then scan the picture to retrieve the serial number as a string in my iOS program. I am not getting how to achieve this. Could someone please guide me to solve this problem? I don't want to know the name of the product and all after taking the picture, i want to get the string of the serial number taken from the photo.
Thanks in advance!
You need OCR (Optical Character Recognition), and that is not something to take lightly..
Take a look at Tesseract for iOs, this is a library that does this.. But be ready to dive into unknown realms.

What iphone sdk API can I use to query the iOS word dictionary?

I'm working on an iphone word game. Is there any way for me to query the word database available in the iOS? The database in very comprehensive and is available when the user selects words. (A popup comes up with the define button)
You can also opt for LexiContext. Has a nice bundle for offline access of a whole dictionary, with a singleton shared class and easily available functions to get the words list or description.
But it is not free, but it provides a sample free sdk for testing with similar to all the functions and access to only words with letter 'a'.

About data mining by using twitter data

I plan to write a thesis about using sentiment information to enhance the predictivity of some financial trading model for currency.
The sentiment data should be twitter threads including some keyword, like "EUR.USD". And I will filter out some sentiment words to identify the sentiment. Simple idea. Then we try to see whether here is any relation between the degree of sentiment and the movement of EUR.USD.
My big concern is on twitter data. As we all know that the twitter set up the limit to see the history data. You could only browser back for like 5 days. It is not enough since our strategy based on daily sentiment.
I noticed that google have some fantastic thing like timeline about the twitter updates: http://www.readwriteweb.com/archives/googles_twitter_timeline_lets_you_explore_the_past.php
But first of all, I am in Switzerland and seems I have no such function on my google which is too smart to identify my location and may block some US google version function like this. Secondly, even I could see some fancy interactive google timeline control on my firefox, How could I dig out data from my query and save them? Does google supply such api?
The Google service you mentioned has shut down recently so you won't be able to use it. (http://www.searchenginejournal.com/google-realtime-shuts-down-as-twitter-deal-expires/31007/)
If you need a longer timespan of data to analyze I see the following options:
pay for historical data :) (https://dev.twitter.com/docs/twitter-data-providers)
if you don't want to pay, you need to fetch tweets containing EUR/USD whatever else (you could use the streaming API for this) and store them somehow. Run this service for a while (if possible) and you'll have more than just 5 days of data.

Resources