MATLAB: Rotate binary object around its centroid

binary imagebinary objectcentroidImage Processing Toolboxrotation

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?

Best 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).