Skip to content

Nft feature#18

Open
kalwalt wants to merge 18 commits into
augmentmy-world:masterfrom
kalwalt:NFT-feature
Open

Nft feature#18
kalwalt wants to merge 18 commits into
augmentmy-world:masterfrom
kalwalt:NFT-feature

Conversation

@kalwalt

@kalwalt kalwalt commented Aug 24, 2019

Copy link
Copy Markdown
Collaborator

An attempt to add Nft to ArtoolkitX.js the main problem (at least for me) is the loading mechanism.
we need to add the basepath in the config for the trackable, but the _ajax function need the the full path, for the three files with extension:

.fset
.iset
.fset3

This is a draft PR just to test NFT. Probably i will close this and i will re-send another clean PR as i will find the solution.

Note: it is needed to enable NFT during the compilation of artoolkitx.js see my branch nft-emscripten

@kalwalt kalwalt added enhancement New feature or request code design All about coding design javascript All about javascript related issues labels Aug 24, 2019
@kalwalt kalwalt self-assigned this Aug 24, 2019
@kalwalt

kalwalt commented Aug 24, 2019

Copy link
Copy Markdown
Collaborator Author

This is the log from the console with the latest commit 837a139:


artoolkitx.js:6 [info] Starting...
artoolkitx.js:6 [info] Setting video configuration '-module=Web -width=640 -height=480'.
artoolkitx.js:6 [info] Setting camera parameters file '/camera_param_0'.
artoolkitx.js:6 [info] Opening artoolkitX video using configuration '-module=Web -width=640 -height=480'.
artoolkitx.js:6 [info] Using supplied video config "-module=Web -width=640 -height=480".
artoolkitx.js:6 [info] ar2VideoOpenAsyncWeb '-module=Web -width=640 -height=480'.
artoolkitX.api.js:84 artoolkitX started
artoolkitx.js:6 [info] ARVideoSource::webVideoPushInit ... 
artoolkitx.js:6 [info] Opened artoolkitX video 640x480@4Bpp (AR_PIXEL_FORMAT_RGBA).
artoolkitx.js:6 [info] Camera parameters loaded from file '/camera_param_0'.
simple_video_nft.html:40 start done
artoolkitX.api.js:952 GET http://127.0.0.1:8000/home/walter/kalwalt-github/artoolkitX.js/Examples/Data/pinball-data/pinball.fset 404 (File not found)
artoolkitX.api.js:1148 404
artoolkitx.js:6 [info] Loading '/home/walter/kalwalt-github/artoolkitX.js/Examples/Data/pinball-data/pinball.fset'.
artoolkitx.js:6 [info] 
artoolkitx.js:6 ### Surface No.1 ###
artoolkitx.js:6 [info]   Read ImageSet.
artoolkitx.js:6 [error] Error: unable to open file '/home/walter/kalwalt-github/artoolkitX.js/Examples/Data/pinball-data/pinball.iset' for reading.
artoolkitx.js:6 [error] Error opening file '/home/walter/kalwalt-github/artoolkitX.js/Examples/Data/pinball-data/pinball.iset'.
artoolkitx.js:6 [error] Error reading data from '/home/walter/kalwalt-github/artoolkitX.js/Examples/Data/pinball-data/pinball.fset'.
artoolkitx.js:6 [error] Error: Failed to load trackable.
artoolkitX.api.js:293 Uncaught (in promise) Faild to add Trackable: -1
simple_video_nft.html:42 [Violation] 'setInterval' handler took 258ms
simple_video_nft.html:42 [Violation] 'setInterval' handler took 64ms

​

@kalwalt

kalwalt commented Aug 27, 2019

Copy link
Copy Markdown
Collaborator Author

Maybe the solution is Promise.all()?
https://teamtreehouse.com/library/manage-multiple-requests-with-promiseall

@kalwalt

kalwalt commented Aug 31, 2019

Copy link
Copy Markdown
Collaborator Author

i think i had developed a non well formed code for the the Promise.all() this last part do not return any thing:

  ARController[_ajax](item.url, filename).then(() => Promise.resolve(filename)).catch(e => { 
                Promise.reject(e) }),
                 console.log("nft loaded"))
                    }).then(() => Promise.resolve(filename)).catch(e => { Promise.reject(e) })

according to this article https://www.freecodecamp.org/news/promise-all-in-javascript-with-example-6c8c5aea3e32/

@kalwalt

kalwalt commented Dec 7, 2019

Copy link
Copy Markdown
Collaborator Author

@ThorstenBux @nicolocarpignoli it willl be nice to continue the development here also and comparing this with jsartoolkit5... what do you think?

@ThorstenBux

ThorstenBux commented Dec 7, 2019 via email

Copy link
Copy Markdown

@kalwalt

kalwalt commented Dec 28, 2019

Copy link
Copy Markdown
Collaborator Author

@ThorstenBux with the latest commit it seems that the nft marker is loade but stop when reading the .iset:

