1
2
3'''
4MSER detector demo
5==================
6
7Usage:
8------
9 mser.py [<video source>]
10
11Keys:
12-----
13 ESC - exit
14
15'''
16
17
18from __future__ import print_function
19
20import numpy as np
21import cv2 as cv
22
23import video
24import sys
25
27 try:
28 video_src = sys.argv[1]
29 except:
30 video_src = 0
31
32 cam = video.create_capture(video_src)
33 mser = cv.MSER_create()
34
35 while True:
36 ret, img = cam.read()
37 if ret == 0:
38 break
40 vis = img.copy()
41
42 regions, _ = mser.detectRegions(gray)
45
48 break
49
50 print('Done')
51
52
53if __name__ == '__main__':
54 print(__doc__)
void imshow(const String &winname, InputArray mat)
Displays an image in the specified window.
int waitKey(int delay=0)
Waits for a pressed key.
void destroyAllWindows()
Destroys all of the HighGUI windows.
void cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0, AlgorithmHint hint=cv::ALGO_HINT_DEFAULT)
Converts an image from one color space to another.
void polylines(InputOutputArray img, InputArrayOfArrays pts, bool isClosed, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
Draws several polygonal curves.
void convexHull(InputArray points, OutputArray hull, bool clockwise=false, bool returnPoints=true)
Finds the convex hull of a point set.
int main(int argc, char *argv[])
Definition highgui_qt.cpp:3