完成1、2、3、5题

This commit is contained in:
2024-09-23 22:03:17 +08:00
parent 667dc803aa
commit 40200cd979
3 changed files with 22 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import cv2 as cv
# 1
img=cv.imread("sample.jpg",cv.IMREAD_GRAYSCALE)
# 2
def draw_circle(event,x,y,flags,param):
if event==cv.EVENT_LBUTTONDOWN:
cv.circle(img,(x,y),10,0,-1)
#3
cv.namedWindow('modify_sample')
cv.setMouseCallback('modify_sample',draw_circle)
#4
alpha=0.3
beta=80
while(1):
cv.imshow('modify_sample',img)
pressedKey=cv.waitKey(5)
# 5
if pressedKey==ord('q'):
break
if pressedKey==ord('s'):
cv.imwrite('modified_sample.jpg',img)