CVR Notes
CVR Notes
Input Image:
Averaging Filter:
import cv2
import numpy as np
img_new = img_new.astype(np.uint8)
cv2.imwrite('blurred.tif', img_new)
Output:
averaging-filter-image-processing
In the above example, it is observed that the filtered image is slightly blurred.
If we increase the size of the averaging mask, more blurring can be obtained.
Median Filtering:
import cv2
import numpy as np
temp = sorted(temp)
img_new1[i, j]= temp[4]
img_new1 = img_new1.astype(np.uint8)
cv2.imwrite('new_median_filtered.png', img_new1)
Output:
median-filter-image-processing
In the above example, we can see that the median filtered image is considerably
enhanced with hardly any salt and pepper noise in it.