ARToolKitModule.h

Go to the documentation of this file.
00001  /* ========================================================================
00002   * Copyright (c) 2006,
00003   * Institute for Computer Graphics and Vision
00004   * Graz University of Technology
00005   * All rights reserved.
00006   *
00007   * Redistribution and use in source and binary forms, with or without
00008   * modification, are permitted provided that the following conditions are
00009   * met:
00010   *
00011   * Redistributions of source code must retain the above copyright notice,
00012   * this list of conditions and the following disclaimer.
00013   *
00014   * Redistributions in binary form must reproduce the above copyright
00015   * notice, this list of conditions and the following disclaimer in the
00016   * documentation and/or other materials provided with the distribution.
00017   *
00018   * Neither the name of the Graz University of Technology nor the names of
00019   * its contributors may be used to endorse or promote products derived from
00020   * this software without specific prior written permission.
00021   *
00022   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00023   * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00024   * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00025   * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00026   * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027   * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00028   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00029   * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00030   * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00031   * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00032   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033   * ========================================================================
00034   * PROJECT: OpenTracker
00035   * ======================================================================== */
00042  /* ======================================================================= */
00043 
00204 #ifndef _ARTOOLKITMODULE_H
00205 #define _ARTOOLKITMODULE_H
00206 
00207 #include "../OpenTracker.h"
00208 
00209 #ifdef USE_ARTOOLKIT
00210 
00211 #ifdef WIN32
00212 //#ifndef __MEMORY_BUFFER_HANDLE__
00213 //#define __MEMORY_BUFFER_HANDLE__
00214 
00215 namespace ot {
00216 
00217         struct MemoryBufferHandle
00218         {
00219                 unsigned long  n; // sample number
00220                 __int64 t;                // timestamp
00221         };
00222 
00223 } // namespace ot
00224 
00225 //#endif
00226 #else
00227     typedef int MemoryBufferHandle;
00228 #endif
00229 
00230 #define STEREO_L 0
00231 #define STEREO_R 1
00232 
00246 namespace ot {
00247 
00248 class OPENTRACKER_API ARToolKitModule : public ThreadModule, public NodeFactory
00249 {
00250 // members
00251 protected:
00253     NodeVector sources;
00254     int did;
00256     int treshhold;
00258     int stop;
00260     std::string cameradata;
00262     double rate;
00264     std::string videomode;
00266     std::string videomode2;
00268     bool stereo;
00269 
00271     unsigned char * frame;
00273     int sizeX, sizeY;
00275         std::string patternDirectory;
00276 
00277 // methods
00278 protected:
00282     virtual void run(); 
00283 
00286     void grab();
00287 
00288 public:
00290     ARToolKitModule();
00291 
00293     virtual ~ARToolKitModule();
00294 
00302     virtual Node * createNode( const std::string& name, StringTable& attributes);
00303 
00307     virtual void start();
00308 
00310     virtual void close();
00311 
00316     virtual void pushEvent();
00317 
00324     virtual void init(StringTable& attributes, ConfigNode * localTree);
00325 
00327     bool isStereo();
00328 
00330     int getSizeX(int stereo_buffer = STEREO_L);
00331 
00333     int getSizeY(int stereo_buffer = STEREO_L);
00334 
00337     void getFlipping(bool* isFlippedH, bool* isFlippedV, int stereo_buffer = STEREO_L);
00338 
00343     unsigned char * lockFrame(MemoryBufferHandle* pHandle, int stereo_buffer = STEREO_L);
00344         // formerly getFrame()
00345 
00348     void unlockFrame(MemoryBufferHandle Handle, int stereo_buffer = STEREO_L);
00349 
00354     int getImageFormat(int stereo_buffer = STEREO_L);
00355 };
00356 
00357         OT_MODULE(ARToolKitModule);
00358 
00359 } // namespace ot
00360 
00361 #endif
00362 
00363 #endif
00364 
00365 /* 
00366  * ------------------------------------------------------------
00367  *   End of ARToolKitModule.h
00368  * ------------------------------------------------------------
00369  *   Automatic Emacs configuration follows.
00370  *   Local Variables:
00371  *   mode:c++
00372  *   c-basic-offset: 4
00373  *   eval: (c-set-offset 'substatement-open 0)
00374  *   eval: (c-set-offset 'case-label '+)
00375  *   eval: (c-set-offset 'statement 'c-lineup-runin-statements)
00376  *   eval: (setq indent-tabs-mode nil)
00377  *   End:
00378  * ------------------------------------------------------------ 
00379  */

Generated on Wed Feb 28 15:18:48 2007 for NaviTrack by  doxygen 1.4.6