public static int[] rotate(int[] pix, float beta, int iw, int ih, int owh) {
		int[] opix = new int[owh * owh];
		double t = beta / 180;
		float cos_beta = (float) Math.cos(t * Math.PI);
		float sin_beta = (float) Math.sin(t * Math.PI);
		for (int i = 0; i < owh; i++) {
			for (int j = 0; j < owh; j++) {
				float u = (j - owh / 2) * cos_beta + (i - owh / 2) * sin_beta;
				float v = (i - owh / 2) * cos_beta + (j - owh / 2) * sin_beta;

				u += iw / 2;
				v += ih / 2;
				int x = (int) u;
				int y = (int) v;

				int index = i * owh + j;
				if (x >= 0 && x <= iw - 1 && y >= 0 && y <= ih - 1) {
					opix[index] = pix[y * iw + x];
				}

			}
		}
		return opix;
	}