Image Straightening を実装する必要があるプロジェクトに取り組んでいます。私はこれを行うためのアイデアを持っています。SeekBar の画像を -10 ~ +10 度回転させています。回転すると白い背景が見えるように動作しています。そのため、以下に示すように、画像がまっすぐに見えるように、ズーム機能も実装する必要があります。あなたの提案でアドバイスしてください。
サンプルコード
float a = (float) Math.atan(bmpHeight/bmpWidth);
// the length from the center to the corner of the green
float len1 = (float) ((bmpWidth/2)/Math.cos(a-Math.abs(curRotate)));
// the length from the center to the corner of the black (^ = power)
float len2 = (float) Math.sqrt((bmpWidth/2)^2 + (bmpHeight/2)^2);
// compute the scaling factor
curScale = len2 / len1;
Matrix matrix = new Matrix();
matrix.postScale(curScale, curScale);
Bitmap resizedBitmap = Bitmap.createBitmap(bitmaprotate, 0, 0, bmpWidth, bmpHeight, matrix, true);
mainImage.setImageBitmap(resizedBitmap);