PYTHON+OPENCV implementation of Gaussian smoothing filter

Source: Internet
Author: User

Function:

Create two sliders to control the size of the Gaussian kernel and σ The size of this program is changed on the threshold partition of the program. The threshold splitting program is in this
Note: because σ=0 , OpenCV calculates the window size based on the σ , so, sliding from 0 σ Slider, there is a clear and blurred first edge

PYTHON+OPENCV Realization of threshold segmentation
Python+opencv realizes the Huffman transformation detection line

(2016-5-10) to Opencv-python tutorials ' s documentation! can be downloaded

Code:
#-*-Coding:utf-8-*-ImportCv2#两个回调函数 def gaussianblursize(gaussianblur_size):    GlobalKsize ksize = gaussianblur_size *2+3    PrintKsize, SIGMA DST = Cv2. Gaussianblur (SCR, (ksize,ksize), SIGMA, Ksize) cv2.imshow (WINDOW_NAME,DST) def gaussianblursigma(gaussianblur_sigma):    GlobalSigma Sigma = gaussianblur_sigma/10.0    PrintKsize, SIGMA DST = Cv2. Gaussianblur (SCR, (ksize,ksize), SIGMA, Ksize) cv2.imshow (WINDOW_NAME,DST)#全局变量Gaussianblur_size =1Gaussianblur_sigma = theKsize =1SIGMA = theMax_value = -Max_type =6Window_name ="Gaussianblurs Demo"Trackbar_size ="Size*2+3"Trackbar_sigema ="SIGMA/10"#读入图片, the pattern is a grayscale chart, creating a windowSCR = Cv2.imread ("G:\homework\lena.bmp",0) Cv2.namedwindow (Window_name)#创建滑动条Cv2.createtrackbar (Trackbar_size, Window_name, Gaussianblur_size, Max_type, gaussianblursize) cv2.cre Atetrackbar (Trackbar_sigema, Window_name, Gaussianblur_sigma, Max_value, Gaussianblursigma)#初始化Gaussianblursize (1) Gaussianblursigma ( the)ifCv2.waitkey (0) == -: Cv2.destroyallwindows ()
Call:

Need to put pictures and cv2.pyd with gaussianblur.py in the same folder

>>>ImportOs>>>Os.chdir ("G:\homework")>>>ImportGaussianblur5  the5 1.55 1.65 1.95 2.45 2.55 2.95 3.05 3.35 3.65 3.95 4.15 4.25 4.35 4.45 4.55 4.65 4.75 4.8

PYTHON+OPENCV implementation of Gaussian smoothing filter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.