Rotate binary object around its centroid

Hi, I have a small problem. I am trying to rotate image in 2D but around custom axis. I mean, I have a centroid of binary object and now I want to rotate it but around that centroid point. Can somebody help me?

 Accepted Answer

Try using imtranslate() or circshift() to shift the centroid to the middle, then call imrotate(), then shift back to the original location. Otherwise, just use the rotation matrix (see Wikipedia).

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!