3/28/2021 0 Comments Artoolkit Tutorial
This article discusses APIs that are not yet fully standardized.
![]() ![]() FLARToolKit itself is port of the Java NyARToolKit, which is a port of the C ARToolKit. As it needs to read the image off the canvas, the image needs to come from the same origin as the page or use CORS to get around same-origin policy. In a nutshell, set the crossOrigin -property on the image or video element you want to use as a texture to or anonymous. To draw a 3D object on top of a marker, you pass the transformation matrix to whatever 3D rendering library youre using so that your object is transformed using the matrix. Then, draw the video frame in your WebGL scene and draw the object on top of that and youre good to go. JSARToolKit is fast enough on modern JavaScript engines to do this in realtime even on 640x480 video frames. However, the larger the video frame, the longer it takes to process. A good video frame size is 320x240, but if you expect to use small markers or multiple markers, 640x480 is preferable. You can also try opening the marker image on your phone or tablet and showing it to the webcam. Move the marker out of the cameras view and show it again and the image has changed. The basic idea is that you have a detector object that operates on a raster object. Between the detector and the raster is a camera parameter object that transforms raster coordinates to camera coordinates. To get the detected markers from the detector, you iterate over them and copy their transformation matrices over to your code. For pre-recorded videos, just set the source attribute of the video to the video URL. If youre doing marker detection from still images, you can use a image element in much the same way. For more details, check out Eric Bidelmans article on Capturing Audio Video in HTML5. First draw the image onto the raster object canvas, then run the detector on the raster object. The detector returns the number of markers found in the image. You use the transformation matrices for putting 3D objects on top of the markers. It works by magic (read: I dont know how ARToolKit matrices are setup.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |