package com.ocrapp;

import android.app.Activity;

import com.googlecode.tesseract.android.TessBaseAPI;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Environment;

public class Conversion {

	private static final String TESSBASE_PATH = Environment.getExternalStorageDirectory().getPath() + "/tesseract/";
	final String inputText = "Test text";
	private static Bitmap image;
	private static final String DEFAULT_LANGUAGE = "eng";
	
	public static void setImage(Bitmap i){
		image = i;
	}
	
	public static String convertBitmap(){
		final TessBaseAPI baseApi = new TessBaseAPI();
		baseApi.init(TESSBASE_PATH, DEFAULT_LANGUAGE);
		baseApi.setPageSegMode(TessBaseAPI.PageSegMode.PSM_SINGLE_LINE);
		baseApi.setImage(image);
		String text = baseApi.getUTF8Text();
		
		return text;
	}
	
}

@@ -18,38 +18,8 @@
 p;%0A%0A
-import android.app.Activity;%0A%0A
 impo
@@ -104,47 +104,8 @@
 ap;%0A
-import android.graphics.BitmapFactory;%0A
 impo
@@ -335,21 +335,19 @@
  Bitmap 
-image
+bmp
 ;%0A%09priva
@@ -439,21 +439,19 @@
 p i)%7B%0A%09%09
-image
+bmp
  = i;%0A%09%7D
@@ -680,13 +680,11 @@
 age(
-image
+bmp
 );%0A%09

set up