We use cookies to give you the best experience possible. By continuing we’ll assume you’re on board with our cookie policy

HOME Cuban Revolution Essay Filter2d opencv python

Filter2d opencv python

#!/usr/bin/env python3

 

"""

File: opencv-open-file-color-test.py

This Python 3 code is normally released through relation towards the particular write-up below:

https://www.bluetin.io/opencv/opencv-color-detection-filtering-python/

Website:    www.bluetin.io

Author:     Draw Heywood

Date:     8/12/2017

Version     0.1.0

License:    MIT

"""

 

from__future__importdivision

importcv2

importnumpy asnp

 

defnothing(*arg):

        pass

 

# Early HSV GUI slider prices to make sure you stress at application start.

icol=(36,202,59,71,255,255)    # Green

#icol = (18, 0, 196, 35, 255, 255)  # Yellow

#icol = (89, 0, 0, 125, 255, 255)  # Blue

#icol = (0, 100, irene zanette phd thesis, 10, 255, 255)   # Red

cv2.namedWindow('colorTest')

# Lower wide range coloring sliders.

cv2.createTrackbar('lowHue','colorTest',icol[0],255,nothing)

cv2.createTrackbar('lowSat','colorTest',icol[1],255,nothing)

cv2.createTrackbar('lowVal','colorTest',icol[2],255,nothing)

# Substantial selection colour combination sliders.

cv2.createTrackbar('highHue','colorTest',icol[3],255,nothing)

cv2.createTrackbar('highSat','colorTest',icol[4],255,nothing)

cv2.createTrackbar('highVal','colorTest',icol[5],255,nothing)

 

# Raspberry pi archive pathway example.

#frame = cv2.imread('/home/pi/python3/opencv/color-test/colour-circles-test.jpg')

# Windows 7 record route example.

frame=cv2.imread('colour-circles-test.jpg')

 

whileTrue:

    # Receive HSV worth as a result of a GUI filter2d opencv python Clearly show products not to mention products around travel in addition to travel related essay main image.

    cv2.imshow('frame',frame)

    

    # Blur methods on the market, provide feedback or possibly uncomment in order to have a go with numerous blur methods.

    frameBGR=cv2.GaussianBlur(frame,(7,7),0)

    #frameBGR = cv2.medianBlur(frameBGR, 7)

    #frameBGR = cv2.bilateralFilter(frameBGR, 15 ,75, 75)

    """kernal = np.ones((15, 15), np.float32)/255

    frameBGR = cv2.filter2D(frameBGR, -1, kernal)"""

    # Demonstrate to blurry image.

    cv2.imshow('blurred',frameBGR)

    # HSV (Hue, Vividness, Value).

    # Transfer any filter2d opencv python to help you HSV colors model.

    hsv=cv2.cvtColor(frameBGR,cv2.COLOR_BGR2HSV)

    

    # HSV figures towards define some color range.

    colorLow=np.array([lowHue,lowSat,lowVal])

    colorHigh=np.array([highHue,highSat,highVal])

    mask=cv2.inRange(hsv,colorLow,colorHigh)

    # Express typically the initially mask

    cv2.imshow('mask-plain',mask)

 

    kernal=cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(7,7))

    mask=cv2.morphologyEx(mask,cv2.MORPH_CLOSE,kernal)

    mask=cv2.morphologyEx(mask,cv2.MORPH_OPEN,kernal)

 

    # Present morphological transformation mask

    cv2.imshow('mask',mask)

    

    # Fit mask more than top for the unique filter2d opencv python Indicate final results image

    cv2.imshow('colorTest',result)

    k=cv2.waitKey(5)&0xFF

    ifk==27:

        break

    

cv2.destroyAllWindows()

  
Related Essays

OpenCV Color choice Discovery

SPECIFICALLY FOR YOU FOR ONLY$24.15 $7.56/page
Order now