0% found this document useful (0 votes)
67 views3 pages

Image Blurring Techniques in CV2

The document contains Python code that loads an image, applies different blurring filters to it using OpenCV, and displays the original and filtered images for comparison. It reads in an image, converts the color space, applies filters like Gaussian blur, median blur and bilateral blur. It then plots the original and filtered images side by side to show the effects of the different blurring techniques.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views3 pages

Image Blurring Techniques in CV2

The document contains Python code that loads an image, applies different blurring filters to it using OpenCV, and displays the original and filtered images for comparison. It reads in an image, converts the color space, applies filters like Gaussian blur, median blur and bilateral blur. It then plots the original and filtered images side by side to show the effects of the different blurring techniques.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

import cv2

import numpy as np
from matplotlib import pyplot as plt
img = [Link]('[Link]')
img = [Link](img, cv2.COLOR_BGR2RGB)

kernel = [Link]((5, 5), np.float32)/25


dst = cv2.filter2D(img, -1, kernel)
blur = [Link](img, (5, 5))
gblur = [Link](img, (5, 5), 0)
median = [Link](img, 5)
bilateralFilter = [Link](img, 9, 75, 75)

titles = ['image', '2D Convolution', 'blur', 'GaussianBlur', 'median',


'bilateralFilter']
images = [img, dst, blur, gblur, median, bilateralFilter]

for i in range(6):
[Link](2, 3, i+1), [Link](images[i], 'gray')
[Link](titles[i])
[Link]([]),[Link]([])
[Link]()
import cv2
import [Link] as plt
import numpy as np
a = [Link]("[Link]")
b = [Link](a, cv2.COLOR_BGR2RGB )
[Link](a)
[Link]()

import cv2
import [Link] as plt
import numpy as np
a = [Link]("[Link]")
b = [Link](a, cv2.COLOR_BGR2RGB )
[Link](b)
[Link]()
import cv2
import [Link] as plt
import numpy as np
a = [Link]("[Link]")
b = [Link](a, cv2.COLOR_BGR2RGB )
c = [Link]

tinggi = [Link][0]
lebar = [Link][1]
channels = [Link][2]

print('Dimensi =',c)
print('Tinggi =',tinggi)
print('Lebar =',lebar)
print('Channels =',channels)

Hasil Run

You might also like