# -*- 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]=ballcv2.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)