Note that there are some explanatory texts on larger screens.

plurals
  1. POOCR not recognizing the contents of Camera pic?
    primarykey
    data
    text
    <p>i am trying to develop an OCR app, which will recognize the content of Camera pic , but getting a response "This Image Is too Big",i tried to resize the image,,, but still not happening. My code of OCR is this</p> <pre><code>public class weocr { String response; @SuppressWarnings("unused") private String selectedpath; weocr(String selectedpath) throws UnsupportedEncodingException, ParseException, ClientProtocolException, IOException { String url="http://appsv.ocrgrid.org/cgi-bin/weocr/submit_tesseract.cgi"; response=""; this.selectedpath=selectedpath; HttpClient client = new DefaultHttpClient(); client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpPost post=new HttpPost(url); MultipartEntity entity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE ); //test start try { File imgFile = new File(selectedpath); int h = 200; // height in pixels int w = 200; // width in pixels Bitmap bm = BitmapFactory.decodeFile(imgFile.getAbsolutePath()); Bitmap bm1 = Bitmap.createScaledBitmap(bm, h, w, true); ByteArrayOutputStream bos = new ByteArrayOutputStream(); bm.compress(CompressFormat.JPEG, 50, bos); byte[] data = bos.toByteArray(); ByteArrayBody bab = new ByteArrayBody(data, "testbin.png"); //test end entity.addPart( "userfile", bab); // For usual String parameters entity.addPart( "outputencoding", new StringBody("utf-8")); entity.addPart( "outputformat", new StringBody("txt")); post.setEntity( entity ); HttpResponse response = client.execute(post); BufferedReader reader = new BufferedReader(new InputStreamReader( response.getEntity().getContent(), "UTF-8")); String sResponse; StringBuilder s = new StringBuilder(); while ((sResponse = reader.readLine()) != null) { s = s.append(sResponse); } this.response=new String(s.toString()); //System.out.println("Response: " + s); // Here we go! //String response = EntityUtils.toString( client.execute( post ).getEntity(), "UTF-8" ); //client.getConnectionManager().shutdown(); //System.out.println(response); //Toast toast=Toast.makeText(getApplicationContext(), response, Toast.LENGTH_LONG); //toast.show(); } catch (Exception e) { Log.e(e.getClass().getName(), e.getMessage()); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload