i create Android apps, that need skew angle detection. When image input in a slanting position after the image is processed using that functions, it will turn into a perpendicular position.
So, i use Leptonica (tess-two library) to achieve that, i used FindSkew() function here is my piece source code :
// get bitmap picture
BitmapFactory.Options PictureOptions = new BitmapFactory.Options();
PengaturanGambarCapture.inSampleSize = 2;
Image = BitmapFactory.decodeByteArray(data, 0, data.length, PictureOptions);
// get skew angle value
float SkewValue = Skew.findSkew(ReadFile.readBitmap(Image));
// rotate bitmap using matrix
int w = Image.getWidth();
int h = Image.getHeight();
Matrix MatrixSkew = new Matrix();
MatrixSkew.postRotate(SkewValue);
Bitmap BitmapSkew = Bitmap.createBitmap(Image, 0, 0, w, h, MatrixSkew, true);
// set BitmapSkew to imageview
OutputImage.setImageBitmap(BitmapSkew);
But when it run does not happen, ... the picture still in a tilted position. What's my mistake ??? Would you help me to fix it or you have other ways to rotate tilted images automatically. Thank you