Closed Ang3ls closed 8 years ago
AFAIK it's impossible to do perspective transformations with the 2D canvas context.
You could use WebGL (but the setup from scratch is a bit complicated)
Or even CSS transformaionss (but you still we need to calculate the transformation)
You really should be using some third-party library for that kind of stuff (like Three.js).
Take a look to the debug-posit example: https://github.com/jcmellado/js-aruco/blob/master/samples/debug-posit/debug-posit.html
Live demo here: https://jcmellado.github.io/js-aruco/debug/debug.html
It use Three.js to draw the rectangles (variables "plane1" and "plane2" on the source code).
It is easy to associate an image to that rectangles replacing: material = new THREE.MeshNormalMaterial(),
with something like this: texture = THREE.ImageUtils.loadTexture("textures/earth.jpg"), material = new THREE.MeshBasicMaterial( {map: texture} ),
I used the example webcam live demo and it works very well ... doing various experiments have not been able to use DrawImage instead of strokeText to insert an image on the marker ... how can I do?
` function drawImage(markers) {
I think the refresh rate is too high to upload and insert an image in this way ... someone can help me?