1 #include <bias_config.h>
2 #include <Base/Common/W32Compat.hh>
3 #include <VideoSource/VideoSource_Base.hh>
4 #include <VideoSource/VideoSource_DCAM.hh>
6 #include <Base/Image/ImageIO.hh>
7 #include <Base/Image/ImageConvert.hh>
8 #include <Image/Camera.hh>
9 #include <Gui/ImageCanvas.hh>
10 #include <Gui/ConsoleRedirectIO.hh>
23 class MyApp :
public wxApp
25 virtual bool OnInit();
28 class MyFrame:
public wxFrame
32 MyFrame(
const wxString& title,
const wxPoint& pos,
const wxSize& size);
34 void OnQuit(wxCommandEvent& event);
35 void OnTimer(wxTimerEvent& event);
39 wxButton *QuitButton_, *WhiteBalanceButton_;
43 Camera<
unsigned char> pic,rgb;
57 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
58 EVT_MENU(
ID_Quit, MyFrame::OnQuit)
60 EVT_TIMER(
ID_TIMER, MyFrame::OnTimer)
72 new MyFrame( wxT(
"MDCam2ShmWx"), wxPoint(50,50), wxSize(800,600) );
78 MyFrame::MyFrame(
const wxString& title,
const wxPoint& pos,
const wxSize& size)
79 : wxFrame((wxFrame *)NULL, -1, title, pos, size)
81 wxMenu *menuFile =
new wxMenu;
82 menuFile->Append( ID_Quit, wxT(
"E&xit") );
84 wxMenuBar *menuBar =
new wxMenuBar;
85 menuBar->Append( menuFile, wxT(
"&File") );
87 SetMenuBar( menuBar );
88 wxStatusBar* s = CreateStatusBar();
89 SetStatusText( wxT(
"") );
91 wxSizer *Sizer =
new wxBoxSizer( wxHORIZONTAL );
95 ic_->SetSize(1024,768);
96 Sizer->Add(ic_,1, wxEXPAND |wxALL , 5);
98 rgb.FillImageWithConstValue(255);
101 Timer_.SetOwner(
this, ID_TIMER);
103 cam.SetDebugLevel(D_DCAM );
106 cam.SetSize(1024,768);
112 int res = cam.OpenDevice();
114 cout<<
"Failed to open device"<<endl;
123 ic_->Show(rgb,
"foo");
128 Timer_.Start(100,
true);
131 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
141 void MyFrame::OnTimer(wxTimerEvent& event)
143 cout <<
"OnTimer()"<<endl;
148 unsigned char **ida = rgb.GetImageDataArray();
149 unsigned x = framecount % rgb.GetWidth();
150 unsigned y = framecount / rgb.GetHeight();
151 for (
unsigned int c=0;c<rgb.GetChannelCount(); c++)
152 ida[y][x*rgb.GetChannelCount()+c] = 0;
154 ic_->Show(rgb,
"foo");
163 Timer_.Start(20,
true);
170 int main(
int argc,
char *argv[])
172 cout <<
"Non-gui mode"<<endl;
181 for (
unsigned int i=0;i<10;i++) {
182 cout <<
"Awaiting image"<<endl;
184 cout <<
"Got one image"<<endl;
virtual int InitImage(BIAS::ImageBase &Image)
int GrabSingle(BIAS::Camera< unsigned char > &image)
Select the port (bus-id) to use, only valid before OpenDevice()
extends the Image by MetaData support (e.g.
display image in wx application, provides zoom and investigation functionality
This class VideoSource_DCAM implements access to IEEE1394 (Firewire, iLink) cameras following the DCa...
int OpenDevice()
Opens a dc1394 device.
UYVY422, 2 channels, full luminance Y, subsampled half U,V inverse order.
int CloseDevice()
closes a camera device and cleans up
int PostGrab()
stops iso transmission of a camera.
int PreGrab()
initializes the iso transmission of a camera.
static int ToRGB(const Image< StorageType > &source, Image< StorageType > &dest)
Create a RGB converted copy of source image in this.