Bildkorrektur in Android

Ich arbeite an einem Projekt, in dem ich die Bildkorrektur implementieren muss. Ich habe eine Idee dazu. Ich drehe das Bild auf SeekBar um -10 bis +10 Grad. Es funktioniert, indem der weiße Hintergrund sichtbar ist, wenn ich drehe. Daher müssen wir die Zoomfunktion auch so implementieren, dass das Bild wie unten gezeigt gerader wird. Bitte beraten Sie mit Ihren Vorschlägen.

Beispielcode

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);

Antworten auf die Frage(2)

Ihre Antwort auf die Frage