-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebsite.html
More file actions
174 lines (160 loc) · 6.47 KB
/
Copy pathwebsite.html
File metadata and controls
174 lines (160 loc) · 6.47 KB
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
171
172
173
174
<html>
<head><title>Video Quality Test </title>
<link rel = "stylesheet" href = "website.css">
<style>
{
box-sizing: border-box;
}
.column {
float: left;
height: 50%
}
.inputVideo {
width: 25%;
}
.inputParameters {
width: 25%;
}
.outputVideo {
width: 25%;
}
.redflags {
width: 25%;
}
.row:after {
content: "";
display: table;
clear: both;
}
</style>
</head>
<body>
<h1>Video Quality Test</h1>
<div class="row">
<div class="column" style="background-color:#E0B41E;">
<h2>Input Video</h2>
<form action="/action_page.php">
<input type="file" name="input image" accept="image/*"?
<input type="submit">
</form>
<!-- <video width="160" height = "120" controls>
<source src = "website.py" type = "video/mp4">
<source src= "website.py" tyoe = "video/ogg">
Your browser does not support the video tag.
</video>d -->
<img src = "/Users/vainaviv/Documents/Pictures/Bahamas2019/IMG_1902.jpeg" width = "200" height = "160" alt = "Test Image">
</div>
<div class="column" style="background-color:#96D1CD;">
<h2>Parameters</h2>
<form action = "/" method = "get">
Frames per second: <input type="text" name="fps" value=0 size="5"> Hz
</form>
<form>
Pixel Size: <input type = "text" name = "px_size" value=0 size = "5"> mm
</form>
</div>
<div class="column" style="background-color:#E0B41E;">
<h2>Output Video</h2>
<p>Movie Score: </p>
<!-- <video width="160" height = "120" controls>
<source src = "website.py" type = "video/mp4">
<source src= "website.py" tyoe = "video/ogg">
Your browser does not support the video tag.
</video> -->
<script>
function getPixel(url, x, y) {
var img = new Image();
img src = url;
var canvase = document.createElement('canvas');
var context = canvas.getContext('2d');
context.drawImage(img, 0, 0);
return context.getImageData(x, y, 1, 1).data[0,3];
}
function getComplexArray(url) {
var Complex = [];
var img = new Image();
img.load(url);
for (var y = 0; y < img.getHeight(); y++) {
for (var x = 0; x < img.getWidth(); x++) {
Complex.push(new Complex(x, y));
}
}
return Complex;
}
function getPixelArray(url) {
var Pixels = [];
var img = new Image();
img.load(url);
for (var y = 0; y < img.getHeight(); y++) {
for (var x = 0; x < img.getWidth(); x++) {
Pixels.push(getPixel(url, x, y));
}
}
return Pixels;
}
var image_Pixels = getPixelArray("/Users/vainaviv/Documents/Pictures/Bahamas2019/IMG_1902.jpeg");
//Loading image function:
function loadImage(loc) {
var start = +new Date();
// placed in a callback so the UI has a chance to update
disableButtons(function() {
// draw the initial image
var img = new Image();
img.addEventListener('load', function() {
// make each canvas the image's exact size
dims[0] = img.width;
dims[1] = img.height;
for (var ai = 0; ai < 4; ai++) {
canvases[ai] = $s('#canvas'+ai);
canvases[ai].width = dims[0];
canvases[ai].height = dims[1];
ctxs[ai] = canvases[ai].getContext('2d');
}
// draw the image to the canvas
ctxs[0].drawImage(img, 0, 0, img.width, img.height);
// grab the pixels
var imageData = ctxs[0].getImageData(
0, 0, dims[0], dims[1]
);
var h_es = []; // the h values
for (var ai = 0; ai < imageData.data.length; ai+=4) {
// greyscale, so you only need every 4th value
h_es.push(imageData.data[ai]);
}
// initialize the h values
h = function(n, m) {
if (arguments.length === 0) return h_es;
var idx = n*dims[0] + m;
return h_es[idx];
}; // make it a function so the code matches the math
enableButtons();
var duration = +new Date() - start;
console.log(
'It took ' + duration + 'ms to draw the image.'
);
});
img.crossOrigin = "anonymous";
img.src = loc;
});
}
loadImage("/Users/vainaviv/Documents/Pictures/Bahamas2019/IMG_1902.jpeg");
</script>
<!-- Another fourier transform for images -->
<script> src = "/Users/vainaviv/Desktop/ResearchSpring2020/Website/javascriptFFTImage2.js"
</script>
<img output>
</div>
<div class="column" style="background-color:#E6583F;">
<h2>Red Flags</h2>
Redflags: {} <br>
<p></p>
ordered list:
<ol>
<li> Item 1 </li>
<li> Item 2 </li>
<li> Item 3 </li>
</ol>
</div>
</div>
</body>
</html>