OCR integration in Android using Google Drive -


i searched lot , not successful yet . don't wish use tesseract medhod .

i have created project according to

https://developers.google.com/drive/quickstart-android

and while running image got uploaded goggle docs . received message file uploaded file name .

for downloading data followed

public void downloadfile(file file)   {       string imageastexturl = file.getexportlinks().get("text/plain");        httpclient client = new defaulthttpclient();       httpget = new httpget(imageastexturl);       httpresponse response;        stringbuffer sb = new stringbuffer();       bufferedreader in = null;       try        {           response = client.execute(get);           in = new bufferedreader(new inputstreamreader(response.getentity().getcontent()));           string str;           while ((str = in.readline()) != null)            {               sb.append(str);           }           log.e(" sb data ", sb.tostring());           in.close();       }        catch (clientprotocolexception e)        {           e.printstacktrace();       }        catch (ioexception e)        {           e.printstacktrace();       }   } 

and got return data

" <!doctype html><html lang="en"> <head> <meta charset="utf-8"> <title>welcome google docs</title><style type="text/css"> html, body, div, h1, h2, h3, h4, h5, h6, p, img, dl, dt, dd, ol, ul, li, table, tr, td, form, object, embed, article, aside, canvas, command, details, fieldset, figcaption, figure, footer, group, header, hgroup, legend, mark, menu, meter, nav, output, progress, section, summary, time, audio, video { margin: 0; padding: 0; border: 0; } article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } html { font: 81.25% arial, helvetica, sans-serif; background: #fff; color: #333; line-height: 1; direction: ltr; } { color: #15c; text-decoration: none; } a:active { color: #d14836; } a:hover { text-decoration: underline; } h1, h2, h3, h4, h5, h6 { color: #222; font-size: 1.54em; font-weight: normal; line-height: 24px; margin: 0 0 .46em; } p { line-height: 17px; margin: 0 0 1em; } ol, ul { list-style: none; line-height: 17px; margin: 0 0 1em; } li { margin: 0 0 .5em; } table { border-collapse: collapse; border-spacing: 0; } strong { color: #222; }</style><style type="text/css"> html, body { position: absolute; height: 100%; min-width: 100%; } .wrapper { position: relative; min-height: 100%; } .wrapper + style + iframe { display: none; } .content { padding: 0 44px; } .topbar { text-align: right; padding-top: .5em; padding-bottom: .5em; } .google-header-bar { height: 71px; background: #f1f1f1; border-bottom: 1px solid #e5e5e5; overflow: hidden; } .header .logo { margin: 17px 0 0; float: left; } .header .signin, .header .signup { margin: 28px 0 0; float: right; font-weight: bold; } .header .signin-button, .header .signup-button { margin: 22px 0 0; float: right; } .header .signin-button { font-size: 13px; font-weight: normal; } .header .signup-button { position: relative; top: -1px; margin: 0 0 0 1em; } .main { margin: 0 auto; width: 650px; padding-top: 23px; padding-bottom: 100px; } .main h1:first-child { margin: 0 0 .92em; } .google-footer-bar { position: absolute; bottom: 0; height: 35px; width: 100%; border-top: 1px solid #ebebeb; overflow: hidden; } .footer { padding-top: 9px; font-size: .85em; white-space: nowrap; line-height: 0; } .footer ul { color: #999; float: left; max-width: 80%; } .footer ul li { display: inline; padding: 0 1.5em 0 0; } .footer { color: #333; } .footer .lang-chooser-wrap { float: right; max-width: 20%; } .footer .lang-chooser-wrap img { vertical-align: middle; } .footer .attribution { float: right; } .footer .attribution span { vertical-align: text-top; } .redtext { color: #dd4b39; } .greytext { color: #555; } .secondary { font-size: 11px; color: #666; } .source { color: #093; } .hidden { display: none; } .announce-bar { position: absolute; bottom: 35px; height: 33px; z-index: 2; width: 100%; background: #f9edbe; border-top: 1px solid #efe1ac; border-bottom: 1px solid #efe1ac; overflow: hidden; } .announce-bar .message { font-size: .85em; line-height: 33px; margin: 0; } .announce-bar .message .separated { margin-left: 1.5em; } .announce-bar-ac { background: #eee; border-top: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; } .clearfix:after { visibility: hidden; display: block; font-size: 0; content: '.'; clear: both; height: 0; } * html .clearfix { zoom: 1; } *:first-child+html .clearfix { zoom: 1; } pre { font-family: monospace; position: absolute; left: 0; margin: 0; padding: 1.5em; font-size: 13px; background: #f1f1f1; border-top: 1px solid #e5e5e5; direction: ltr; }</style><style type="text/css"> button, input, select, textarea { font-family: inherit; font-size: inherit; } button::-moz-focus-inner, input::-moz-focus-inner { border: 0; } input[type=email], input[type=number], input[type=password], input[type=tel], input[type=text], input[type=url] { -webkit- "

but doesn't return text in image , uploaded . how texts , uploaded image ?

when tried

android open , save files to/from google drive sdk

for downloading , got error in "driverequest driverequest = (driverequest) request;" not cast httprequest driverequest

then tried with

driverequest driverequest = driverequest.class.cast(request); 

but got crash in line saying classcastexcaption .

any related answers welcomed . in advance .

i got answer right adding

get.setheader("authorization", "bearer " + credential.gettoken()); 

to downloadfile method .

as authentication not correct returned html of google docs welcome page . after adding line , got recognized text correctly .


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -