// -----CALCULATION FOR NEW WIDTH/HEIGHT------
double radians = Math.toRadians(Angle);
double sin = Math.abs(Math.sin(radians));
double cos = Math.abs(Math.cos(radians));
double radian = Math.toRadians(waterMarkAngle);
int newWidth = (int) (scaledImage.width() * cos + scaledImage.height() * sin);
int newHeight = (int) (scaledImage.width() * sin + scaledImage.height() * cos);
// rotating water image
org.opencv.core.Point center = new org.opencv.core.Point(newWidth/2, newHeight/2);
Mat rotImage = Imgproc.getRotationMatrix2D(center, waterMarkAngle, 1.0); // 1.0 means 100 % scale
Size s = new Size(newWidth, newHeight);
Imgproc.warpAffine(scaledImage, scaledImage, rotImage, s,Imgproc.INTER_LINEAR + Imgproc.CV_WARP_FILL_OUTLIERS);//
Highgui.imwrite("mnt/sdcard/rotatedWatermark.png",scaledImage);
Thanks in advance.