opencv python 入门实例

import cv2
import numpy as np

img=np.ones((512,512,3), np.uint8)*255


cv2.circle(img,center=(256,256), radius=128, color=(0,0,255), thickness=-1)

cv2.circle(img,center=(256,256), radius=80, color=(255,255,255), thickness=-1)

cv2.line(img,pt1=(256-128,256),pt2=(256-80,256),color=(255,0,0),thickness=2)

cv2.line(img,pt1=(256,256-80),pt2=(256,256-128),color=(255,0,0),thickness=2)

cv2.floodFill(img, mask = np.zeros([512+2, 512+2], np.uint8), seedPoint=(256-80-1,256-80-1), newVal=(0,255,0))

winname = 'img'
cv2.namedWindow(winname)
cv2.imshow(winname, img)
cv2.waitKey(0)
cv2.destroyWindow(winname)

opencv python 入门实例_第1张图片

你可能感兴趣的:(Python,OpenCV)