rotate a tif image
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Busy Bee
el 7 de Feb. de 2018
I have a tif image which I need to rotate by an angle theta keeping the cg and coordinate axes constant.(i have attached my .tif image). In the example given below, i have rotated the image by 45 degree anticlockwise but it is getting distorted and the cg is also moving. Any help is appreciated.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170028/image.jpeg)
to
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170029/image.jpeg)
8 comentarios
Jan
el 7 de Feb. de 2018
@Busy Bee: Really? You have the coordinates of the vertices? (By the way: coordinates are not "known around a centroid") And you want to attach a TIF file? Why not providing the positions as code?
Respuesta aceptada
Guillaume
el 7 de Feb. de 2018
Editada: Guillaume
el 8 de Feb. de 2018
"Rotating the polygon whose vertices are known around its centroid."
Not sure why a tif image was mentioned then.
Assuming you're on R2017b or later:
polygon = polyshape(vertices); %vertices is a Nx2 matrix of points
[centroidx, centroidy] = centroid(polygon);
rotated_polygon = rotate(polygon, angle, [centroidx centroidy]);
plot([polygon rotated_polygon])
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!