Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleVideoSource_Controller.cpp
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003, 2004 (see file CONTACTS for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 /**
27  @example ExampleVideoSource_Controller.cpp
28  @relates VideoSource, VideoSource_Controller
29  @brief Example for using the videosource controller to steer shutter, gain, ...
30  @ingroup g_examples
31  @author MIP
32 */
33 
34 
35 #include <bias_config.h>
36 
37 #include <Base/Common/BIASpragma.hh>
38 #include <Base/Image/Image.hh>
39 #include <Base/Image/ImageIO.hh>
40 #include <Base/Common/W32Compat.hh>
41 
42 #include <Image/Camera.hh>
43 
44 #include <wx/wx.h>
45 
46 #ifdef BIAS_HAVE_UEYE
47 # include <VideoSource/VideoSource_uEye.hh>
48 #endif
49 
50 #ifdef BIAS_HAVE_DCAM
51 # include <VideoSource/VideoSource_DCAM.hh>
52 #endif
53 
54 #ifdef BIAS_HAVE_V4L
55 # include <VideoSource/VideoSource_V4L.hh>
56 #endif
57 
58 
59 #include <VideoSource/VideoSource_Base.hh>
60 
61 #include <Gui/VideoSource_Controller.hh>
62 
63 using namespace std;
64 using namespace BIAS;
65 
66 /** \cond HIDDEN_SYMBOLS*/
67 class MyApp : public wxApp
68 {
69 public:
70  virtual bool OnInit();
71 };
72 
73 bool MyApp::OnInit()
74 {
75  BIAS::Camera<unsigned char> grabimage,vidimage;
76 
77 #ifdef BIAS_HAVE_DCAM
78  VideoSource_DCAM cam;
79 
80  cam.OpenDevice();
81  cam.InitImage(grabimage);
82  cam.PreGrab();
83 
85 
86  frame->Show(TRUE);
87  int i=0;
88  while(i++<100){
89  cam.GrabSingle(grabimage);
90  grabimage.Display(true,10,DEFAULT_32to8_scale);
91  }
92 #endif
93 
94  return TRUE;
95 }
96 
97 IMPLEMENT_APP(MyApp)
98 /** \endcond */
virtual int InitImage(BIAS::ImageBase &Image)
int GrabSingle(BIAS::Camera< unsigned char > &image)
Select the port (bus-id) to use, only valid before OpenDevice()
int Display(const std::string &DestWin, const bool &autoresize, const bool &moveToTopLeft, const bool &waitForKey, const unsigned int &delayMsec=DEFAULT_Display_delay, const float &scale=DEFAULT_32to8_scale, const bool &allowAlphaWindow=false) const
OpenCV onscreen popup display, very useful for fast debugging. (JW)
Definition: ImageBase.cpp:1414
This class VideoSource_DCAM implements access to IEEE1394 (Firewire, iLink) cameras following the DCa...
int OpenDevice()
Opens a dc1394 device.
int PreGrab()
initializes the iso transmission of a camera.