Rotate image by 90, 180 or 270 degrees

后端 未结 11 2215
一个人的身影
一个人的身影 2020-12-01 07:48

I need to rotate an image by either 90, 180 or 270 degrees. In OpenCV4Android I can use:

Imgproc.getRotationMatrix2D(new Point(center, center), degrees, 1);         


        
11条回答
  •  攒了一身酷
    2020-12-01 08:35

    Use the numpy.rot90,if you want 180 degrees,just do it twice.

    import numpy as np
    import cv2
    
    img = cv2.imread('img.png',1)
    cv2.imshow('',img)
    cv2.waitKey(0)
    
    img90 = np.rot90(img)
    cv2.imshow('',img90)
    cv2.waitKey(0)
    

提交回复
热议问题