forked from mikocml/jsartoolkit5
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering feature #36
Open
kalwalt
wants to merge
21
commits into
master
Choose a base branch
from
filtering-feature
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
8071d19
new FilterNFT files, not tested
kalwalt 2aee370
filtering working, seems better than interpolating with js code.
kalwalt 0c76369
removing FilterNFT files
kalwalt c971a84
alfilterCutoffFreq always gives values = zero
kalwalt 6f4446c
enhanced settings filterSampleRate=50.0 filterCutoffFrequency=25.0
kalwalt 0d04071
added reset option
kalwalt 298ed62
adding gpujs with a WIP example
kalwalt 546ae82
simplifying things, but receive an error
kalwalt d97349b
new linear interpolation in C++ code much more efficient
kalwalt d7f738a
for filter, adding only an example with gltf
nicolocarpignoli a835960
updated index for nft examples
kalwalt a987c47
removing gpu.js code and libs
kalwalt 753a833
testing another lerp function
kalwalt dd00af0
adding precision: mediump and deleting other gpu.js stuff
kalwalt 40fbe23
another example: filtering + wasm
kalwalt a81c6f6
removing first version of matrixLerp and new filtering setup
kalwalt a1f545b
added -D WITH_FILTERING option to build lib with filtering
kalwalt 727bc28
fix links in the index
kalwalt e7e7f24
adding NaiveFilter.h
kalwalt 42347a8
another lerp routine
kalwalt 86fb0a9
rebuilding libs
kalwalt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
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
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
141 changes: 141 additions & 0 deletions
141
examples/nft_improved_worker/main_threejs_filter_worker.html
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,141 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>NFT marker example with a WebWorker and Three.js</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.5, maximum-scale=1"> | ||
<link rel="stylesheet" href="../css/video-style.css"> | ||
</head> | ||
<body class="loading"> | ||
<div id="loading" > | ||
<img src="../Data/logo.gif"/> | ||
<span class="loading-text">Loading, please wait</span> | ||
</div> | ||
<!-- | ||
================== | ||
STATS | ||
================== | ||
--> | ||
|
||
<div id="stats" class="ui stats"> | ||
|
||
<div id="stats1" class="stats-item"> | ||
<p class="stats-item-title"> | ||
Main | ||
</p> | ||
</div> | ||
|
||
<div id="stats2" class="stats-item"> | ||
<p class="stats-item-title"> | ||
Worker | ||
</p> | ||
</div> | ||
|
||
</div> | ||
|
||
<!-- | ||
================== | ||
CAMERA VIDEO & CANVAS | ||
================== | ||
--> | ||
|
||
<div id="app"> | ||
<video | ||
loop | ||
autoplay | ||
muted | ||
playsinline | ||
id="video"> | ||
</video> | ||
|
||
<canvas id="canvas"></canvas> | ||
</div> | ||
|
||
<a | ||
href="https://raw.githubusercontent.com/artoolkit/artoolkit5/master/doc/Marker%20images/pinball.jpg" | ||
class="ui marker" | ||
target="_blank"> | ||
🖼 Marker Image | ||
</a> | ||
|
||
<script src="../js/third_party/three.js/stats.min.js"></script> | ||
<script src="../js/third_party/three.js/three.min.js"></script> | ||
<script src="threejs_filter_worker.js"></script> | ||
|
||
<script> | ||
|
||
/** | ||
* STATS | ||
*/ | ||
var statsMain = new Stats(); | ||
statsMain.showPanel( 0 ); // 0: fps, 1: ms, 2: mb, 3+: custom | ||
document.getElementById( 'stats1' ).appendChild( statsMain.dom ); | ||
|
||
var statsWorker = new Stats(); | ||
statsWorker.showPanel( 0 ); // 0: fps, 1: ms, 2: mb, 3+: custom | ||
document.getElementById( 'stats2' ).appendChild( statsWorker.dom ); | ||
|
||
/** | ||
* APP / ELEMENTS | ||
*/ | ||
var container = document.getElementById( 'app' ); | ||
var video = document.getElementById( 'video' ); | ||
var canvas = document.getElementById( 'canvas' ); | ||
|
||
/** | ||
* APP / VIDEO STREAM | ||
*/ | ||
|
||
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { | ||
var hint = { | ||
audio: false, | ||
video: true | ||
}; | ||
if( window.innerWidth < 800 ) { | ||
var width = ( window.innerWidth < window.innerHeight ) ? 240 : 360; | ||
var height = ( window.innerWidth < window.innerHeight ) ? 360 : 240; | ||
|
||
var aspectRatio = window.innerWidth / window.innerHeight; | ||
|
||
console.log( width, height ); | ||
|
||
hint = { | ||
audio: false, | ||
video: { | ||
facingMode: 'environment', | ||
width: { min: width, max: width } | ||
}, | ||
}; | ||
|
||
console.log( hint ); | ||
} | ||
|
||
navigator.mediaDevices.getUserMedia( hint ).then( function( stream ) { | ||
video.srcObject = stream; | ||
video.addEventListener( 'loadedmetadata', function() { | ||
video.play(); | ||
|
||
console.log( 'video', video, video.videoWidth, video.videoHeight ); | ||
|
||
start( | ||
container, | ||
markers['pinball'], | ||
video, | ||
video.videoWidth, | ||
video.videoHeight, | ||
canvas, | ||
function() { | ||
statsMain.update() | ||
}, | ||
function() { | ||
statsWorker.update(); | ||
}, | ||
null | ||
); | ||
} ); | ||
} ); | ||
} | ||
</script> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The third argument of arFilterTransMat should a value that is zero or 1 as explained in the doc http://www.artoolkitx.org/artoolkit5/doc/apiref/arFilterTransMat_h/index.html#//apple_ref/c/func/arFilterTransMat
this needs to be changed.