00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "webcamVideoOpenCV.h"
00016
00017 #ifdef HAVE_OPENCV
00018
00019 #include "webcamVideoCursorOpenCV.h"
00020 #include "configVariableInt.h"
00021
00022 TypeHandle WebcamVideoOpenCV::_type_handle;
00023
00024
00025
00026
00027
00028
00029
00030 void
00031 find_all_webcams_opencv() {
00032
00033
00034 static ConfigVariableInt wemcam_opencv_camera_index
00035 ("webcam-opencv-camera-index", "0",
00036 PRC_DESC("Specify the space-separated list of integer camera index "
00037 "numbers that are assumed to be available via OpenCV to the "
00038 "WebcamVideo interface. The default camera index is 0. "
00039 "Specify empty string if there are no available cameras."));
00040 for (int i = 0; i < wemcam_opencv_camera_index.get_num_words(); ++i) {
00041 PT(WebcamVideo) wc = new WebcamVideoOpenCV(wemcam_opencv_camera_index[i]);
00042 WebcamVideoOpenCV::_all_webcams.push_back(wc);
00043 }
00044 }
00045
00046
00047
00048
00049
00050
00051 WebcamVideoOpenCV::
00052 WebcamVideoOpenCV(int camera_index) :
00053 _camera_index(camera_index)
00054 {
00055 ostringstream strm;
00056 strm << "OpenCV webcam " << _camera_index;
00057 set_name(strm.str());
00058 }
00059
00060
00061
00062
00063
00064
00065 PT(MovieVideoCursor) WebcamVideoOpenCV::
00066 open() {
00067 return new WebcamVideoCursorOpenCV(this);
00068 }
00069
00070 #endif