完成1、2、3、5题
This commit is contained in:
@@ -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)
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 153 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 420 KiB |
Reference in New Issue
Block a user