i am trying to understand how does the image rotation occur? i studied and came to know that we just multiply the image coordinates with rotation matrix which gives us the value of new coordinates. ok that is fine i get this. But main thing which is confusing me is the pixel values. i read that the pixel coordinates which we get after rotation can be non decimal hence interpolation is needed to get value at that point for this we rotate image back to original coordinate and find value by interpolation. But if we will rotate it back to original coordinate the the pixel will regain its original coordinate and at that coordinates value w are already having the value then why to do interpolation.please somebody clear my confusion.
3 Answers
When you multiply the image matrix with the rotation matrix, you are essentially multiplying an integer matrix with a real number matrix. The result is a real matrix, which has to be quantized back to a discrete matrix.
What is being quantized? The coordinates themselves. The integer coordinates of the previous position of the pixel is now a real valued coordinate, which must be converted back to an integer in order to be placed on the screen.
If you were asked to rotate it back to the original angle you could have been right in questioning the futility of interpolation. However, the user might not want to rotate it back, so you have to perform interpolation or quantization to be able to use the rotated image. If you are concerned about image fidelity, you might want to save a copy of the original real valued matrix in memory or file until or opertions are finished and the user exits program.
Here is a useful link you might want to peruse.
You can round to the nearest pixel before rotating back to get the interpolation values. I think there are better ways of handling it though.
Image is a matrix.You can see the Jacobian matrix in linear algebra to understand how the shifting of the Axes occurs