I try to run a simple OCR with tessera. My image is very simple as shown below:
So if it works fine, the output is an extracted text as: SONY TV ...
When I run the program on Android, I get the following problem with line: baseApi.init(myDir, "eng");
as it says it couldn't find the source but as shown in the image it is in tssD/tessdata/eng.traineddata.
Here is my original code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String myDir= "tssD/tessdata/eng.traineddata";
String imagePath = "myImages/Remote1.bmp";
ImageView image = (ImageView) findViewById(R.id.imageView1);
Bitmap bMap = BitmapFactory.decodeFile(imagePath);
TessBaseAPI baseApi = new TessBaseAPI();
baseApi.init(myDir, "eng");
baseApi.setImage(bMap);
String recognizedText = baseApi.getUTF8Text();
EditText text = (EditText) findViewById(R.id.editText1);
text.setText(recognizedText);
image.setImageBitmap(bMap);
baseApi.end();
}