Matrix matrix = new Matrix(); imageView.setScaleType(ImageView.ScaleType.MATRIX); //required matrix.postRotate((float) angle, pivotX, pivotY); imageView.setImageMatrix(matrix);
public void setCoeffs(double coeffsVal[]) { coeffs = new double[coeffsVal.length]; for (int i = 0; i < coeffs.length; i++) { coeffs[i] = coeffsVal[i]; } b = new Matrix(coeffs, coeffs.length); }
Matrix rotateRight = new Matrix(); rotateRight.preRotate(90); if(android.os.Build.VERSION.SDK_INT>13 && CameraActivity.frontCamera) { float[] mirrorY = { -1, 0, 0, 0, 1, 0, 0, 0, 1}; rotateRight = new Matrix(); Matrix matrixMirrorY = new Matrix(); matrixMirrorY.setValues(mirrorY); rotateRight.postConcat(matrixMirrorY); rotateRight.preRotate(270); } final Bitmap rImg= Bitmap.createBitmap(img, 0, 0, img.getWidth(), img.getHeight(), rotateRight, true);
// calculate inverse matrix Matrix inverse = new Matrix(); imageView.getImageMatrix().invert(inverse); // map touch point from ImageView to image float[] touchPoint = new float[] {event.getX(), event.getY()}; inverse.mapPoints(touchPoint); // touchPoint now contains x and y in image's coordinate system
float[] mirrorY = { -1, 0, 0, 0, 1, 0, 0, 0, 1}; Matrix matrix = new Matrix(); Matrix matrixMirrorY = new Matrix(); matrixMirrorY.setValues(mirrorY); matrix.postConcat(matrixMirrorY); image = Bitmap.createBitmap(mBitmap, 0, 0, frame.getWidth(), frame.getHeight(), matrix, true)
Matrix rotator = new Matrix(); // rotate around (0,0) rotator.postRotate(90); // or, rotate around x,y // NOTE: coords in bitmap-space! int xRotate = ... int yRotate = ... rotator.postRotate(90, xRotate, yRotate); // to set the position in canvas where the bitmap should be drawn to; // NOTE: coords in canvas-space! int xTranslate = ... int yTranslate = ... rotator.postTranslate(xTranslate, yTranslate); canvas.drawBitmap(bitmap, rotator, paint);
public Bitmap getResizedBitmap(Bitmap bm, int newWidth, int newHeight) { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; // CREATE A MATRIX FOR THE MANIPULATION Matrix matrix = new Matrix(); // RESIZE THE BIT MAP matrix.postScale(scaleWidth, scaleHeight); // "RECREATE" THE NEW BITMAP Bitmap resizedBitmap = Bitmap.createBitmap( bm, 0, 0, width, height, matrix, false); bm.recycle(); return resizedBitmap; }
@Override public double[] getVariances() { return svd.getSingularValues(); }
Matrix matrix = new Matrix(); matrix.postRotate(90); rotatedBitmap = Bitmap.createBitmap(sourceBitmap, 0, 0, sourceBitmap.getWidth(), sourceBitmap.getHeight(), matrix, true);
public void setCoeffs(double coeffsVal[]) { coeffs = new double[coeffsVal.length]; for (int i = 0; i < coeffs.length; i++) { coeffs[i] = coeffsVal[i]; } b = new Matrix(coeffs, coeffs.length); }
Matrix matrix = new Matrix(); matrix.postRotate(90); rotated = Bitmap.createBitmap(original, 0, 0, original.getWidth(), original.getHeight(), matrix, true);
public PCAJama(double[][] gramMatrix) { this.gramMatrix = new Matrix(gramMatrix); runSVD(); }
public void fixOrientation() { if (mBitmap.getWidth() > mBitmap.getHeight()) { Matrix matrix = new Matrix(); matrix.postRotate(90); mBitmap = Bitmap.createBitmap(mBitmap , 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), matrix, true); } }
public static Bitmap rotateImage(Bitmap source, float angle) { Matrix matrix = new Matrix(); matrix.postRotate(angle); return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); }
Matrix matrix = new Matrix(); matrix.postRotate(90); Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmapOrg,width,height,true); Bitmap rotatedBitmap = Bitmap.createBitmap(scaledBitmap , 0, 0, scaledBitmap .getWidth(), scaledBitmap .getHeight(), matrix, true);
public static Bitmap RotateBitmap(Bitmap source, float angle) { Matrix matrix = new Matrix(); matrix.postRotate(angle); return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); }
public static Bitmap RotateBitmap(Bitmap source, float angle) { Matrix matrix = new Matrix(); matrix.postRotate(angle); return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); }