Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

thresholding with OpenCV

#...........................Additional notes............................
'''In addition to cv2.GaussianBlur() filter, other commonly used filters 
are: Average blur, cv2.blur(); Median blur, cv2.medianBlur(); and 
and Bilateral filter, cv2.bilateralFilter. For example, Bilateral filter
can be used to filter high frequecy components while maintaining the
edges of the image, this is the strength of this filter compared to others.
The example below implements the Bilateral filter:'''
import cv2
from matplotlib import pyplot as plt

img = cv2.imread("myimage.jpg")
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

diameter = 30# diameter of the pixels included in the neighborhood.
sigmaColor = 20 # color standard deviation  in the neighborhood.
sigmaSpace = 20 # space standard deviation in the neighborhood
blurred = cv2.bilateralFilter(img, diameter, sigmaColor, sigmaSpace)
plt.imshow(threshdimage, cmap = 'gray', interpolation = 'bicubic')# plot  
plt.xticks([]), plt.yticks([])  # to hide tick values on X and Y axis
plt.show()

Source by pyimagesearch.com #
 
PREVIOUS NEXT
Tagged: #thresholding #OpenCV
ADD COMMENT
Topic
Name
7+1 =