Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/js/test/test_video.js
16339 views
1
// //////////////////////////////////////////////////////////////////////////////////////
2
//
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4
//
5
// By downloading, copying, installing or using the software you agree to this license.
6
// If you do not agree to this license, do not download, install,
7
// copy or use the software.
8
//
9
//
10
// License Agreement
11
// For Open Source Computer Vision Library
12
//
13
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
14
// Third party copyrights are property of their respective owners.
15
//
16
// Redistribution and use in source and binary forms, with or without modification,
17
// are permitted provided that the following conditions are met:
18
//
19
// * Redistribution's of source code must retain the above copyright notice,
20
// this list of conditions and the following disclaimer.
21
//
22
// * Redistribution's in binary form must reproduce the above copyright notice,
23
// this list of conditions and the following disclaimer in the documentation
24
// and/or other materials provided with the distribution.
25
//
26
// * The name of the copyright holders may not be used to endorse or promote products
27
// derived from this software without specific prior written permission.
28
//
29
// This software is provided by the copyright holders and contributors "as is" and
30
// any express or implied warranties, including, but not limited to, the implied
31
// warranties of merchantability and fitness for a particular purpose are disclaimed.
32
// In no event shall the Intel Corporation or contributors be liable for any direct,
33
// indirect, incidental, special, exemplary, or consequential damages
34
// (including, but not limited to, procurement of substitute goods or services;
35
// loss of use, data, or profits; or business interruption) however caused
36
// and on any theory of liability, whether in contract, strict liability,
37
// or tort (including negligence or otherwise) arising in any way out of
38
// the use of this software, even if advised of the possibility of such damage.
39
//
40
41
// //////////////////////////////////////////////////////////////////////////////////////
42
// Author: Sajjad Taheri, University of California, Irvine. sajjadt[at]uci[dot]edu
43
//
44
// LICENSE AGREEMENT
45
// Copyright (c) 2015 The Regents of the University of California (Regents)
46
//
47
// Redistribution and use in source and binary forms, with or without
48
// modification, are permitted provided that the following conditions are met:
49
// 1. Redistributions of source code must retain the above copyright
50
// notice, this list of conditions and the following disclaimer.
51
// 2. Redistributions in binary form must reproduce the above copyright
52
// notice, this list of conditions and the following disclaimer in the
53
// documentation and/or other materials provided with the distribution.
54
// 3. Neither the name of the University nor the
55
// names of its contributors may be used to endorse or promote products
56
// derived from this software without specific prior written permission.
57
//
58
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS'' AND ANY
59
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
60
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
61
// DISCLAIMED. IN NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY
62
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
63
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
64
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
65
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
66
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
67
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68
//
69
70
if (typeof module !== 'undefined' && module.exports) {
71
// The envrionment is Node.js
72
var cv = require('./opencv.js'); // eslint-disable-line no-var
73
}
74
75
QUnit.module('Video', {});
76
QUnit.test('Background Segmentation', function(assert) {
77
// BackgroundSubtractorMOG2
78
{
79
const history = 600;
80
const varThreshold = 15;
81
const detectShadows = true;
82
83
let mog2 = new cv.BackgroundSubtractorMOG2(history, varThreshold, detectShadows);
84
85
assert.equal(mog2 instanceof cv.BackgroundSubtractorMOG2, true);
86
87
mog2.delete();
88
89
mog2 = new cv.BackgroundSubtractorMOG2();
90
91
assert.equal(mog2 instanceof cv.BackgroundSubtractorMOG2, true);
92
93
mog2.delete();
94
95
mog2 = new cv.BackgroundSubtractorMOG2(history);
96
97
assert.equal(mog2 instanceof cv.BackgroundSubtractorMOG2, true);
98
99
mog2.delete();
100
101
mog2 = new cv.BackgroundSubtractorMOG2(history, varThreshold);
102
103
assert.equal(mog2 instanceof cv.BackgroundSubtractorMOG2, true);
104
105
mog2.delete();
106
}
107
});
108
109