-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
106 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
window.epd = window.epd || {}; | ||
|
||
(function () { | ||
let urlsString = `0-01.png | ||
0-02.png | ||
0-03.png | ||
0-04.png | ||
0-05.png | ||
0-06.png | ||
0-07.png | ||
0-08.png | ||
0-09.png | ||
0-10.png | ||
1-01.png | ||
1-02.png | ||
1-03.png | ||
1-04.png | ||
1-05.png | ||
1-06.png | ||
1-07.png | ||
1-08.png | ||
1-09.png | ||
1-10.png | ||
2-01.png | ||
2-02.png | ||
2-03.png | ||
2-04.png | ||
2-05.png | ||
2-06.png | ||
2-07.png | ||
2-08.png | ||
2-09.png | ||
2-10.png | ||
3-01.png | ||
3-02.png | ||
3-03.png | ||
3-04.png | ||
3-05.png | ||
3-06.png | ||
3-07.png | ||
3-08.png | ||
3-09.png | ||
3-10.png | ||
4-01.png | ||
4-02.png | ||
4-03.png | ||
4-04.png | ||
4-05.png | ||
4-06.png | ||
4-07.png | ||
4-08.png | ||
4-09.png | ||
4-10.png | ||
5-01.png | ||
5-02.png | ||
5-03.png | ||
5-04.png | ||
5-05.png | ||
5-06.png | ||
5-07.png | ||
5-08.png | ||
5-09.png | ||
5-10.png | ||
6-01.png | ||
6-02.png | ||
6-03.png | ||
6-04.png | ||
6-05.png | ||
6-06.png | ||
6-07.png | ||
6-08.png | ||
6-09.png | ||
6-10.png | ||
7-01.png | ||
7-02.png | ||
7-03.png | ||
7-04.png | ||
7-05.png | ||
7-06.png | ||
7-07.png | ||
7-08.png | ||
7-09.png | ||
7-10.png | ||
8-01.png | ||
8-02.png | ||
8-03.png | ||
8-04.png | ||
8-05.png | ||
8-06.png | ||
8-07.png | ||
8-08.png | ||
8-09.png | ||
8-10.png | ||
9-01.png | ||
9-02.png | ||
9-03.png | ||
9-04.png | ||
9-05.png | ||
9-06.png | ||
9-07.png | ||
9-08.png | ||
9-09.png | ||
9-10.png`; | ||
|
||
epd.photoUrls = urlsString.split("\n"); | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
(function () { | ||
|
||
const BASE_PHOTOS_DIR = "photos"; | ||
let canvas = document.createElement("canvas"); | ||
let context2d = canvas.getContext("2d"); | ||
let train_data_out = document.querySelector("#train_data_out"); | ||
let targetDataOut = document.querySelector("#target_data_out"); | ||
|
||
|
||
function initProperties() { | ||
canvas.width = 20; | ||
canvas.height = 20; | ||
} | ||
|
||
function loadImage(src) { | ||
return new Promise(((resolve, reject) => { | ||
let img = new Image(); | ||
img.onload = () => { | ||
resolve(img); | ||
}; | ||
img.src = src; | ||
})); | ||
} | ||
|
||
async function main() { | ||
initProperties(); | ||
|
||
|
||
let allPhotoData = []; | ||
let allTargetData = []; | ||
for (let i = 0; i < epd.photoUrls.length; i++) { | ||
let img = await loadImage(`${BASE_PHOTOS_DIR}/${epd.photoUrls[i]}`); | ||
|
||
context2d.clearRect(0, 0, canvas.width, canvas.height); | ||
context2d.fillStyle = "#ffffff"; | ||
context2d.fillRect(0, 0, canvas.width, canvas.height); | ||
context2d.drawImage(img, 0, 0); | ||
|
||
let photoImageData = context2d.getImageData(0, 0, canvas.width, canvas.height); | ||
let photoData = []; | ||
for (let pxIndex = 0; pxIndex < photoImageData.data.length; pxIndex += 4) { | ||
let r = photoImageData.data[pxIndex]; | ||
let g = photoImageData.data[pxIndex + 1]; | ||
let b = photoImageData.data[pxIndex + 2]; | ||
let color = Math.round((r + g + b) / 3); | ||
photoData.push(color); | ||
} | ||
allPhotoData.push(photoData); | ||
allTargetData.push(Math.floor(i / 10)); | ||
} | ||
|
||
train_data_out.value = JSON.stringify(allPhotoData); | ||
targetDataOut.value = JSON.stringify(allTargetData); | ||
} | ||
|
||
main(); | ||
|
||
})(); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<textarea id="train_data_out" style="width: 200px;height: 300px"></textarea> | ||
<textarea id="target_data_out" style="width: 200px;height: 300px"></textarea> | ||
|
||
|
||
<script src="Data.js"></script> | ||
<script src="app.js"></script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.