When I try to rotate the landscape image into the portrait after applying the rotation, I cannot draw the image.
img1 = cv2.imread('a.jpg') cv2.circle(img1, tuple([10,10]),radius = 3, color = (255,0,0))
works great.
Then I try:
img2 = np.rot90(img1,3) cv2.circle(img2, tuple([10,10]),radius = 3, color = (255,0,0))
and I get the error:
TypeError: Layout of the output array img is incompatible with cv::Mat (step[ndims-1] != elemsize or step[1] != elemsize*nchannels)
Looking at type(img2) and img2.dtype , it seems identical to img1. the dimensions also seem beautiful (the first two dimensions are inverted, the third remains “3”)
By the way: it seems to work. (Why?):
img2 = np.rot90(img1,3) img3 = img2.copy() cv2.circle(img3, tuple([10,10]),radius = 3, color = (255,0,0))
source share