python code如下:
print('利用cv2.selectROI來取圖') import cv2 for i in range(1,13): im=cv2.imread('0.png') # print(im.shape) r=cv2.selectROI('roi', im ) # print(r) # print(type(r)) x,y,w,h=r im2=im[y:y+h, x:x+w] im2=cv2.resize(im2, (im2.shape[1]*2, im2.shape[0]*2), 4) cv2.imshow('select'+str(i), im2) cv2.imwrite(str(i)+'.png', im2) cv2.waitKey(0) cv2.destroyAllWindows()
沒有留言:
張貼留言