<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-10982672</id><updated>2011-11-06T23:33:09.582-08:00</updated><title type='text'>Image Processing and the ARToolkit</title><subtitle type='html'>This blog fulfills part of the requirements for COMP TUI (Tangible User Interface) Laboratory at Tufts University, Medford MA. Each group in the class is investigating a TUI related technology and is reporting their discoveries in blogs for the benefit of others.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-10982672.post-111030023899006037</id><published>2005-03-08T08:42:00.000-08:00</published><updated>2005-03-08T08:43:58.993-08:00</updated><title type='text'>Acknowledgements</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;The information contained here has been drawn from many sources which are generally the work of some combination of these people:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Hirokazu Kato &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Mark Billinghurst &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Rob Blanding &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Richard May &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Hiroshi Ishii &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Ronald Azuma &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Ivan Poupyrev &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Philip Lamb &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; and others...&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10982672-111030023899006037?l=comptuicomputervision.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/111030023899006037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10982672&amp;postID=111030023899006037' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111030023899006037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111030023899006037'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/2005/03/acknowledgements.html' title='Acknowledgements'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10982672.post-111030008703707665</id><published>2005-03-08T08:33:00.000-08:00</published><updated>2005-03-08T08:55:54.463-08:00</updated><title type='text'>Reliability</title><content type='html'>&lt;span style="font-family:Arial;font-size:85%;"&gt;The most likely problem that you will encounter is to do with lighting conditions. They can be affected by light from windows and reflections from overhead lights. One way to compensate is be adjusting the threshold value in the program (in AR applications, pressing the 't' key will often allow the user to adjust the threshold value). Another way is make tracking more reliable is to cut the black part of the marker out of thin self-adhesive felt (can be sold for lining drawers, etc). Black felt is totally non-reflective and will ensure the marker has good contrast in all situations.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;img src="http://www.ceeo.tufts.edu/robotable/hiroPatt.jpg" /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10982672-111030008703707665?l=comptuicomputervision.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/111030008703707665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10982672&amp;postID=111030008703707665' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111030008703707665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111030008703707665'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/2005/03/reliability.html' title='Reliability'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10982672.post-111029944325042269</id><published>2005-03-08T08:00:00.000-08:00</published><updated>2005-03-08T08:32:11.770-08:00</updated><title type='text'>paddleDemo.c</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;The ARtoolkit download includes paddleDemo, which is a great introduction to Tangible AR interaction techniques. The techniques used for this demo are tilt, to drop an object, and pickup and are implemented in the file&lt;span style="font-family:courier new;"&gt; command_sub.c&lt;/span&gt; by the functions &lt;span style="font-family:courier new;"&gt;check_incline&lt;/span&gt; and &lt;span style="font-family:courier new;"&gt;check_pickup&lt;/span&gt; respectively.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;img src="http://www.ceeo.tufts.edu/robotable/paddleDemo.jpg" /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10982672-111029944325042269?l=comptuicomputervision.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/111029944325042269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10982672&amp;postID=111029944325042269' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111029944325042269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111029944325042269'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/2005/03/paddledemoc.html' title='paddleDemo.c'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10982672.post-111029703159495732</id><published>2005-03-08T06:52:00.000-08:00</published><updated>2005-03-08T07:52:05.366-08:00</updated><title type='text'>Interactions</title><content type='html'>&lt;p&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;span style="font-size:130%;color:#cc6600;"&gt;Example: Paddle Interaction&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Proximity based&lt;br /&gt;&lt;/strong&gt;When two markers are within a certain distance of each other there is an interaction between the virtual objects. The paddle may "pick up" a virtual object or "push" it.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;strong&gt;Tilting&lt;/strong&gt;&lt;br /&gt;At a certain angle, a virtual object can be made to "slide off" the paddle.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;strong&gt;Shaking&lt;/strong&gt;&lt;br /&gt;A shaking motion can be used to delete an object.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;strong&gt;Hitting&lt;/strong&gt;&lt;br /&gt;Objects can be removed by hitting them with the paddle&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;span style="font-size:130%;color:#cc6600;"&gt;Local vs. Global Interactions&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Local&lt;/strong&gt;&lt;br /&gt;Actions are determined by a single camera to marker transform - shaking, appearance, relative position, range.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;strong&gt;Global&lt;/strong&gt;&lt;br /&gt;Actions determined from two relationships - marker to camera, and camera to world coordinates. The marker transform is determined in world coordinates to identify tilit, absolute position, obsolute rotation, hitting.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;So all interactions are found based on the camera to marker transforms that are returned by the function &lt;span style="font-family:courier new;"&gt;arGetTransMat&lt;/span&gt;&lt;span style="font-family:arial;"&gt;, which returns a 3 x 4 matrix that is the usual 4 x 4 3D transformation without the bottom row.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;/* get the camera transformation */&lt;/span&gt;&lt;br /&gt;arGetTransMat(&amp;marker_info[k], marker_center, marker_width, marker_trans);&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;So the range from the camera to the marker is:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;/* find the range */&lt;/span&gt;&lt;br /&gt;Xpos = marker_trans[0][3];&lt;br /&gt;Ypos = marker_trans[1][3];&lt;br /&gt;Zpos = marker_trans[2][3];&lt;br /&gt;range = sqrt(Xpos*Xpos+Ypos*Ypos+Zpos*Zpos);&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10982672-111029703159495732?l=comptuicomputervision.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/111029703159495732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10982672&amp;postID=111029703159495732' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111029703159495732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111029703159495732'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/2005/03/interactions.html' title='Interactions'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10982672.post-111024733867946471</id><published>2005-03-07T18:00:00.000-08:00</published><updated>2005-03-07T18:06:26.276-08:00</updated><title type='text'>How it works</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;ARToolKit uses computer vision techniques to calculate the real camera viewpoint relative to a real world marker. There are several steps as shown in images below. First the live video image (left) is turned into a binary (black or white) image based on a lighting threshold value (center). This image is then searched for square regions. ARToolKit finds all the squares in the binary image, many of which are not the tracking markers. For each square, the pattern inside the square is captured and matched again some pre-trained pattern templates. If there is a match, then ARToolKit has found one of the AR tracking markers. ARToolKit then uses the known square size and pattern orientation to calculate the position of the real video camera relative to the physical marker. A 3x4 matrix is filled in with the video camera real world coordinates relative to the card. This matrix is then used to set the position of the virtual camera coordinates. Since the virtual and real camera coordinates are the same, the computer graphics that are drawn precisely overlay the real marker (right). The OpenGL API is used for setting the virtual camera coordinates and drawing the virtual images.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;img src="http://www.ceeo.tufts.edu/robotable/hiro_frame.jpg" /&gt;  &lt;/span&gt; &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;img src="http://www.ceeo.tufts.edu/robotable/hiro_thresh_lines.jpg" /&gt;&lt;/span&gt;   &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;img src="http://www.ceeo.tufts.edu/robotable/hiro_cube.jpg" /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10982672-111024733867946471?l=comptuicomputervision.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/111024733867946471/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10982672&amp;postID=111024733867946471' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111024733867946471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111024733867946471'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/2005/03/how-it-works.html' title='How it works'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10982672.post-111023779662366409</id><published>2005-03-07T14:55:00.000-08:00</published><updated>2005-03-08T06:32:18.503-08:00</updated><title type='text'>Directory Structure</title><content type='html'>&lt;span style="font-family:Arial;font-size:130%;color:#cc6600;"&gt;Files&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;The executable produced when &lt;span style="font-family:courier new;"&gt;simpleTest.c&lt;/span&gt; is compiled is &lt;span style="font-family:courier new;"&gt;simpleTestd.exe&lt;/span&gt;. In the same directory is a folder called Data that contains three files required by the program.&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;img src="http://www.ceeo.tufts.edu/robotable/file_structure.jpg" /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;camera_para.dat&lt;/strong&gt;&lt;br /&gt;In artoolkit, camera parameter consists of perspective projectionmatrix and distortion parameters. The perspective projectionmatrix does not contain translation/rotation components. It consistsof field of view (f), aspect ratio(a), skew factor(s) and image center(x,y): &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;   f  s  x  0&lt;br /&gt;   0 af  y  0&lt;br /&gt;   0  0  1  0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Also usually s = 0. It depends on camera calibration method.This represents relationship between camera &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;coordinates (X,Y,Z) andscreen coordinates (x, y).Unit of (X,Y,Z) is usually [mm]. This also depends on camera calibration.Unit of (x,y) is [pixel].&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;hiroPatt&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;A previously recorded image of the "Hiro" pattern is included for matching with markers found in the video. The Data folder will also contain files for other markers to be identified.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;object_data&lt;br /&gt;&lt;/strong&gt;This file says which virtual objects the patterns correspond to.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10982672-111023779662366409?l=comptuicomputervision.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/111023779662366409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10982672&amp;postID=111023779662366409' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111023779662366409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111023779662366409'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/2005/03/directory-structure.html' title='Directory Structure'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10982672.post-111022615626110682</id><published>2005-03-07T11:43:00.000-08:00</published><updated>2005-03-07T17:20:48.953-08:00</updated><title type='text'>Example</title><content type='html'>&lt;span style="font-family:arial;font-size:130%;color:#cc6600;"&gt;simpleTest.c&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;color:#000000;"&gt;In this example a virtual cube is aligned on a real mark as shown in this picture.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;img src="http://www.ceeo.tufts.edu/robotable/screen_simple.jpg" /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt;Read through this file and notice how it relates to the six steps of the application structure given in the previous post.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;#ifdef&lt;/span&gt; &lt;span style="color:#000000;"&gt;_WIN32&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt; &lt;span style="color:#000000;"&gt;&amp;lt;windows.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt; &lt;span style="color:#000000;"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;stdio.h&gt;&lt;stdio.h&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt; &lt;span style="color:#000000;"&gt;&amp;lt;stdlib.h&amp;gt;&lt;/span&gt;&lt;stdlib.h&gt;&lt;stdlib.h&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#ifndef&lt;/span&gt; &lt;span style="color:#000000;"&gt;__APPLE__&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt; &lt;span style="color:#000000;"&gt;&amp;lt;GL/gl.h&amp;gt;&lt;/span&gt;&lt;gl&gt;&lt;gl&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt; &lt;gl&gt;&lt;gl&gt;&lt;span style="color:#000000;"&gt;&amp;lt;GL/glut.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#else&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt; &lt;span style="color:#000000;"&gt;&amp;lt;OpenGL/gl.h&amp;gt;&lt;/span&gt;&lt;opengl&gt;&lt;opengl&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt; &lt;span style="color:#000000;"&gt;&amp;lt;GLUT/glut.h&amp;gt;&lt;/span&gt;&lt;glut&gt;&lt;glut&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt; &lt;ar&gt;&lt;ar&gt;&lt;span style="color:#000000;"&gt;&amp;lt;AR/gsub.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt; &lt;span style="color:#000000;"&gt;&amp;lt;AR/video.h&amp;gt;&lt;/span&gt;&lt;ar&gt;&lt;ar&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt; &lt;ar&gt;&lt;ar&gt;&lt;span style="color:#000000;"&gt;&amp;lt;AR/param.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;ar&gt;&lt;ar&gt;&amp;lt;AR/ar.h&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;/*****************************************************************************/&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;// modified by Thomas Pintaric, Vienna University of Technology&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;#ifdef&lt;/span&gt; &lt;span style="color:#000000;"&gt;_WIN32&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;char&lt;/span&gt;         &lt;span style="color:#000000;"&gt;*vconf = "flipV,showDlg";&lt;/span&gt; &lt;span style="color:#009900;"&gt;// see video.h for a list of supported parameters&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;#else&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;char&lt;/span&gt;         &lt;span style="color:#000000;"&gt;*vconf = "";&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;/*****************************************************************************/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;   &lt;span style="color:#000000;"&gt;xsize, ysize;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;   &lt;span style="color:#000000;"&gt;thresh = 100;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;   &lt;span style="color:#000000;"&gt;count = 0;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;char&lt;/span&gt;    &lt;span style="color:#000000;"&gt;*cparam_name = "Data/camera_para.dat";&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;ARParam  cparam;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;char&lt;/span&gt;    &lt;span style="color:#000000;"&gt;*patt_name = "Data/patt.hiro";&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;      &lt;span style="color:#000000;"&gt;patt_id;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;double&lt;/span&gt;   &lt;span style="color:#000000;"&gt;patt_width = 80.0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;double&lt;/span&gt;   &lt;span style="color:#000000;"&gt;patt_center[2] = {0.0, 0.0};&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;double&lt;/span&gt;   &lt;span style="color:#000000;"&gt;patt_trans[3][4];&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;static void&lt;/span&gt; &lt;span style="color:#000000;"&gt;init(&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;static void&lt;/span&gt; &lt;span style="color:#000000;"&gt;cleanup(&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;static void&lt;/span&gt; &lt;span style="color:#000000;"&gt;keyEvent(&lt;/span&gt; &lt;span style="color:#3333ff;"&gt;unsigned char&lt;/span&gt; &lt;span style="color:#000000;"&gt;key,&lt;/span&gt; &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; &lt;span style="color:#000000;"&gt;x,&lt;/span&gt; &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; &lt;span style="color:#000000;"&gt;y);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;static void&lt;/span&gt; &lt;span style="color:#000000;"&gt;mainLoop(&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;static void&lt;/span&gt; &lt;span style="color:#000000;"&gt;draw(&lt;/span&gt; &lt;span style="color:#3333ff;"&gt;void&lt;/span&gt; &lt;span style="color:#000000;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; &lt;span style="color:#000000;"&gt;main(&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; &lt;span style="color:#000000;"&gt;argc,&lt;/span&gt; &lt;span style="color:#3333ff;"&gt;char&lt;/span&gt; &lt;span style="color:#000000;"&gt;**argv)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;{&lt;br /&gt;   init();&lt;br /&gt;&lt;br /&gt;   arVideoCapStart();&lt;br /&gt;   argMainLoop( NULL, keyEvent, mainLoop );&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;return&lt;/span&gt; &lt;span style="color:#000000;"&gt;(0);&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;static void&lt;/span&gt; &lt;span style="color:#000000;"&gt;keyEvent(&lt;/span&gt; &lt;span style="color:#3333ff;"&gt;unsigned char&lt;/span&gt; &lt;span style="color:#000000;"&gt;key,&lt;/span&gt; &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; &lt;span style="color:#000000;"&gt;x,&lt;/span&gt; &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; &lt;span style="color:#000000;"&gt;y)&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#009900;"&gt;/* quit if the ESC key is pressed */&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt;( key == 0x1b ) {&lt;br /&gt;      printf("*** %f (frame/sec)\n", (&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;double&lt;/span&gt;&lt;span style="color:#000000;"&gt;)count/arUtilTimer());&lt;br /&gt;      cleanup();&lt;br /&gt;      exit(0);&lt;br /&gt;   }&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;/* main loop */&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;static void&lt;/span&gt; &lt;span style="color:#000000;"&gt;mainLoop(&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;{&lt;br /&gt;   ARUint8      *dataPtr;&lt;br /&gt;   ARMarkerInfo *marker_info;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;           &lt;span style="color:#000000;"&gt;marker_num;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;           &lt;span style="color:#000000;"&gt;j, k;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;   &lt;span style="color:#009900;"&gt;/* grab a video frame */&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt;( (dataPtr = (ARUint8 *)arVideoGetImage()) == NULL ) {&lt;br /&gt;      arUtilSleep(2);&lt;/span&gt;&lt;br /&gt;      &lt;span style="color:#3333ff;"&gt;return&lt;/span&gt;&lt;span style="color:#000000;"&gt;;&lt;br /&gt;   }&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt;( count == 0 ) arUtilTimerReset();&lt;br /&gt;   count++;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;color:#000000;"&gt;   argDrawMode2D();&lt;br /&gt;   argDispImage( dataPtr, 0,0 );&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;/* detect the markers in the video frame */&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt;( arDetectMarker(dataPtr, thresh, &amp;marker_info, &amp;amp;marker_num) &amp;lt; 0)&lt;br /&gt;      cleanup();&lt;br /&gt;      exit(0);&lt;br /&gt;   }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;   &lt;span style="color:#009900;"&gt;/* check for object visibility */&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#000000;"&gt;k = -1;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;for&lt;/span&gt;&lt;span style="color:#000000;"&gt;( j = 0; j &amp;lt; marker_num; j++) {&lt;/span&gt;&lt;br /&gt;      &lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt;( patt_id == marker_info[j].id ) {&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt;( k == -1 ) k = j;&lt;/span&gt;&lt;br /&gt;         &lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;else if&lt;/span&gt;&lt;span style="color:#000000;"&gt;( marker_info[k].cf &amp;lt; marker_info[j].cf) k = j;&lt;br /&gt;      }&lt;br /&gt;   }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;   &lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#000000;"&gt;( k == -1 ) {&lt;br /&gt;      argSwapBuffers();&lt;/span&gt;&lt;br /&gt;      &lt;span style="color:#3333ff;"&gt;return&lt;/span&gt;&lt;span style="color:#000000;"&gt;;&lt;br /&gt;   }&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;   &lt;span style="color:#009900;"&gt;/* get the transformation between the marker and the real camera */&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;   arGetTransMat(&amp;marker_info[k], patt_center, patt_width, patt_trans);&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;   draw();&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;   argSwapBuffers();&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="color:#009900;"&gt;/* initialize the video path, read in the marker and camera parameters,&lt;br /&gt; and setup the graphics window */&lt;/span&gt;&lt;br /&gt;static void&lt;/span&gt; &lt;span style="color:#000000;"&gt;init(&lt;/span&gt; &lt;span style="color:#3333ff;"&gt;void&lt;/span&gt; &lt;span style="color:#000000;"&gt;)&lt;br /&gt;{&lt;br /&gt;   ARParam wparam;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;   &lt;span style="color:#009900;"&gt;/* open the video path */&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt;( arVideoOpen( vconf ) &amp;lt; 0) exit(0);&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#009900;"&gt;/* find the size of the window */&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt;( arVideoInqSize(&amp;xsize, &amp;amp;ysize) &amp;lt; 0) exit(0);&lt;br /&gt;   printf("Image size (x,y) = (%d,%d)\n", xsize, ysize);&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;   &lt;span style="color:#009900;"&gt;/* read and set the initial camera parameters */&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;( arParamLoad(cparam_name, 1, &amp;wparam)  &amp;lt; 0) {&lt;br /&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;color:#000000;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;printf("Camera parameter load error !!\n");&lt;br /&gt;      exit(0);&lt;/span&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;   arParamChangeSize( &amp;wparam, xsize, ysize, &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;cparam );&lt;br /&gt;   arInitCparam( &amp;cparam );&lt;br /&gt;   printf("*** Camera Parameter ***\n");&lt;br /&gt;   arParamDisp( &amp;cparam );&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:#009900;"&gt;   /* read the marker (pattern) file */&lt;/span&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span style="color:#3333ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt;( (patt_id=arLoadPatt(patt_name)) &amp;lt; 0 ) {&lt;br /&gt;      printf("pattern load error !!\n");&lt;br /&gt;      exit(0);&lt;br /&gt;   }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;   /* open the graphics window */&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;   argInit( &amp;cparam, 1.0, 0, 0, 0, 0 );&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;/* cleanup function called when program exits */&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;static void&lt;/span&gt; &lt;span style="color:#000000;"&gt;cleanup(&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;{&lt;br /&gt;   arVideoCapStop();&lt;br /&gt;   arVideoClose();&lt;br /&gt;   argCleanup();&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;static void&lt;/span&gt; &lt;span style="color:#000000;"&gt;draw(&lt;/span&gt; &lt;span style="color:#3333ff;"&gt;void&lt;/span&gt; &lt;span style="color:#000000;"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;double&lt;/span&gt;   &lt;span style="color:#000000;"&gt; gl_para[16];&lt;br /&gt;   GLfloat   mat_ambient[]     = {0.0, 0.0, 1.0, 1.0};&lt;br /&gt;   GLfloat   mat_flash[]       = {0.0, 0.0, 1.0, 1.0};&lt;br /&gt;   GLfloat   mat_flash_shiny[] = {50.0};&lt;br /&gt;   GLfloat   light_position[]  = {100.0,-200.0,200.0,0.0};&lt;br /&gt;   GLfloat   ambi[]            = {0.1, 0.1, 0.1, 0.1};&lt;br /&gt;   GLfloat   lightZeroColor[]  = {0.9, 0.9, 0.9, 0.1};&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;   argDrawMode3D();&lt;br /&gt;   argDraw3dCamera( 0, 0 );&lt;br /&gt;   glClearDepth( 1.0 );&lt;br /&gt;   glClear(GL_DEPTH_BUFFER_BIT);&lt;br /&gt;   glEnable(GL_DEPTH_TEST);&lt;br /&gt;   glDepthFunc(GL_LEQUAL);&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;   /* load the camera transformation matrix */&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;   argConvGlpara(patt_trans, gl_para);&lt;br /&gt;   glMatrixMode(GL_MODELVIEW);&lt;br /&gt;   glLoadMatrixd( gl_para );&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;   glEnable(GL_LIGHTING);&lt;br /&gt;   glEnable(GL_LIGHT0);&lt;br /&gt;   glLightfv(GL_LIGHT0, GL_POSITION, light_position);&lt;br /&gt;   glLightfv(GL_LIGHT0, GL_AMBIENT, ambi);&lt;br /&gt;   glLightfv(GL_LIGHT0, GL_DIFFUSE, lightZeroColor);&lt;br /&gt;   glMaterialfv(GL_FRONT, GL_SPECULAR, mat_flash);&lt;br /&gt;   glMaterialfv(GL_FRONT, GL_SHININESS, mat_flash_shiny);&lt;br /&gt;   glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);&lt;br /&gt;   glMatrixMode(GL_MODELVIEW);&lt;br /&gt;   glTranslatef( 0.0, 0.0, 25.0 );&lt;br /&gt;   glutSolidCube(50.0);&lt;br /&gt;   glDisable( GL_LIGHTING );&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;glDisable( GL_DEPTH_TEST );&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10982672-111022615626110682?l=comptuicomputervision.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/111022615626110682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10982672&amp;postID=111022615626110682' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111022615626110682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111022615626110682'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/2005/03/example.html' title='Example'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10982672.post-111021918647985359</id><published>2005-03-07T09:01:00.000-08:00</published><updated>2005-03-07T12:51:56.543-08:00</updated><title type='text'>Basic Structure</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="color:#cc6600;"&gt;&lt;span style="font-family:arial;"&gt;ARToolkit Structure&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;img src="http://www.ceeo.tufts.edu/robotable/ARTkStructure.jpg" /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;There are three key libraries:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;libAR - tracking&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;libARgsub - image drawing&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;libARvideo - video capturing&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;span style="font-size:130%;color:#cc6600;"&gt;Application Structure&lt;/span&gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;An ARToolkit application involves the following steps:&lt;br /&gt;&lt;br /&gt;1. Initialize – start video, read marker patterns &amp; camera parameters.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;2. Grab video frame.&lt;br /&gt;3. Detect markers &amp;amp; recognize patterns.&lt;br /&gt;4. Calculate camera transformation relative to the detected patterns.&lt;br /&gt;5. Draw virtual objects on detected patterns.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;6. Close video.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;br /&gt;Steps 2 through 5 are repeated continuously until the application quits, while steps 1 and 6 are done on initialization and shutdown respectively. In addition to these steps the application may need to respond to mouse, keyboard or other application specific events.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10982672-111021918647985359?l=comptuicomputervision.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/111021918647985359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10982672&amp;postID=111021918647985359' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111021918647985359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111021918647985359'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/2005/03/basic-structure.html' title='Basic Structure'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10982672.post-111020616087005916</id><published>2005-03-07T06:35:00.000-08:00</published><updated>2005-03-07T11:31:03.400-08:00</updated><title type='text'>Installation</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;span style="font-size:130%;color:#cc6600;"&gt;ARToolkit 2.70 with VRML support&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The latest version is available from &lt;a href="http://sourceforge.net/projects/artoolkit"&gt;http://sourceforge.net/projects/artoolkit&lt;/a&gt;&lt;/span&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt; and includes the following files:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;ARToolkit-2.70.tgz                   Platform independent&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;DsVideoLib-0.0.4-win32.zip       i386&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;OpenVRML-0.14.3-win32.zip     i386&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;The ARToolKit is a collection of libraries, utilities applications, and documentation and sample code. The libraries provide the user with a means to capture images from video sources, process those images to optically track markers in the images, and to allow compositing of computer-generated content with the real-world images and display the result using OpenGL (Phillip Lamb, 2004). ARToolKit is designed to build on Windows, Linux, SGI Irix, andMacintosh OS X platforms.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;span style="font-size:130%;color:#cc6600;"&gt;Building on Windows&lt;/span&gt;&lt;br /&gt;(Read the full release notes on Sourceforge for other platforms)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Microsoft Visual Studio .NET 2003 or Visual Studio 6.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;DSVideoLib-0.0.4-win32. Download from &lt;a href="http://sf.net/projects/artoolkit"&gt;http://sf.net/projects/artoolkit&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;GLUT. Download from &lt;a href="http://www.opengl.org/resources/libraries/glut.html"&gt;http://www.opengl.org/resources/libraries/glut.html&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;DirectX 9.0b or later SDK. If you are using VS6, you must use 9.0b as DirectX 9.0c no longer includes support for VS6. Download from &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;(DirectX 9.0c October 2004 or later only) DirectX SDK Extras package. Once downloaded and unzipped, move the "Samples" folder into the top-level of the installed SDK path.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;(Optional, for VRML renderer only) OpenVRML-0.14.3-win32. Downloadfrom &lt;a href="http://sf.net/projects/artoolkit"&gt;http://sf.net/projects/artoolkit&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Build steps:&lt;/span&gt;&lt;br /&gt;&lt;/strong&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Unpack the ARToolKit zip to a convenient location. This location will be referred to below as {ARToolKit}.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Unpack the DSVideoLib zip into {ARToolKit}.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Copy the files DSVideoLib.dll and DSVideoLibd.dll from{ARToolKit}\DSVideoLib\bin.vc70 into {ARToolKit}\bin.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Run the script {ARToolKit}\DSVideoLib\bin.vc70\register_filter.bat.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Install the GLUT DLL into the Windows System32 folder, and the library and headers into the VS platform SDK folders.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Run the script {ARToolKit}\Configure.win32.bat to create include/AR/config.h.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Open the ARToolKit.sln file (VS.NET) or ARToolkit.dsw file (VS6).&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Open the Visual Studio search paths settings(Tools-&gt;Options-&gt;Directories for VS6, or Tools-&gt;Options-&gt;Projects-&gt;VC++Directories for VS.NET) and add the DirectX SDK Includes\ path and theDirectX Samples\C++\DirectShow\BaseClasses\ path to the top of the search path for headers, and the DirectX SDK Lib\ path to the top of thesearch path for libraries.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;(Optional, only if rebuilding DSVideoLib). Build the DirectShow baseclasses strmbase.lib and strmbasd.lib. (More information can be found atThomas Pintarics homepage for DSVideoLib(&lt;a href="http://www.ims.tuwien.ac.at/~thomas/dsvideolib.php"&gt;http://www.ims.tuwien.ac.at/~thomas/dsvideolib.php&lt;/a&gt;)).&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Build the toolkit.The VRML renderering library and example (libARvrml &amp;amp; simpleVRML) are optional builds:&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Unpack the OpenVRML zip into {ARToolKit}.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Copy js32.dll from {ARToolKit}\OpenVRML\bin into {ARToolKit}\bin.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Enable the libARvrml and simpleVRML projects in the VS configuration manager and build.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10982672-111020616087005916?l=comptuicomputervision.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/111020616087005916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10982672&amp;postID=111020616087005916' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111020616087005916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/111020616087005916'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/2005/03/installation.html' title='Installation'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10982672.post-110902046467496227</id><published>2005-02-21T11:25:00.000-08:00</published><updated>2005-02-21T14:51:16.590-08:00</updated><title type='text'>Introduction</title><content type='html'>&lt;span style="font-family:arial;font-size:130%;color:#cc6600;"&gt;Definitions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Vision:&lt;/strong&gt; The process of converting sensory information into knowledge of the objects in the environment The eye is just a sensor, that extracts only a part of the total information available, and the brain is the primary organ of vision.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Computer Vision - 1&lt;/strong&gt;: Mapping from pictures to an abstract description (Siggraph).&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Computer Vision - 2:&lt;/strong&gt; A branch of artificial intelligence and image processing concerned with computer processing of images from the real world. Computer vision typically requires a combination of low level image processing to enhance the image quality (e.g. remove noise, increase contrast) and higher level pattern recognition and image &lt;span style="font-family:arial;"&gt;understanding to recognise features present in the image (Hyper Dictionary).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;Augmented Reality (AR) - 1:&lt;/strong&gt; That class of displays that consists primarily of a real environment, with graphic enhancements or augmentations (Drascic and Milgram).&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;Augmented Reality (AR) - 2:&lt;/strong&gt; The use of transparent HMDs to overlay computer generated i&lt;/span&gt;mages onto the physical environment. Precisely calibrated, rapid head tracking is required to sustain the illusion (HITLab Washington).&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Tangible AR Interfaces:&lt;/strong&gt; Those in which each virtual object is registered to a physical object and the user interacts with virtual objects by manipulating the corresponding tangible objects. In the Tangible AR approach the physical objects and interactions are equally as important as the virtual imagery and provide a very intuitive way to interact with the AR interface (Billinghurst, Kato and Poupyrev).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Success with these interfaces often depends on how well the co-ordinate system of the virtual world is registered, or aligned, with that of the real world. Maintaining registration in a dynamic, changing environment is a very challenging technological issue. In this investigation tangible devices are tracked using computer vision. Optical tracking is also used to register virtual content with real world images. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:130%;color:#cc6600;"&gt;Proposal&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Examples of TUI devices will be implemented using optical tracking so we are interested in image processing algorithms that pertain to this. The intention is to look at two TUI examples; Image processing in general and ARToolkit in particular. The complexity of the method can depend on how many degrees of freedom are required by the task and the range of interactions supported.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;strong&gt;(1) Image Processing:&lt;/strong&gt; An overview of techniques will be presented along with a simple TUI example.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;strong&gt;(2) ARToolkit:&lt;/strong&gt; A tutorial on how to use the toolkit will be presented along with a TUI example.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10982672-110902046467496227?l=comptuicomputervision.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://comptuicomputervision.blogspot.com/feeds/110902046467496227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10982672&amp;postID=110902046467496227' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/110902046467496227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10982672/posts/default/110902046467496227'/><link rel='alternate' type='text/html' href='http://comptuicomputervision.blogspot.com/2005/02/introduction.html' title='Introduction'/><author><name>Paul Mason</name><uri>http://www.blogger.com/profile/17292976102384054207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
