D. Implementation
The implementation of our web-based video streaming
application is illustrated in Fig. 6. The core of the application
is composed of two ActionScript classes. The main class is
for the main application and the ALVAR class is for
exchanging data with ALVAR Flash Library. The main class
is responsible for loading the configuration file, initializing a
webcam and the application in general and processing each
frame. The ALVAR class is used only for passing data to
and receiving it from ALVAR Flash Library.
The configuration file used by the main class is in XML
format. This was chosen because it is a very common format
and also because Flash has native support for reading and
parsing XML. The structure of the configuration file is
intuitive and easily extendable. The basic information
containing the two timer delays mentioned above is located
under a dedicated XML element, while the marker
information is located under another element. The element
for the basic information contains an individual element for
each information item. Similarly, the element for each
marker contains elements for each marker’s information
item. All marker elements are listed under the marker
information element. Additional elements, which can be read
by the application, can be easily added to the structure,
enabling the application to be extendable with minimal
effort.
Pose and position information is received from ALVAR
Flash Library as a transformation matrix, which is a 4 by 4
matrix. This format is also used by the 3D plane for
representing its pose and position. Thus, the matrix received
from ALVAR Flash Library can be directly set as the 3D
plane’s new transformation matrix without any additional
processing.
The transformation matrix is also used when the 3D
plane is presented so that it faces the camera at all times
(billboarding). In that case, the transformation matrix must
be modified before it is applied to the 3D plane.
Streaming a video in Flash is a straightforward process.
Flash has good support for initiating and controlling a
streaming session, including a set of events for informing of
any changes in the stream’s status. In addition, the received
stream can be set as the 3D plane texture directly without
any pre-processing.
The ALVAR class acts as the interface to ALVAR Flash
Library, as mentioned above. It is responsible for providing
webcam frame data to ALVAR Flash Library, which it does
by utilizing shared memory space, as discussed in Section III
B. The ALVAR class allocates the required memory space inits constructor function, while placing data in the memory
space and receiving a response from ALVAR Flash Library
for each frame that is handled by another function.
From the end-user perspective, the application is highly
intuitive and easy to use. For example, the installation of the
application compared to the Dibidogs application is
extremely easy. While the Dibidogs application requires to
be downloaded from the Internet and installed separately on
each computer it is used on, in our application the user is just
required to go to a web page where the application resides. If
the webcam is not found, the user is merely required connect
the webcam and to click a button to re-initiate the
application. The user then simply has to hold a marker in
front of the webcam in order for the application to detect it
and show content on top of it. These tasks are extremely
simple and trouble-free for the user, thus enhancing the user
experience.
As the application was targeted to be used for marketing,
the integration was also carried out in co-operation with
Aller Media and the application was installed on their web
server. Prior to integration the application was thoroughly
tested and final functionality tests were conducted after the
installation to verify full operation. The application was then
released to the end-users by Aller Media. Fig. 7 shows two
pages from Seiska magazine (circulation of 211,000)
containing video markers promoting the film Vares – Pahan
suudelma.