import cv2
x,y = 0,0
movex,movey = 50,0
color = (255,255,255)
s = True
r=5
g = 1
h = 1
x,y = x+r,y+r
z = 1
f = 1
img = cv2.imread("E:\wangzc\code\.math\\a.png")
while True:
if s == True:
img = cv2.imread("E:\wangzc\code\.math\\a.png")
print(movex,movey,x,y)
if x
movex = -movex
movey+=g
if movey<0:
if abs(movey)<=z*g:
movey=0
else:
movey+=z*g
elif movey>0:
if abs(movey)<=z*g:
movey=0
else:
movey-=z*g
else:
movey =0
if movex<0:
if abs(movex)<=f:
movex=0
else:
movex+=f
elif movex>0:
if abs(movex)<=f:
movex=0
else:
movex-=f
else:
movex =0
if y
movey=-movey
if movex<0:
if abs(movex)<=z*g:
movex=0
else:
movex+=z*g
elif movex>0:
if abs(movex)<=z*g:
movex=0
else:
movex-=z*g
else:
movex =0
movey+=g
if movey<0:
if abs(movey)<=f:
movey=0
else:
movey+=f
elif movey>0:
if abs(movey)<=f:
movey=0
else:
movey-=f
else:
movey =0
movey+=h*g
if x>img.shape[1]-r-1:
x=img.shape[1]-r-1
if y>img.shape[0]-r-1:
y = img.shape[0]-r-1
if x<=r:
x=r
if y<=r:
y=r
for i in range(r+1):
cv2.circle(img,(x,y),i,color)
print(movex,movey,x,y)
x+=movex
y+=movey
cv2.imshow('img',img)
a = cv2.waitKey(0)
if a==27:
break