Panda3D
|
00001 // Filename: config_vision.cxx 00002 // Created by: pro-rsoft (07Nov09) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "config_vision.h" 00016 #include "openCVTexture.h" 00017 #include "webcamVideo.h" 00018 #include "webcamVideoCursorOpenCV.h" 00019 #include "webcamVideoOpenCV.h" 00020 #include "webcamVideoCursorV4L.h" 00021 #include "webcamVideoV4L.h" 00022 00023 #include "pandaSystem.h" 00024 #include "texturePool.h" 00025 #include "dconfig.h" 00026 00027 Configure(config_vision); 00028 NotifyCategoryDef(vision, ""); 00029 00030 ConfigureFn(config_vision) { 00031 init_libvision(); 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function: init_libvision 00036 // Description: Initializes the library. This must be called at 00037 // least once before any of the functions or classes in 00038 // this library can be used. Normally it will be 00039 // called by the static initializers and need not be 00040 // called explicitly, but special cases exist. 00041 //////////////////////////////////////////////////////////////////// 00042 void 00043 init_libvision() { 00044 static bool initialized = false; 00045 if (initialized) { 00046 return; 00047 } 00048 initialized = true; 00049 00050 WebcamVideo::init_type(); 00051 #ifdef HAVE_VIDEO4LINUX 00052 WebcamVideoCursorV4L::init_type(); 00053 WebcamVideoV4L::init_type(); 00054 #endif 00055 00056 #ifdef HAVE_OPENCV 00057 WebcamVideoCursorOpenCV::init_type(); 00058 WebcamVideoOpenCV::init_type(); 00059 00060 OpenCVTexture::init_type(); 00061 OpenCVTexture::register_with_read_factory(); 00062 00063 PandaSystem *ps = PandaSystem::get_global_ptr(); 00064 ps->add_system("OpenCV"); 00065 00066 TexturePool *ts = TexturePool::get_global_ptr(); 00067 #ifndef HAVE_FFMPEG 00068 ts->register_texture_type(OpenCVTexture::make_texture, "avi"); 00069 #endif 00070 #endif 00071 } 00072