jeromeetienne / AR.js

Efficient Augmented Reality for the Web - 60fps on mobile!
MIT License
15.78k stars 2.22k forks source link

Multi-Marker with custom markers instead of hard coded markers. #283

Closed mariovde closed 4 years ago

mariovde commented 6 years ago

Just finished setting up the multi marker example, but everything is wired to use the hiro or kanji. 1) Is there a way to use custom markers and use them to learn/act as 1 marker 2) does everyone need to "learn" first and then see the result? Can I use the output from my learning process and store it, so others don't need to learn but see the result immediately?

jeromeetienne commented 6 years ago
  1. unfortunatly at the moment the markers are hardcoded, but it is a rather siumple modification in the initialisation. I definitly would love a pull request about that.

  2. yes you can learn some markers positions. while learning a marker area, a file describing the position of each marker is created. This file is then used. One could easily learn it once and then share it with others. (one example is the augmented-screen example, where the generated multi marker is sent to the client)

mariovde commented 6 years ago

Ok, I'll see if I can modify the code and create a pull request for this. Where can I find the augmented-screen example exactly? Thanks for the quick reply, Jerome!

mariovde commented 6 years ago

@jeromeetienne I have solved the issue for the custom multi markers. Now I just need to find a way to get this multi marker output to the client. Where can I find the augmented-screen example exactly, that you talked about above, please?

Sithdown commented 6 years ago

@mariovde Could you show us how you solved the issue with custom multi markers? Thanks!

prashant-andani commented 6 years ago

https://github.com/prashant-andani/AR-Alphabets-words Here i have implemented with the custom marker..

mariovde commented 6 years ago

Sure, this is a custom marker example, but not multiple custom makers, acting as one large custom marker. @prashant-andani

mariovde commented 6 years ago

@jeromeetienne Where can I find the augmented-screen example exactly, that you talked about above, please?

prashant-andani commented 6 years ago

@mariovde @Sithdown @jeromeetienne Here i have used multiple markers ... i'm dynamically generating as much markers i wanted to.. https://github.com/prashant-andani/Augmented-Reality/blob/master/src/components/HelloWorld.vue

`<a-marker v-for="marker in markers" :key="marker.id" type="pattern" preset='custom' v-bind:patternUrl="marker.url" v-bind:url="marker.url">

`

mariovde commented 6 years ago

@prashant-andani that's not what I mean. you generate 1 marker for 1 3D model.

we are talking about using multiple different custom markers to show one 3D model. so if one marker falls of the camera, another marker picks up the tracking.

ghost commented 6 years ago

@mariovde I was able to train my own custom marker. However, I am struggling to figure out how to use multiple custom markers to act as 1 large one. I would be very grateful if you showed how you were able to achieve this! Thank you :)

kirillovdm commented 6 years ago

@mariovde so, did you find the solution how to get result of multi-marker learning process? It will be really useful for this library. And what about custom multi-markers without teaching?

spartalisdigital commented 6 years ago

alguém teve progresso nesse trabalho? o uso de multi marcadores é interessantes para alguns determinados casos.

ashwinkapure commented 5 years ago

@jeromeetienne Where can I find the augmented-screen example exactly, that you talked about above, please? i found the example here https://github.com/jeromeetienne/AR.js/blob/master/three.js/examples/multi-markers/examples/player.html i am trying to create a same kind of example but i am a new to javascript, here the objects are created through coding and i need a 3d model to be loaded, i need help on this if you can, i would really appreciate it

jamess922 commented 5 years ago

Looks we still can not use custom markers to generate one marker ,so sad

commentatorboy commented 5 years ago

Uhm... I do not know if it is relevant, but as I understand it you want to have multiple markers that displays one thing. That is technically possible. It all depends on the position of the 3D objects to each other. You can have one marker position (call it A). The first part of the 3D object for that shows right on top of it. The second marker position (call it B), is besides A. The second part of the 3D object can be set to a position around A. (using ex. position="-1 0.5 -3" rotation="0 45 0" <- that is relative to the marker positon)

But that also means that the marker positions are dependent of each other.

I hope that makes sense.

droid001 commented 5 years ago

I managed to do something like this with printing out a large sheet of paper with multiple markers on it in a grid like fashion. Then using the marker detection events the model was shifted according to the latest detected marker. So this means that you have hardcoded values of the marker's position in an arbitrary grid. Not as fancy as marker-learning but it helps with keeping a model on the user's screen.

commentatorboy commented 5 years ago

Stupid question, is it possible to do marker-learning in AR.js? I know @jeromeetienne said it is possible, but I am quite confused about what marker-learning is referred too. (As I understand, it is just creating a custom marker and creating the .patt file?)

droid001 commented 5 years ago

@commentatorboy That's creating a custom marker. Marker-learner is a process where you have your scene (start) then exit it to an other site which analysis the markers in the real world and gathers statistics on it (training) whereafter you return to your project by hitting the 'stop' button. This is oppose to increase the stability of the scene. Only problem that this hasn't been working for a while.

commentatorboy commented 5 years ago

Is it not basically this example? I got this to work? I trained them all, and then it showed the figure in the middle? https://jeromeetienne.github.io/AR.js/three.js/examples/multi-markers/examples/player.html (found in https://jeromeetienne.github.io/AR.js-docs/misc/EXAMPLES.html) image

Here is what I did.

  1. Go to the website above.
  2. Click on the green round button
  3. I had all markers in a single image: https://imgur.com/a/Y0Io4c9
  4. I trained them all, until all markers were green and "Done".
  5. I clicked the green button again.
  6. Showed the same picture again and the figure were shown.

Even if I turned the marker helper off it still showed the figure in the middle.

droid001 commented 5 years ago

Cool! Guess the SO issue needs an update then.

droid001 commented 5 years ago

marker-learner_workin_in_2019 Nice how well it works on extreme angles.

gftruj commented 5 years ago

@commentatorboy Thanks for the effort, I'll update the SO anwser once i get back from work !

commentatorboy commented 5 years ago

Good I could help. Should we close this issue then? @mariovde Have you tried it?

gftruj commented 5 years ago

I've updated my SO anwser + issue #405.

gftruj commented 5 years ago

I wouldn't close it. The author wanted an area consisting of custom markers. something like this:

Imgur Image

Unfortunately I had to modify the ar.js source code to make it work (just to make sure it's easily doable), and I would like to try and make a PR (as i mentioned in #405)

gftruj commented 5 years ago

I've added a PR, which enables providing a list of urls for the learner site (instead of the hardcoded ones). If you want custom markers just check out the changes in multimarker-utils

danhtanhd commented 4 years ago

My English is not good but I discovered a simple way to have multi custom markers.

  1. Open the training page and prepare the default marker like: Kanji Hiro.
  2. Arrange the markers according to the desired position and training. 3.When all the markers you wanted to be learned are checked green, hit pause, then open your browser’s inspector go to the console and then type: localStorage.getItem ('ARjsMultiMarkerFile'); Copy its output and remember to remove the ”” encompassing it. Then create a file on the root directory of your project with any name and copy the contents you extracted there.
  3. Add this script to the html page        
  4. In the code file ARjsMultiMarkerFile change the default link marker with your link marker. I have tried and successfully hope you will too