artoolkitX.api.js:66 Version: 1.0.5
artoolkitx.js:6 [info] Starting...
artoolkitx.js:6 [info] Setting video configuration '-module=Web -width=640 -height=480'.
artoolkitx.js:6 [info] Setting camera parameters file '/camera_param_0'.
artoolkitx.js:6 [info] Opening artoolkitX video using configuration '-module=Web -width=640 -height=480'.
artoolkitx.js:6 [info] Using supplied video config "-module=Web -width=640 -height=480".
artoolkitx.js:6 [info] ar2VideoOpenAsyncWeb '-module=Web -width=640 -height=480'.
artoolkitX.api.js:84
artoolkitX started
artoolkitx.js:6 [info] ARVideoSource::webVideoPushInit ... 
artoolkitx.js:6 [info] Opened artoolkitX video 640x480@4Bpp (AR_PIXEL_FORMAT_RGBA).
artoolkitx.js:6 [info] Camera parameters loaded from file '/camera_param_0'.
simple_video_nft.html:41 start done
artoolkitx.js:6 [info] Loading '/nft_trackable_.fset'.
artoolkitx.js:6 [info] 
artoolkitx.js:6 ### Surface No.1 ###
artoolkitx.js:6 [info]   Read ImageSet.
artoolkitx.js:6 [info] Imageset contains 9 images.
artoolkitx.js:6 [error] Error reading JPEG file.
artoolkitx.js:6 [warning] Falling back to reading '/nft_trackable_.iset' in ARToolKit v4.x format.
artoolkitx.js:6 OOM
artoolkitx.js:6 OOM
artoolkitX.api.js:294 Uncaught (in promise) abort(OOM). Build with -s ASSERTIONS=1 for more info.
145
[Violation] 'setInterval' handler took <N>ms

note the error: Error reading JPEG file. maybe the jpeg lib used for building ArtoolkitX is not correct for linux? i will check this.

@kalwalt

kalwalt commented Dec 29, 2019

Copy link
Copy Markdown
Collaborator Author

i found this issue on artoolkitx artoolkitx/artoolkitx#47

@kalwalt

kalwalt commented Jan 4, 2020

Copy link
Copy Markdown
Collaborator Author

Now the nft is loaaded but i get this error:

artoolkitx.js:6 [info] Loading '/nft_trackable_0.fset'.
artoolkitx.js:6 [info] 
artoolkitx.js:6 ### Surface No.1 ###
artoolkitx.js:6 [info]   Read ImageSet.
artoolkitx.js:6 [info] Imageset contains 9 images.
artoolkitx.js:6 [info]     end.
artoolkitx.js:6 [info]   Read FeatureSet.
artoolkitx.js:6 [info]     end.
artoolkitx.js:6 [info] First NFT marker trackable added; enabling NFT marker tracker.
artoolkitx.js:6 [info] Added trackable (UID=0), total trackables loaded: 1.
artoolkitX.api.js:758 Trackable 0 not visible
artoolkitx.js:6 [info] Tracking thread = 4
artoolkitx.js:6 [info] Using NFT tracking settings for more than one CPU.
artoolkitx.js:6 [info] Loading NFT data.
artoolkitx.js:6 [info] Reading '/nft_trackable_0.fset3'.
artoolkitx.js:6 [info]   Assigned page no. 0.
artoolkitx.js:6 [info] Done.
artoolkitx.js:6 [info] points-636
artoolkitx.js:6 [info] points-648
artoolkitx.js:6 [info] points-615
artoolkitx.js:6 [info] points-607
artoolkitx.js:6 [info] points-590
artoolkitx.js:6 [info] points-540
artoolkitx.js:6 [info] points-508
artoolkitx.js:6 [info] points-437
artoolkitx.js:6 [info] points-269
artoolkitx.js:6 [info] Starting NFT tracking thread.
artoolkitx.js:6 [error] trackingInitInit()
artoolkitx.js:6 [error] Unable to load NFT data.
artoolkitX.api.js:163 Trackable 0 not visible
artoolkitX.api.js:758 Trackable 0 not visible
artoolkitx.js:6 [info] Loading NFT data.
artoolkitx.js:6 [info] Reading '/nft_trackable_0.fset3'.
artoolkitx.js:6 [info]   Assigned page no. 0.
artoolkitx.js:6 [info] Done.
artoolkitx.js:6 [info] points-636
artoolkitX.api.js:168 Unable to detect marker: 19343656

because artoolkitX.js is not build with pthread enabled it fails the threading part, so i think there are 2 solutions:

  1. build ArtoolkitX.js with threading enabled but this means you need to enabled the SharedArrayBuffer option in the browser ( and the Spectre issue !!)

  2. developing another version without multithreading as we did with jsartoolkit5...

@ThorstenBux

ThorstenBux commented Jan 4, 2020 via email

Copy link
Copy Markdown

@kalwalt

kalwalt commented Jan 5, 2020

Copy link
Copy Markdown
Collaborator Author

Yes, i will start this. I think It will be not so difficult because this part of the code Is similar to the jsartoolkit5 code.

@ThorstenBux

Copy link
Copy Markdown

@kalwalt have you had time to look into this yet?

@kalwalt

kalwalt commented Mar 15, 2020

Copy link
Copy Markdown
Collaborator Author

@ThorstenBux I started to work a month ago, but hadn''t the time to continúe. It's needed to make changes in the ArtoolkitX source code to give a double option with and without threading , this Is the hardest part of the work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code design All about coding design enhancement New feature or request javascript All about javascript related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants