提交 02fddda5 编写于 作者: J Jerome Etienne

more work

上级 eccf0d1a
......@@ -106,8 +106,7 @@ by
```html
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="https://rawgit.com/jeromeetienne/ar.js/master/aframe/build/aframe-ar.js"></script>
<script>THREEx.ArToolkitContext.baseURL = 'https://rawgit.com/jeromeetienne/ar.js/master/three.js/'</script>
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
<body style='margin : 0px; overflow: hidden;'>
<a-scene embedded artoolkit='sourceType: webcam;'>
<a-box position='0 0 0.5' material='opacity: 0.5;'></a-box>
......
- do a webvr demo with a hole in the ground. - good for tango
- possible demo: hole in the wall, refraction, liquid marker but on all the wall
- release soon and start doing dev/master
- create a dev branch
- release AR.js as 1.2
......
# High Level Description
The workflow is splitted into 3 steps :
1. collect statistics about the relative position of each marker couple
1. generation of multi-marker description
1. using the multi-marker
So we first have a learning phase to collect data and generating result, then
we have a usage phase, where the multi-marker is used in a AR application.
So in short, you put all your markers where you like them. Then you scan them
with your phone to collect statistics about their relative position.
When you are done, you start using the AR application with this multi-marker.
# Definitions
- a multi-marker is several markers acting as one
- a markerA is said to be a sub-marker of a multi-marker
# Learning Algo description
- every time i see markerA and markerB at the same time, i store statistics on their relative position
- such couple is called a seen-couple
- the statistics collected are simply an average of position/quaternion/scale
- this statistics can be trivially expressed as a transformation matrix
# Generation of Multi-Marker description
- when the learning is considered completed, we generate a multi marker description
- it is a json file in which each sub-markers has a transformation matrix relative to the origin sub-marker
- the first sub-marker is the anchor/root sub-marker.
- The origin position of the multi-marker is the origin sub-marker
- the origin sub-marker MUST be seen at least once during the learning phase
## Description Format
- the description format is simple:
- it is a list with one item for each sub-markers
- it contains a description of the sub-markers (e.g. marker barcode 3)
- and a poseMatrix which is the transformation matrix relative to the origin sub-markers
- the first item is the origin sub-marker
---
# Computation of the average matrix for each sub-marker
Once statistics are collected, we need to produce a description of this new
area. This is a json structure describing each sub-marker and their respective
position.
Here are the algo which can be used
## Minimal Algo - assume origin always visible
- Assume that the origin sub-marker is ALWAYS visible
- Look on all the seen-couple of the origin sub-marker
- for each sub-markers, you got the relative position with the origin sub-marker
- just generate the transformation matrix for it
This is the one implemented
## Minimal Algo - origin may sometime be invisible
- do first pass where you compute all couple which contain the origin submarkers
- so you computed the transformation matrix for each sub-marker which has been
visible with the origin marker
- you computed the level 1 of transformation matrices
- the level 0 would the transformation matrix of the origin sub-marker. But it is
always the identity matrix.
- you do an iterative process, where each iterations compute one more level.
Algo for one iteration
1. for each sub-markers, check all the seen couple it appears in
2. if at least one already has a transformation matrix, compute the transformation
3. Loop until all sub-markers got computed
......@@ -35,3 +35,78 @@ Thus even if only one sub-marker is visible, multi-marker position will still be
I tried to workaround those issues, but it rapidely became a pain.
So i prefered to devote my energy at building a good version instead of
working around those bugs.
---
# High Level Description
The workflow is splitted into 3 steps :
1. collect statistics about the relative position of each marker couple
1. generation of multi-marker description
1. using the multi-marker
So we first have a learning phase to collect data and generating result, then
we have a usage phase, where the multi-marker is used in a AR application.
So in short, you put all your markers where you like them. Then you scan them
with your phone to collect statistics about their relative position.
When you are done, you start using the AR application with this multi-marker.
# Definitions
- a multi-marker is several markers acting as one
- a markerA is said to be a sub-marker of a multi-marker
# Learning Algo description
- every time i see markerA and markerB at the same time, i store statistics on their relative position
- such couple is called a seen-couple
- the statistics collected are simply an average of position/quaternion/scale
- this statistics can be trivially expressed as a transformation matrix
# Generation of Multi-Marker description
- when the learning is considered completed, we generate a multi marker description
- it is a json file in which each sub-markers has a transformation matrix relative to the origin sub-marker
- the first sub-marker is the anchor/root sub-marker.
- The origin position of the multi-marker is the origin sub-marker
- the origin sub-marker MUST be seen at least once during the learning phase
## Description Format
- the description format is simple:
- it is a list with one item for each sub-markers
- it contains a description of the sub-markers (e.g. marker barcode 3)
- and a poseMatrix which is the transformation matrix relative to the origin sub-markers
- the first item is the origin sub-marker
---
# Computation of the average matrix for each sub-marker
Once statistics are collected, we need to produce a description of this new
area. This is a json structure describing each sub-marker and their respective
position.
Here are the algo which can be used
## Minimal Algo - assume origin always visible
- Assume that the origin sub-marker is ALWAYS visible
- Look on all the seen-couple of the origin sub-marker
- for each sub-markers, you got the relative position with the origin sub-marker
- just generate the transformation matrix for it
This is the one implemented
## Minimal Algo - origin may sometime be invisible
- do first pass where you compute all couple which contain the origin submarkers
- so you computed the transformation matrix for each sub-marker which has been
visible with the origin marker
- you computed the level 1 of transformation matrices
- the level 0 would the transformation matrix of the origin sub-marker. But it is
always the identity matrix.
- you do an iterative process, where each iterations compute one more level.
Algo for one iteration
1. for each sub-markers, check all the seen couple it appears in
2. if at least one already has a transformation matrix, compute the transformation
3. Loop until all sub-markers got computed
- what to do with the official multimarker support
- make an example for it, and keep supporting it
- make all markers children of a parent THREEx.ArBaseControls()
- GOAL: make it explicit what is expected from a AR controls
- emit event
- have id
- anything which is common
- TODO put a smoother on sub-marker while learning ? as a way to remove noise ?
- do it and hide it behind a flags
- in relation with THREEx.ArBaseControls
- do an apps which does something with it
- a minecraft going from markers to markers
- a minecraft going from submarkers to submarkers
- add a-frame support
- support for learning new area
- support for learning new area - can i just use the area-learner.html
- support of multi-marker description
- do a post about multimarker
- how to use them,
- workflow: learning then using
- pro: larger area can be coverded by
- what to do with the official multimarker support
- make an example for it, and keep supporting it
# How to compute the result of the learning
- we got statistics on the position/orientation/scale between each marker seen simultaneously
- we want a transposition matrix relative to the origin markersControls
- do a post about multimarker - https://medium.com/p/4bcafc785dfd/edit
- step1 - build the transposition matrix relative the origin marker controls
- store it in the userData
- use similar format as local matrix
- step2 - generate the file
- LATER: how to get more robust statistics?
- DONE merge it all in the README.md
......@@ -164,6 +164,8 @@
markerControls.object3d.add( markerHelper.object3d )
}
// TODO here put a THREEx.ArSmoothedControls behind a flag - could be useful for tunning
// store it in the parameters
subMarkersControls.push(markerControls)
})
......
......@@ -302,8 +302,6 @@
multiMarkerPlay(JSON.stringify(multiMarkerFile))
}
//////////////////////////////////////////////////////////////////////////////////
// render the whole thing on the page
......
var THREEx = THREEx || {}
THREEx.ArBaseControls = function(object3d){
this.id = THREEx.ArBaseControls.id++
this.object3d = object3d
// Events to honor
// this.dispatchEvent({ type: 'becameVisible' })
// this.dispatchEvent({ type: 'becameUnVisible' })
}
THREEx.ArBaseControls.id = 0
Object.assign( THREEx.ArBaseControls.prototype, THREE.EventDispatcher.prototype );
//////////////////////////////////////////////////////////////////////////////
// Functions
//////////////////////////////////////////////////////////////////////////////
/**
* error catching function for update()
*/
THREEx.ArBaseControls.prototype.update = function(){
console.assert(false, 'you need to implement your own update')
}
......@@ -103,7 +103,7 @@ THREEx.ArSmoothedControls.prototype.update = function(targetObject3d){
object3d.scale.lerp(targetObject3d.scale, parameters.lerpScale)
}
// disabled the lerp by directly copying targetObject3d position/quaternion/scale
// disable the lerp by directly copying targetObject3d position/quaternion/scale
// if( false ){
// this.object3d.position.copy( targetObject3d.position )
// this.object3d.quaternion.copy( targetObject3d.quaternion )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册