- blur
OpenCV blur image
- Average the intensity of all the pixels in the kernel (window)
- Median - helps reduce the nois in the image
- Gaussian blur - less blurring than the average blurring, but more natural
- Increasing the ksize (kernel size) and the image will be more blurred.
examples/opencv/blur_average.py
import cv2 as cv import sys if len(sys.argv) != 3: exit(f"Usage: {sys.argv[0]} FILENAME KERNEL") filename = sys.argv[1] kernel = int(sys.argv[2]) original = cv.imread(filename) cv.imshow('Original', original) blurred = cv.blur(original, ksize=(kernel, kernel)) cv.imshow('Blurred', blurred) cv.waitKey(0)