Skip to content

Commit

Permalink
gpu-js hacky fix (GPUX)
Browse files Browse the repository at this point in the history
Hacky fix to this issue gpujs/gpu.js#820 by renaming  all "GPU" instances in gpu-browser.min to "GPUX" by:
1) Adding a local version of gpu-browser.min.js and running replace all
2) Making a change to skeletonization.js line 23 (skeletonization.thinning_gpu = new GPUX();)
  • Loading branch information
AndreasRef committed Aug 18, 2023
1 parent 39cd3f7 commit eeb1f93
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 5 deletions.
3 changes: 3 additions & 0 deletions tegneMaskinenKioskVejle/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
28 changes: 28 additions & 0 deletions tegneMaskinenKioskVejle/gpu-browser.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion tegneMaskinenKioskVejle/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<script src="opencv.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/gpu.js/1.10.4/gpu.min.js"></script> -->
<!-- <script src="gpu.min.js"></script> -->
<script src="https://unpkg.com/gpu.js@latest/dist/gpu-browser.min.js"></script>
<!-- <script src="https://unpkg.com/gpu.js@latest/dist/gpu-browser.min.js"></script> -->
<script src="gpu-browser.min.js"></script>


<!-- <script src="https://cdn.jsdelivr.net/gh/LingDong-/Okb.js@337f4b52f74729ce29f4b720dabca7b2d92d4254/Okb.js"></script> -->
Expand Down
2 changes: 1 addition & 1 deletion tegneMaskinenKioskVejle/skeletonization.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var skeletonization = {}
skeletonization.setup = function(width,height){
skeletonization.KERNEL_WIDTH = width;
skeletonization.KERNEL_HEIGHT = height;
skeletonization.thinning_gpu = new GPU();
skeletonization.thinning_gpu = new GPUX();
skeletonization.thinning_iterKernel0 = skeletonization.thinning_gpu.createKernel(function(a,WIDTH,HEIGHT,bbox) {

if (this.thread.x < bbox[1]*WIDTH || this.thread.x > bbox[3] * WIDTH || this.thread.x % WIDTH < bbox[0] || this.thread.x % WIDTH > bbox[2]){
Expand Down
28 changes: 28 additions & 0 deletions tegnemaskinen/gpu-browser.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tegnemaskinen/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<script src="opencv.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/gpu.js/1.10.4/gpu.min.js"></script> -->
<!-- <script src="gpu.min.js"></script> -->
<script src="https://unpkg.com/gpu.js@latest/dist/gpu-browser.min.js"></script>

<!-- <script src="https://unpkg.com/gpu.js@latest/dist/gpu-browser.min.js"></script> -->
<script src="gpu-browser.min.js"></script>

<!-- <script src="https://cdn.jsdelivr.net/gh/LingDong-/Okb.js@337f4b52f74729ce29f4b720dabca7b2d92d4254/Okb.js"></script> -->
<script src="Okb.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion tegnemaskinen/skeletonization.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var skeletonization = {}
skeletonization.setup = function(width,height){
skeletonization.KERNEL_WIDTH = width;
skeletonization.KERNEL_HEIGHT = height;
skeletonization.thinning_gpu = new GPU();
skeletonization.thinning_gpu = new GPUX();
skeletonization.thinning_iterKernel0 = skeletonization.thinning_gpu.createKernel(function(a,WIDTH,HEIGHT,bbox) {

if (this.thread.x < bbox[1]*WIDTH || this.thread.x > bbox[3] * WIDTH || this.thread.x % WIDTH < bbox[0] || this.thread.x % WIDTH > bbox[2]){
Expand Down

0 comments on commit eeb1f93

Please sign in to comment.