remote-calibrator 0.2.2-beta.2 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -1
- package/lib/RemoteCalibrator.min.js +1 -1
- package/lib/RemoteCalibrator.min.js.LICENSE.txt +1 -1
- package/lib/RemoteCalibrator.min.js.map +1 -1
- package/media/measureDistance.png +0 -0
- package/media/panel.png +0 -0
- package/media/screenSize.png +0 -0
- package/media/trackGaze.png +0 -0
- package/package.json +4 -4
- package/src/components/sound.js +2 -2
- package/src/css/main.css +7 -6
- package/src/screenSize.js +1 -1
- package/src/WebGazer4RC/.gitattributes +0 -10
- package/src/WebGazer4RC/LICENSE.md +0 -15
- package/src/WebGazer4RC/README.md +0 -142
- package/src/WebGazer4RC/gnu-lgpl-v3.0.md +0 -163
- package/src/WebGazer4RC/gplv3.md +0 -636
- package/src/WebGazer4RC/package-lock.json +0 -1133
- package/src/WebGazer4RC/package.json +0 -28
- package/src/WebGazer4RC/src/dom_util.mjs +0 -27
- package/src/WebGazer4RC/src/facemesh.mjs +0 -150
- package/src/WebGazer4RC/src/index.mjs +0 -1213
- package/src/WebGazer4RC/src/mat.mjs +0 -301
- package/src/WebGazer4RC/src/params.mjs +0 -29
- package/src/WebGazer4RC/src/pupil.mjs +0 -109
- package/src/WebGazer4RC/src/ridgeReg.mjs +0 -104
- package/src/WebGazer4RC/src/ridgeRegThreaded.mjs +0 -161
- package/src/WebGazer4RC/src/ridgeWeightedReg.mjs +0 -125
- package/src/WebGazer4RC/src/ridgeWorker.mjs +0 -135
- package/src/WebGazer4RC/src/util.mjs +0 -348
- package/src/WebGazer4RC/src/util_regression.mjs +0 -240
- package/src/WebGazer4RC/src/worker_scripts/mat.js +0 -306
- package/src/WebGazer4RC/src/worker_scripts/util.js +0 -398
- package/src/WebGazer4RC/test/regression_test.js +0 -182
- package/src/WebGazer4RC/test/run_tests_and_server.sh +0 -24
- package/src/WebGazer4RC/test/util_test.js +0 -60
- package/src/WebGazer4RC/test/webgazerExtract_test.js +0 -40
- package/src/WebGazer4RC/test/webgazer_test.js +0 -160
- package/src/WebGazer4RC/test/www_page_test.js +0 -41
@@ -1,40 +0,0 @@
|
|
1
|
-
const puppeteer = require('puppeteer');
|
2
|
-
const { assert } = require('chai');
|
3
|
-
const TFFaceMesh = require('@tensorflow-models/facemesh');
|
4
|
-
|
5
|
-
describe('webgazerExtract functions', async () => {
|
6
|
-
let browser,page;
|
7
|
-
before(async () => {
|
8
|
-
browser = await puppeteer.launch()
|
9
|
-
page = await browser.newPage();
|
10
|
-
await page.goto('http://localhost:8000/webgazerExtractClient.html');
|
11
|
-
})
|
12
|
-
after(async () => {
|
13
|
-
await browser.close();
|
14
|
-
})
|
15
|
-
it('should load elements', async() =>{
|
16
|
-
const elements = await page.evaluate(() => {
|
17
|
-
return {myMouse:document.getElementById('myMouse'),
|
18
|
-
tobiiGP:document.getElementById('tobiiGP'),
|
19
|
-
wsCanvas: document.getElementById('wsCanvas'),
|
20
|
-
screencap: document.getElementById('screencap'),
|
21
|
-
showScreenCap: document.getElementById('showScreenCap'),
|
22
|
-
scTimeOffsetDiv: document.getElementById('scTimeOffsetDiv'),
|
23
|
-
diagDiv: document.getElementById('diagDiv')}
|
24
|
-
})
|
25
|
-
for(const [k,v] of Object.entries(elements)){
|
26
|
-
assert.equal((Object.keys(v).length === 0
|
27
|
-
&& v.constructor === Object), true)
|
28
|
-
}
|
29
|
-
});
|
30
|
-
|
31
|
-
it('webgazer properties should be set correctly', async() =>{
|
32
|
-
await page.waitForSelector('#overlay');
|
33
|
-
let model = await page.evaluate(async() => {
|
34
|
-
let tracker = webgazer.getTracker();
|
35
|
-
return tracker.name
|
36
|
-
})
|
37
|
-
assert.equal(model,'TFFaceMesh')
|
38
|
-
})
|
39
|
-
});
|
40
|
-
|
@@ -1,160 +0,0 @@
|
|
1
|
-
const puppeteer = require('puppeteer');
|
2
|
-
const { assert } = require('chai');
|
3
|
-
const TFFaceMesh = require('@tensorflow-models/facemesh');
|
4
|
-
|
5
|
-
before(async () => {
|
6
|
-
const parent_dir = __dirname.substring(0,__dirname.length-4)
|
7
|
-
let my_y4m_video = parent_dir + 'www/data/src/P_01/dot.y4m'
|
8
|
-
browser = await puppeteer.launch({args:['--use-file-for-fake-video-capture='+my_y4m_video,
|
9
|
-
'--allow-file-access', '--use-fake-device-for-media-stream','--use-fake-ui-for-media-stream',
|
10
|
-
'--no-sandbox','--disable-setuid-sandbox',
|
11
|
-
]
|
12
|
-
//,devtools:true //enable for debugging
|
13
|
-
});
|
14
|
-
page = await browser.newPage();
|
15
|
-
await page.goto('http://localhost:3000/calibration.html?');
|
16
|
-
page.coverage.startJSCoverage();
|
17
|
-
await page.goto('http://localhost:3000/calibration.html?');
|
18
|
-
await page.waitFor(1500)
|
19
|
-
await page.waitForSelector('#start_calibration')
|
20
|
-
//calibration button is not immediately clickable due to css transition
|
21
|
-
await page.waitFor(2500)
|
22
|
-
|
23
|
-
await page.evaluate(async() => {
|
24
|
-
document.querySelector("#start_calibration").click()
|
25
|
-
})
|
26
|
-
await page.waitFor(1500)
|
27
|
-
await page.evaluate(async() =>{
|
28
|
-
document.querySelector("body > div.swal-overlay.swal-overlay--show-modal > div > div.swal-footer > div > button").click()
|
29
|
-
})
|
30
|
-
})
|
31
|
-
describe('webgazer function', async() => {
|
32
|
-
after(async () => {
|
33
|
-
const jsCoverage = await page.coverage.stopJSCoverage();
|
34
|
-
let usedBytes = 0;
|
35
|
-
let webgazer_coverage;
|
36
|
-
jsCoverage.forEach(item => {if (item.url == "http://localhost:3000/webgazer.js")
|
37
|
-
{webgazer_coverage = item}
|
38
|
-
})
|
39
|
-
webgazer_coverage.ranges.forEach(range => (usedBytes += range.end - range.start - 1));
|
40
|
-
console.log((100*usedBytes/webgazer_coverage.text.length).toFixed(4), "% Code Coverage on webgazer.js")
|
41
|
-
await browser.close();
|
42
|
-
})
|
43
|
-
describe('top level functions', async() =>{
|
44
|
-
it('should be able to recognize video input', async() =>{
|
45
|
-
const videoAvailable = await page.evaluate(async() => {
|
46
|
-
return await webgazer.params.showFaceFeedbackBox;
|
47
|
-
});
|
48
|
-
const isReady = await page.evaluate(async() => {
|
49
|
-
return await webgazer.isReady()
|
50
|
-
});
|
51
|
-
assert.equal(videoAvailable,true);
|
52
|
-
assert.equal(isReady,true);
|
53
|
-
});
|
54
|
-
//modifying visibility params
|
55
|
-
it('webgazerVideoFeed should display', async() => {
|
56
|
-
let video_display = await page.evaluate(async() => {
|
57
|
-
return document.getElementById('webgazerVideoFeed').style.display
|
58
|
-
})
|
59
|
-
assert.notEqual(video_display,"none");
|
60
|
-
})
|
61
|
-
it('webgazerFaceFeedbackBox should display', async() => {
|
62
|
-
await page.waitForSelector('#webgazerFaceFeedbackBox')
|
63
|
-
let face_overlay = await page.evaluate(async() => {
|
64
|
-
return document.getElementById('webgazerFaceFeedbackBox').style.display
|
65
|
-
})
|
66
|
-
assert.notEqual(face_overlay,"none");
|
67
|
-
})
|
68
|
-
it('webgazerGazeDot should display', async() => {
|
69
|
-
let webgazer_gazedot = await page.evaluate(async() => {
|
70
|
-
return document.getElementById('webgazerGazeDot').style.display
|
71
|
-
})
|
72
|
-
assert.notEqual(webgazer_gazedot,"none");
|
73
|
-
})
|
74
|
-
it('faceoverlay should hide when showFaceOverlay is false', async() => {
|
75
|
-
face_overlay = await page.evaluate(async() => {
|
76
|
-
await webgazer.showFaceFeedbackBox(false)
|
77
|
-
return document.getElementById('webgazerFaceFeedbackBox').style.display
|
78
|
-
})
|
79
|
-
assert.equal(face_overlay,"none");
|
80
|
-
})
|
81
|
-
it('webgazerGazeDot should hide when showPredictionPoints is false', async() =>{
|
82
|
-
let webgazer_gazedot = await page.evaluate(async() => {
|
83
|
-
await webgazer.showPredictionPoints(false)
|
84
|
-
return document.getElementById('webgazerGazeDot').style.display
|
85
|
-
})
|
86
|
-
assert.equal(webgazer_gazedot,"none");
|
87
|
-
})
|
88
|
-
it('webgazerVideoFeed should hide when showVideo is false', async() => {
|
89
|
-
video_display = await page.evaluate(async() => {
|
90
|
-
await webgazer.showVideo(false)
|
91
|
-
return document.getElementById('webgazerVideoFeed').style.display
|
92
|
-
});
|
93
|
-
assert.equal(video_display,"none");
|
94
|
-
})
|
95
|
-
it('getVideoElementCanvas should exist and be a canvas element', async() => {
|
96
|
-
let video_element_canvas_type = await page.evaluate(async() => {
|
97
|
-
return await webgazer.getVideoElementCanvas().nodeName
|
98
|
-
})
|
99
|
-
assert.equal(video_element_canvas_type,'CANVAS')
|
100
|
-
})
|
101
|
-
it('preview to camera resolution ratio should be [0.5,0.5]', async() =>{
|
102
|
-
let preview_to_camera_resolution_ratio = await page.evaluate(async() => {
|
103
|
-
return await webgazer.getVideoPreviewToCameraResolutionRatio()
|
104
|
-
})
|
105
|
-
assert.equal(preview_to_camera_resolution_ratio[0],0.5)
|
106
|
-
assert.equal(preview_to_camera_resolution_ratio[1],0.5)
|
107
|
-
})
|
108
|
-
it('should be able to change video viewer size', async()=>{
|
109
|
-
const video_dimensions = await page.evaluate(async()=>{
|
110
|
-
return [webgazer.params.videoViewerWidth,webgazer.params.videoViewerHeight]
|
111
|
-
})
|
112
|
-
const new_dimensions = [video_dimensions[0],video_dimensions[1]]
|
113
|
-
const new_video_dimensions = await page.evaluate(async(new_dimensions)=>{
|
114
|
-
await webgazer.setVideoViewerSize(new_dimensions[0],new_dimensions[1])
|
115
|
-
return [webgazer.params.videoViewerWidth,webgazer.params.videoViewerHeight]
|
116
|
-
},new_dimensions)
|
117
|
-
assert.equal(new_video_dimensions[0],new_dimensions[0])
|
118
|
-
assert.equal(new_video_dimensions[1],new_dimensions[1])
|
119
|
-
})
|
120
|
-
it('top level, non-video no arguments webgazer functions should work', async() =>{
|
121
|
-
let basic_functions = await page.evaluate(async() => {
|
122
|
-
return {getCurrentPrediction: JSON.stringify(await webgazer.getCurrentPrediction()),
|
123
|
-
addMouseEventListeners: JSON.stringify(await webgazer.addMouseEventListeners()),
|
124
|
-
getStoredPoints:JSON.stringify(await webgazer.getStoredPoints()),
|
125
|
-
removeMouseEventListeners:JSON.stringify(await webgazer.removeMouseEventListeners()),
|
126
|
-
isReady:JSON.stringify(await webgazer.isReady()),
|
127
|
-
detectCompatibility:JSON.stringify(await webgazer.detectCompatibility()),
|
128
|
-
clearGazeListener:JSON.stringify(await webgazer.clearGazeListener()),
|
129
|
-
getRegression:JSON.stringify(await webgazer.getRegression()),
|
130
|
-
getStoredPoints:JSON.stringify(await webgazer.getStoredPoints()),
|
131
|
-
pause:JSON.stringify(await webgazer.pause())
|
132
|
-
}
|
133
|
-
})
|
134
|
-
|
135
|
-
|
136
|
-
for(const [k,v] of Object.entries(basic_functions)){
|
137
|
-
assert.notEqual(Object.keys(v),null)
|
138
|
-
assert.notEqual(Object.keys(v),{})
|
139
|
-
}
|
140
|
-
|
141
|
-
assert.equal(basic_functions.isReady,"true")
|
142
|
-
assert.equal(basic_functions.detectCompatibility,"true")
|
143
|
-
})
|
144
|
-
it('can record screen position, set tracker and regression and set static video', async() =>{
|
145
|
-
const screen_functions = page.evaluate(async() => {
|
146
|
-
return {setStaticVideo: await webgazer.setStaticVideo('../www/data/src/P_02/1491487691210_2_-study-dot_test_instructions.webm'),
|
147
|
-
setTracker: await webgazer.setTracker('TFFacemesh'),
|
148
|
-
setRegression: await webgazer.setRegression('ridge')}
|
149
|
-
})
|
150
|
-
for(const [k,v] of Object.entries(screen_functions)){
|
151
|
-
assert.notEqual(Object.keys(v),null)
|
152
|
-
assert.notEqual(Object.keys(v),{})
|
153
|
-
}
|
154
|
-
})
|
155
|
-
//checkEyesInValidationBox exists in code but the comment above says it's wrong and it returns nothing
|
156
|
-
})
|
157
|
-
require('./regression_test')
|
158
|
-
require('./util_test')
|
159
|
-
|
160
|
-
})
|
@@ -1,41 +0,0 @@
|
|
1
|
-
const puppeteer = require('puppeteer');
|
2
|
-
const { assert } = require('chai');
|
3
|
-
|
4
|
-
describe('Main Page Basics', async () => {
|
5
|
-
let browser,page,response;
|
6
|
-
before(async () => {
|
7
|
-
browser = await puppeteer.launch();
|
8
|
-
page = await browser.newPage();
|
9
|
-
response = await page.goto('http://localhost:3000');
|
10
|
-
})
|
11
|
-
|
12
|
-
after(async () => {
|
13
|
-
await browser.close();
|
14
|
-
})
|
15
|
-
|
16
|
-
it('Page response should be 200', async() =>{
|
17
|
-
assert.equal(response.status(),200)
|
18
|
-
})
|
19
|
-
it('clicking the collision button should send you to new page' , async() =>{
|
20
|
-
const collision_button = "#collision_button";
|
21
|
-
const [response] = await Promise.all([
|
22
|
-
page.waitForNavigation(),
|
23
|
-
page.click(collision_button),
|
24
|
-
]);
|
25
|
-
assert.equal(page.url(),'http://localhost:3000/collision.html?')
|
26
|
-
assert.equal(response.status(),200)
|
27
|
-
});
|
28
|
-
it('clicking the calibration button should send you to new page' , async() =>{
|
29
|
-
await page.goto('http://localhost:3000');
|
30
|
-
const calibration_button = "#calibration_button";
|
31
|
-
const [response] = await Promise.all([
|
32
|
-
page.waitForNavigation(),
|
33
|
-
page.click(calibration_button),
|
34
|
-
]);
|
35
|
-
assert.equal(page.url(),'http://localhost:3000/calibration.html?')
|
36
|
-
assert.equal(response.status(),200)
|
37
|
-
});
|
38
|
-
});
|
39
|
-
|
40
|
-
|
41
|
-
|