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 2 commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
/* | ||
* FilterNFT.c | ||
* //from the original file ARMarkerNFT.c in this commit: | ||
* https://github.com/kalwalt/jsartoolkit5/commit/6eb0cabd00ae7ad99053f70640936ad61543e38e#diff-43441e657d18818bd1f722c762b8460b | ||
* | ||
* ARToolKit5 | ||
* | ||
* Disclaimer: IMPORTANT: This Daqri software is supplied to you by Daqri | ||
* LLC ("Daqri") in consideration of your agreement to the following | ||
* terms, and your use, installation, modification or redistribution of | ||
* this Daqri software constitutes acceptance of these terms. If you do | ||
* not agree with these terms, please do not use, install, modify or | ||
* redistribute this Daqri software. | ||
* | ||
* In consideration of your agreement to abide by the following terms, and | ||
* subject to these terms, Daqri grants you a personal, non-exclusive | ||
* license, under Daqri's copyrights in this original Daqri software (the | ||
* "Daqri Software"), to use, reproduce, modify and redistribute the Daqri | ||
* Software, with or without modifications, in source and/or binary forms; | ||
* provided that if you redistribute the Daqri Software in its entirety and | ||
* without modifications, you must retain this notice and the following | ||
* text and disclaimers in all such redistributions of the Daqri Software. | ||
* Neither the name, trademarks, service marks or logos of Daqri LLC may | ||
* be used to endorse or promote products derived from the Daqri Software | ||
* without specific prior written permission from Daqri. Except as | ||
* expressly stated in this notice, no other rights or licenses, express or | ||
* implied, are granted by Daqri herein, including but not limited to any | ||
* patent rights that may be infringed by your derivative works or by other | ||
* works in which the Daqri Software may be incorporated. | ||
* | ||
* The Daqri Software is provided by Daqri on an "AS IS" basis. DAQRI | ||
* MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION | ||
* THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE, REGARDING THE DAQRI SOFTWARE OR ITS USE AND | ||
* OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. | ||
* | ||
* IN NO EVENT SHALL DAQRI BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL | ||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, | ||
* MODIFICATION AND/OR DISTRIBUTION OF THE DAQRI SOFTWARE, HOWEVER CAUSED | ||
* AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), | ||
* STRICT LIABILITY OR OTHERWISE, EVEN IF DAQRI HAS BEEN ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* Copyright 2015 Daqri LLC. All Rights Reserved. | ||
* Copyright 2013-2015 ARToolworks, Inc. All Rights Reserved. | ||
* | ||
* Author(s): Philip Lamb. | ||
* Modified version by @kalwalt Walter Perdan. | ||
* | ||
*/ | ||
|
||
#include "FilterNFT.h" | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
#ifdef _WIN32 | ||
# include <windows.h> | ||
# define MAXPATHLEN MAX_PATH | ||
#else | ||
# include <sys/param.h> // MAXPATHLEN | ||
#endif | ||
|
||
|
||
const ARPose ARPoseUnity = {{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}}; | ||
|
||
void filterNFTWithTransMat(ARMarkerNFT **markersNFT_out, int *markersNFTCount_out, int filterValue) | ||
{ | ||
int tempI; | ||
ARMarkerNFT *markersNFT; | ||
int markersNFTCount; | ||
ARdouble tempF; | ||
int i; | ||
|
||
if (!markersNFT_out || !markersNFTCount_out) return; | ||
|
||
arMallocClear(markersNFT, ARMarkerNFT, tempI); | ||
markersNFTCount = tempI; | ||
|
||
for (i = 0; i < markersNFTCount; i++) { | ||
markersNFT[i].valid = markersNFT[i].validPrev = FALSE; | ||
markersNFT[i].pageNo = -1; | ||
if (filterValue == 0){ | ||
markersNFT[i].filterCutoffFrequency = AR_FILTER_TRANS_MAT_CUTOFF_FREQ_DEFAULT; | ||
markersNFT[i].filterSampleRate = AR_FILTER_TRANS_MAT_SAMPLE_RATE_DEFAULT; | ||
} else { | ||
markersNFT[i].filterCutoffFrequency = filterValue; | ||
} | ||
|
||
} | ||
|
||
// If not all markers were read, an error occurred. | ||
if (i < markersNFTCount) { | ||
|
||
// Clean up. | ||
for (; i >= 0; i--) { | ||
if (markersNFT[i].ftmi) arFilterTransMatFinal(markersNFT[i].ftmi); | ||
} | ||
free(markersNFT); | ||
|
||
*markersNFTCount_out = 0; | ||
*markersNFT_out = NULL; | ||
return; | ||
} | ||
|
||
*markersNFT_out = markersNFT; | ||
|
||
} | ||
|
||
void deleteMarkers(ARMarkerNFT **markersNFT_p, int *markersNFTCount_p) | ||
{ | ||
int i; | ||
|
||
if (!markersNFT_p || !*markersNFT_p || !*markersNFTCount_p || *markersNFTCount_p < 1) return; | ||
|
||
for (i = 0; i < *markersNFTCount_p; i++) { | ||
if ((*markersNFT_p)[i].ftmi) { | ||
arFilterTransMatFinal((*markersNFT_p)[i].ftmi); | ||
(*markersNFT_p)[i].ftmi = NULL; | ||
} | ||
} | ||
free(*markersNFT_p); | ||
*markersNFT_p = NULL; | ||
*markersNFTCount_p = 0; | ||
} |
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,103 @@ | ||
/* | ||
* FilterNFT.c | ||
* //from the original file ARMarkerNFT.h in this commit: | ||
* https://github.com/kalwalt/jsartoolkit5/commit/6eb0cabd00ae7ad99053f70640936ad61543e38e#diff-43441e657d18818bd1f722c762b8460b | ||
* | ||
* ARToolKit5 | ||
* | ||
* Disclaimer: IMPORTANT: This Daqri software is supplied to you by Daqri | ||
* LLC ("Daqri") in consideration of your agreement to the following | ||
* terms, and your use, installation, modification or redistribution of | ||
* this Daqri software constitutes acceptance of these terms. If you do | ||
* not agree with these terms, please do not use, install, modify or | ||
* redistribute this Daqri software. | ||
* | ||
* In consideration of your agreement to abide by the following terms, and | ||
* subject to these terms, Daqri grants you a personal, non-exclusive | ||
* license, under Daqri's copyrights in this original Daqri software (the | ||
* "Daqri Software"), to use, reproduce, modify and redistribute the Daqri | ||
* Software, with or without modifications, in source and/or binary forms; | ||
* provided that if you redistribute the Daqri Software in its entirety and | ||
* without modifications, you must retain this notice and the following | ||
* text and disclaimers in all such redistributions of the Daqri Software. | ||
* Neither the name, trademarks, service marks or logos of Daqri LLC may | ||
* be used to endorse or promote products derived from the Daqri Software | ||
* without specific prior written permission from Daqri. Except as | ||
* expressly stated in this notice, no other rights or licenses, express or | ||
* implied, are granted by Daqri herein, including but not limited to any | ||
* patent rights that may be infringed by your derivative works or by other | ||
* works in which the Daqri Software may be incorporated. | ||
* | ||
* The Daqri Software is provided by Daqri on an "AS IS" basis. DAQRI | ||
* MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION | ||
* THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE, REGARDING THE DAQRI SOFTWARE OR ITS USE AND | ||
* OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. | ||
* | ||
* IN NO EVENT SHALL DAQRI BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL | ||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, | ||
* MODIFICATION AND/OR DISTRIBUTION OF THE DAQRI SOFTWARE, HOWEVER CAUSED | ||
* AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), | ||
* STRICT LIABILITY OR OTHERWISE, EVEN IF DAQRI HAS BEEN ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* Copyright 2015 Daqri LLC. All Rights Reserved. | ||
* Copyright 2013-2015 ARToolworks, Inc. All Rights Reserved. | ||
* | ||
* Author(s): Philip Lamb. | ||
* Modified version by @kalwalt Walter Perdan. | ||
* | ||
*/ | ||
|
||
#ifndef __FilterNFT_h__ | ||
#define __FilterNFT_h__ | ||
|
||
#include <AR/ar.h> | ||
#include <AR/arFilterTransMat.h> | ||
#ifndef _MSC_VER | ||
# include <stdbool.h> | ||
#else | ||
typedef unsigned char bool; | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef struct { | ||
ARdouble v[3]; | ||
} ARVec3; | ||
|
||
typedef struct { | ||
ARdouble T[16]; // Position and orientation, column-major order. (position(x,y,z) = {T[12], T[13], T[14]} | ||
} ARPose; | ||
|
||
extern const ARPose ARPoseUnity; | ||
|
||
typedef struct _ARMarkerNFT { | ||
// ARMarker protected | ||
//bool valid; | ||
//bool validPrev; | ||
ARdouble trans[3][4]; | ||
ARPose pose; | ||
ARdouble marker_width; | ||
ARdouble marker_height; | ||
// ARMarker private | ||
ARFilterTransMatInfo *ftmi; | ||
ARdouble filterCutoffFrequency; | ||
ARdouble filterSampleRate; | ||
// ARMarkerNFT | ||
int pageNo; | ||
char *datasetPathname; | ||
} ARMarkerNFT; | ||
|
||
void filterNFTWithTransMat(ARMarkerNFT **markersNFT_out, int *markersNFTCount_out, int filterValue); | ||
|
||
void deleteMarkers(ARMarkerNFT **markersNFT_p, int *markersNFTCount_p); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif // !__FilterNFT_h__ |
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
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.