#.\Ball_ROI.py 傷城~ 2022-07-13 13:12 153阅读 0赞 \# -\*- coding: utf-8 -\*- import cv2 import numpy as np \#.\\Ball\_ROI.py \# 创建回调函数 def draw\_circle(event,x,y,flags,param): \# 当按下左键是返回起始位置坐标 if event==cv2.EVENT\_LBUTTONDOWN: print x,y img=cv2.imread('messi5.jpg') cv2.namedWindow('image') cv2.setMouseCallback('image',draw\_circle) cv2.imshow('image',img) cv2.waitKey(0) \#337 304 \#395 356 ball=img\[304:356,337:395\] img\[304:356,277:335\]=ball cv2.imshow('image',img) cv2.waitKey(0) img\[304:356,17:75\]=ball cv2.imshow('image',img) cv2.waitKey(0) img\[304:356,407:465\]=ball cv2.imshow('image',img) cv2.waitKey(0)
还没有评论,来说两句吧...