Skip to content
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

Fix positioning of content #41

Open
nicolocarpignoli opened this issue Feb 2, 2020 · 6 comments
Open

Fix positioning of content #41

nicolocarpignoli opened this issue Feb 2, 2020 · 6 comments
Assignees
Labels
C/C++ coding with C and C++ language enhancement New feature or request javascript all about javascript code NFT nft markerless technology

Comments

@nicolocarpignoli
Copy link
Collaborator

nicolocarpignoli commented Feb 2, 2020

Content is now shown at the left-bottom corner of the recognised image.
I think that we should try to make it appear at the center of the image, with the user able to move it, if wanted to - widespread use will be with the content at center of the image/covering the whole image.

@nicolocarpignoli nicolocarpignoli added the NFT nft markerless technology label Feb 2, 2020
@nicolocarpignoli
Copy link
Collaborator Author

@kalwalt you said on Slack, it's possible to understand width/height of given image. Where can we do that?

So knowing that, where we recognize the marker, we can try to change it position to:

position.x = position.x + width/2
position.y = position.y + height/2

@kalwalt
Copy link
Owner

kalwalt commented Feb 3, 2020

When the NFT marker is loaded inside the loadNFTMarker:

https://github.com/artoolkitx/jsartoolkit5/blob/244b2b23286403e78fa24805b34509dc5a88052f/emscripten/ARToolKitJS.cpp#L313

the surfaceSet pointer ( alias for a AR2SurfaceSetT struct) is filled with all the data from the NFT marker (width, height, dpi, image data, feature points...) so we can obtain all the data we needs from here.

AR2SurfaceSetT is a struct defined in https://github.com/artoolkitx/artoolkit5/blob/6742d9f5c4a06673a3805e097d924f8e0c55f8ca/include/AR2/tracking.h

basically contain a chained series of structs inside of them there is an AR2ImageSetT struct where are stored the width, height dpi and image data:

https://github.com/artoolkitx/artoolkit5/blob/6742d9f5c4a06673a3805e097d924f8e0c55f8ca/include/AR2/imageSet.h#L52-L66

@kalwalt kalwalt self-assigned this Feb 3, 2020
@kalwalt kalwalt added C/C++ coding with C and C++ language enhancement New feature or request javascript all about javascript code labels Feb 3, 2020
@nicolocarpignoli
Copy link
Collaborator Author

Great! Are you able to set two variables (width and height) that can then be available in the artoolkit.api.js? From there, we could just use them

@kalwalt
Copy link
Owner

kalwalt commented Feb 3, 2020

Yes, that should be doable ( in theory ): i will start to work to it.

@kalwalt
Copy link
Owner

kalwalt commented Mar 25, 2020

Actually i solved in this way, given the width, height and dpi from the .fset file we can calculate the position of the model in the center of the marker with:

model.position.y = (msg.height / msg.dpi * 2.54 * 10)/2.0;
model.position.x = (msg.width / msg.dpi * 2.54 * 10)/2.0;

see this commit 86a1980

@evaristoc
Copy link

Hi, @kalwalt and @nicolocarpignoli,

I hope to help the procedure with some comments. I have been commenting the approach in the PR of this issue. #42 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C/C++ coding with C and C++ language enhancement New feature or request javascript all about javascript code NFT nft markerless technology
Projects
None yet
Development

No branches or pull requests

3 participants