使用 OpenCV 函式 blur() 模糊影像
在本教程中,我們將使用 opencv 函式 blur() 模糊影像。
演算法
Step 1: Import OpenCV. Step 2: Import the image. Step 3: Set the kernel size. Step 4: Call the blur() function and pass the image and kernel size as parameters. Step 5: Display the results.
原始影像
示例程式碼
import cv2 image = cv2.imread("testimage.jpg") kernel_size = (7,7) image = cv2.blur(image, kernel_size) cv2.imshow("blur", image)
輸出
模糊影像
解釋
核大小用於僅模糊影像的一小部分。核在整個影像上移動並模糊其覆蓋的畫素。
廣告