-
Notifications
You must be signed in to change notification settings - Fork 0
/
scannertools.html
170 lines (158 loc) · 14.1 KB
/
scannertools.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Scannertools - Scanner</title>
<link rel="stylesheet" href="_static/basic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/custom.css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
<link rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/default.min.css">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-133298183-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-133298183-1');
</script>
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Scanner 0.2.22 documentation</a> »</li>
</ul>
</div>
<div class="container">
<div id="navbar" class="navbar-default">
<div class="row">
<div class="col-md-4 col-sm-12">
<a class="navbar-brand" href="index.html"><span><img src="_static/scanner_logo.png"></span>
</a>
</div>
<div class="col-md-4 offset-md-4 col-sm-12">
<div class="btn-group">
<a href="guide.html"><button type="button" class="btn btn-light">Guide</button></a>
<a href="api.html"><button type="button" class="btn btn-light">API</button></a>
<a href="https://github.com/scanner-research/scanner"><button type="button" class="btn btn-light">Github</button></a>
<a href="publications.html"><button type="button" class="btn btn-light">Publications</button></a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="content">
<div class="section" id="scannertools">
<h1>Scannertools<a class="headerlink" href="#scannertools" title="Permalink to this headline">¶</a></h1>
<p>Scannertools is a high-level python library for scalable video analysis built on Scanner. Scannertools provides easy-to-use, off-the-shelf implementations of:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#object-detection"><span class="std std-ref">Object Detection</span></a></p></li>
<li><p><a class="reference internal" href="#face-detection"><span class="std std-ref">Face Detection</span></a></p></li>
<li><p><a class="reference internal" href="#pose-detection"><span class="std std-ref">Pose Detection</span></a></p></li>
<li><p><a class="reference internal" href="#optical-flow"><span class="std std-ref">Optical Flow</span></a></p></li>
<li><p><a class="reference internal" href="#shot-detection"><span class="std std-ref">Shot Detection</span></a></p></li>
<li><p><a class="reference internal" href="#random-frame"><span class="std std-ref">Random Frame Access</span></a></p></li>
</ul>
<p>Examples are provided below (visuals from <a class="reference external" href="https://www.youtube.com/watch?v=_olbvf_vyrm">this video</a>). auto-generated api documentation is <a class="reference external" href="source/scannertools.html">available here.</a></p>
<div class="section" id="object-detection">
<span id="id1"></span><h2>Object Detection<a class="headerlink" href="#object-detection" title="Permalink to this headline">¶</a></h2>
<p>Find many kinds of objects (people, cars, chairs, …) in a video using <code class="xref py py-func docutils literal notranslate"><span class="pre">detect_objects()</span></code>. <a class="reference external" href="https://github.com/scanner-research/scannertools/blob/master/examples/object_detection.py">full example here</a>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">scannertools.object_detection</span> <span class="k">as</span> <span class="nn">objdet</span>
<span class="kn">import</span> <span class="nn">scannertools.vis</span> <span class="k">as</span> <span class="nn">vis</span>
<span class="n">bboxes</span> <span class="o">=</span> <span class="n">objdet</span><span class="o">.</span><span class="n">detect_objects</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">video</span><span class="p">)</span>
<span class="n">vis</span><span class="o">.</span><span class="n">draw_bboxes</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">video</span><span class="p">,</span> <span class="n">bboxes</span><span class="p">)</span>
</pre></div>
</div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/6xt-yvfcc9i" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>
<div class="section" id="face-detection">
<span id="id2"></span><h2>Face Detection<a class="headerlink" href="#face-detection" title="Permalink to this headline">¶</a></h2>
<p>Find people’s faces in a video using <code class="xref py py-func docutils literal notranslate"><span class="pre">detect_faces()</span></code>. <a class="reference external" href="https://github.com/scanner-research/scannertools/blob/master/examples/face_detection.py">full example here</a>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">scannertools.face_detection</span> <span class="k">as</span> <span class="nn">facedet</span>
<span class="kn">import</span> <span class="nn">scannertools.vis</span> <span class="k">as</span> <span class="nn">vis</span>
<span class="n">bboxes</span> <span class="o">=</span> <span class="n">facedet</span><span class="o">.</span><span class="n">detect_faces</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">video</span><span class="p">)</span>
<span class="n">vis</span><span class="o">.</span><span class="n">draw_bboxes</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">video</span><span class="p">,</span> <span class="n">bboxes</span><span class="p">)</span>
</pre></div>
</div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/iqsb_nbpf9m" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>
<div class="section" id="pose-detection">
<span id="id3"></span><h2>Pose Detection<a class="headerlink" href="#pose-detection" title="Permalink to this headline">¶</a></h2>
<p>Detect people’s poses (two-dimensional skeletons) using <code class="xref py py-func docutils literal notranslate"><span class="pre">detect_poses()</span></code>. <a class="reference external" href="https://github.com/scanner-research/scannertools/blob/master/examples/pose_detection.py">full example here</a>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">scannertools.pose_detection</span> <span class="k">as</span> <span class="nn">posedet</span>
<span class="kn">import</span> <span class="nn">scannertools.vis</span> <span class="k">as</span> <span class="nn">vis</span>
<span class="n">poses</span> <span class="o">=</span> <span class="n">posedet</span><span class="o">.</span><span class="n">detect_poses</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">video</span><span class="p">)</span>
<span class="n">vis</span><span class="o">.</span><span class="n">draw_poses</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">video</span><span class="p">,</span> <span class="n">poses</span><span class="p">)</span>
</pre></div>
</div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/n1bt1yjnvmy" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>
<div class="section" id="optical-flow">
<span id="id4"></span><h2>Optical Flow<a class="headerlink" href="#optical-flow" title="Permalink to this headline">¶</a></h2>
<p>Compute dense motion vectors between frames with <code class="xref py py-func docutils literal notranslate"><span class="pre">compute_flow()</span></code>. <a class="reference external" href="https://github.com/scanner-research/scannertools/blob/master/examples/optical_flow.py">full example here</a>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">scannertools.optical_flow</span> <span class="k">as</span> <span class="nn">optflow</span>
<span class="kn">import</span> <span class="nn">scannertools.vis</span> <span class="k">as</span> <span class="nn">vis</span>
<span class="n">flow_fields</span> <span class="o">=</span> <span class="n">optflow</span><span class="o">.</span><span class="n">compute_flow</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">video</span><span class="p">)</span>
<span class="n">vis</span><span class="o">.</span><span class="n">draw_flow_fields</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">video</span><span class="p">,</span> <span class="n">flow_fields</span><span class="p">)</span>
</pre></div>
</div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/ru048ewgc2y" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>
<div class="section" id="shot-detection">
<span id="id5"></span><h2>Shot Detection<a class="headerlink" href="#shot-detection" title="Permalink to this headline">¶</a></h2>
<p>Find shot changes in a video using <code class="xref py py-func docutils literal notranslate"><span class="pre">detect_shots()</span></code>. <a class="reference external" href="https://github.com/scanner-research/scannertools/blob/master/examples/shot_detection.py">full example here</a>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">scannertools.shot_detection</span> <span class="k">as</span> <span class="nn">shotdet</span>
<span class="n">shots</span> <span class="o">=</span> <span class="n">shotdet</span><span class="o">.</span><span class="n">detect_shots</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">video</span><span class="p">)</span>
<span class="n">montage_img</span> <span class="o">=</span> <span class="n">video</span><span class="o">.</span><span class="n">montage</span><span class="p">(</span><span class="n">shots</span><span class="p">)</span>
<span class="n">tb</span><span class="o">.</span><span class="n">imwrite</span><span class="p">(</span><span class="s1">'shots.jpg'</span><span class="p">,</span> <span class="n">montage_img</span><span class="p">)</span>
</pre></div>
</div>
<a class="reference external image-reference" href="https://storage.googleapis.com/scanner-data/public/sample-shots.jpg"><img alt="https://storage.googleapis.com/scanner-data/public/sample-shots-small.jpg" src="https://storage.googleapis.com/scanner-data/public/sample-shots-small.jpg" /></a>
</div>
<div class="section" id="random-frame-access">
<span id="random-frame"></span><h2>Random Frame Access<a class="headerlink" href="#random-frame-access" title="Permalink to this headline">¶</a></h2>
<p>Extract individual frames from a video with low overhead using <code class="xref py py-meth docutils literal notranslate"><span class="pre">video.frame</span></code>. <a class="reference external" href="https://github.com/scanner-research/scannertools/blob/master/examples/frame_montage.py">full example here</a>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">frame</span> <span class="o">=</span> <span class="n">video</span><span class="o">.</span><span class="n">frame</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="n">tb</span><span class="o">.</span><span class="n">imwrite</span><span class="p">(</span><span class="s1">'frame0.jpg'</span><span class="p">,</span> <span class="n">frame</span><span class="p">)</span>
</pre></div>
</div>
<img alt="https://storage.googleapis.com/scanner-data/public/sample-frame.jpg" src="https://storage.googleapis.com/scanner-data/public/sample-frame.jpg" />
</div>
</div>
</div>
</div>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Scanner 0.2.22 documentation</a> »</li>
</ul>
</div>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/languages/python.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>