title: Tesseract - Help me understand datapath
body: <p>Can someone explain what exactly is going on and how I can rectify it.  So I understand tesseract has to have an image to target and presumably this would be the bitmap I've captured and tried to save.  That saved location would be my _path variable.  Now what is the DATA_PATH for tesseract? Does the image need to be stored in a folder called 'tesseract' ? Do I create that folder and store some kind of training in it? I'm looking for an explanation rather than a code example. </p>
  
  <p><a href="http://gaut.am/making-an-ocr-android-app-using-tesseract/" rel="nofollow">http://gaut.am/making-an-ocr-android-app-using-tesseract/</a> - I am trying to follow this tutorial and checking others to try and understand the paths which all of them use.</p>
  
  <pre><code>public class MainActivity extends Activity {
  private static ImageView imageView;
  protected String _path;
  // protected static Bitmap bit;
  static File myDir;
  protected static Bitmap mImageBitmap;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      this.imageView = (ImageView) this.findViewById(R.id.imageView1);
      Button photoButton = (Button) this.findViewById(R.id.button1);
  
      _path =  Environment.getExternalStorageDirectory() + "/images/test.bmp";
  
      Toast t = Toast.makeText(getApplicationContext(), "HEELLLLLLOO", 100000);
      t.show();
      photoButton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              // CALL THE PICTURE
              dispatchTakePictureIntent(0);
  
          }
      });
  }
  
  private void handleSmallCameraPhoto(Intent intent) {
      Bundle extras = intent.getExtras();
      mImageBitmap = (Bitmap) extras.get("data");
      imageView.setImageBitmap(mImageBitmap);
  
      BitmapFactory.Options options = new BitmapFactory.Options();
      options.inSampleSize = 4;
  
      Bitmap bitmap = BitmapFactory.decodeFile( _path, options );
  
      imageView.setImageBitmap(bitmap);
  
      //_path = path to the image to be OCRed
      ExifInterface exif;
      try {
          exif = new ExifInterface(_path);
  
      int exifOrientation = exif.getAttributeInt(
              ExifInterface.TAG_ORIENTATION,
              ExifInterface.ORIENTATION_NORMAL);
      int rotate = 0;
      switch (exifOrientation) {
      case ExifInterface.ORIENTATION_ROTATE_90:
          rotate = 90;
          break;
      case ExifInterface.ORIENTATION_ROTATE_180:
          rotate = 180;
          break;
      case ExifInterface.ORIENTATION_ROTATE_270:
          rotate = 270;
          break;
      }
      if (rotate != 0) {
          int w = bitmap.getWidth();
          int h = bitmap.getHeight();
          // Setting pre rotate
          Matrix mtx = new Matrix();
          mtx.preRotate(rotate);
          // Rotating Bitmap &amp; convert to ARGB_8888, required by tess
          bitmap = Bitmap.createBitmap(bitmap, 0, 0, w, h, mtx, false);
          bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
      }
  
  
  
      TessBaseAPI baseApi = new TessBaseAPI();
      // DATA_PATH = Path to the storage
      // lang for which the language data exists, usually "eng"
      baseApi.init(_path, "eng");  //THIS SHOULD BE DATA_PATH ?
      baseApi.setImage(bitmap);
      String recognizedText = baseApi.getUTF8Text();
      System.out.println(recognizedText);
      baseApi.end();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  protected void onActivityResult(int requestCode, int resultCode, Intent data){
      handleSmallCameraPhoto(data);
  }
  
  private void dispatchTakePictureIntent(int actionCode) {
      Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      startActivityForResult(takePictureIntent, actionCode);
  }
  
  protected static void identifyunicode() {
      // DATA_PATH = Path to the storage
      // lang for which the language data exists, usually "eng"
  
      /*
       * TessBaseAPI baseApi = new TessBaseAPI();
       * baseApi.init(myDir.toString(), "eng"); // myDir + //
       * "/tessdata/eng.traineddata" // must be present baseApi.setImage(bit);
       * String recognizedText = baseApi.getUTF8Text(); // Log or otherwise //
       * display this // string... baseApi.end();
       */
  }
  </code></pre>
  
  <p>}</p>