mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
morphology.py sample stub
This commit is contained in:
parent
150c2215bb
commit
7f115db7a7
19
samples/python2/morphology.py
Normal file
19
samples/python2/morphology.py
Normal file
@ -0,0 +1,19 @@
|
||||
import numpy as np
|
||||
import cv2
|
||||
|
||||
img = cv2.imread('../cpp/baboon.jpg', False)
|
||||
|
||||
def callback(k):
|
||||
k = 2*(k-10)
|
||||
st = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (abs(k), abs(k)))
|
||||
op = cv2.MORPH_BLACKHAT
|
||||
if k > 0:
|
||||
op = cv2.MORPH_TOPHAT
|
||||
res = cv2.morphologyEx(img, op, st)
|
||||
cv2.imshow('img', res)
|
||||
|
||||
callback(20)
|
||||
cv2.createTrackbar('k', 'img', 10, 20, callback)
|
||||
|
||||
|
||||
cv2.waitKey()
|
Loading…
Reference in New Issue
Block a user