I am trying rotate a matrix, an image more specifically, by a alpha degree. I am using a rotation matrix in order find rotate it but if the matrix is not square then the rotation fails and gives an corrupt output.
let's see we have a mxn matrix
for i to m
for j to n
new_i = i*cos(alpha) - j*sin(alpha)
new_j = i*sin(alpha) + j*cos(alpha)
write the value of sourceimage[i][j] to a new image[new_i][new_j]
What am i missing here?
The problem has nothing to do with the shape of the matrix. You are accessing illegal indexes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.