Given an image, this function flips the image 90, 180, 270 and 360 degrees in java (android).
Mat rotate(Mat image){
Mat src = image;
Mat dst1 = new Mat();
/* -1 for 180deg rotation;
0 for flipping along x-axis;
1 for flipping along y-axis; */
Core.flip(src, dst1, -1);
return dst1;
}