我创建需要倾斜角度检测的 Android 应用程序。使用该功能处理图像后,在倾斜位置输入图像时,将变为垂直位置。
所以,我使用 Leptonica(tess-two 库)来实现这一点,我使用 FindSkew() 函数这是我的一块源代码:
// 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);
但是当它运行时没有发生,...图片仍然处于倾斜位置。我的错误是什么???您能帮我解决它还是有其他方法可以自动旋转倾斜的图像。谢谢