Sometimes, just a piece is enough

Or a crop. In case you were wondering, I’m talking about cropping a picture, to garner greater accuracy in the OCR engine results. Sometimes we just don’t want to OCR everything!

To do this I had to have a separate intent to crop the picture and I used the “com.android.camera.action.CROP” activity for the intent and set the settings as follows:

cropIntent.setDataAndType(outputFileUri, “image/*”);
// set crop properties
cropIntent.putExtra(“crop”, “true”);
cropIntent.putExtra(“aspectX”, 1);
cropIntent.putExtra(“aspectY”, 1);
// indicate output X and Y
cropIntent.putExtra(“outputX”, 256);
cropIntent.putExtra(“outputY”, 256);
cropIntent.putExtra(“scale”, true);
// retrieve data on return
cropIntent.putExtra(“return-data”, true);

This helped me generate a nice crop box with edit-able properties, unfortunately it is always a square and not editable. So I will have to figure out a way to make it rectangular. However, Sprint 2 is going well! Hope to get to the OCR Regex-ing soon! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s