import time
import picamera
import picamera.array
import cv2
with picamera.PiCamera() as camera:
with picamera.array.PiRGBArray(camera) as stream:
camera.resolution = (320,240)
while True:
camera.capture(stream,'bgr',use_video_port=True)
cv2.imshow('video',stream.array)
gray = cv2.cvtColor(stream.array,cv2.COLOR_BGR2GRAY)
cv2.imshow('grayimage',gray)
med1 = cv2.medianBlur(gray,3)#median filtering
cv2.imshow('median',med1)
gbl= cv2.GaussianBlur(med1,(5,5),0)
cv2.imshow('guassian',gb1)
if cv2.waitKey(1) & 0xFF == ord('q'):
cv2.destroyAllWindows()
break
stream.seek(0)
stream.truncate()
我一直在尝试对视频输出进行高斯模糊。在许多站点中,我看到 5x5 的内核大小给出了适当的结果。我想执行模糊半径为 2 的模糊。如何确认半径为 5x5 的内核的半径是多少?或者有什么方法可以形成一个输出模糊半径为 2 的内核?