4 # pragma warning(disable: 4005)
7 #include "VideoSource_Controller_Kinect.hh"
10 # include <Base/Common/getopt_W32.h>
14 #include <Base/Image/ImageIO.hh>
15 #include <Image/Camera.hh>
16 #include <Gui/StringConv.hh>
17 #include <wx/string.h>
22 VideoSource_Controller_Kinect::
25 ,wxDefaultPosition,wxSize(365,310),wxSTAY_ON_TOP |wxCAPTION)
33 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
36 gSizer1 =
new wxGridSizer( 2, 2, 0, 0 );
39 bSizer1 =
new wxBoxSizer( wxVERTICAL );
41 wxString m_radioBox1Choices[] = { wxT(
"RGB Color"), wxT(
"Infrared"), wxT(
"Switch every Frame") };
42 int m_radioBox1NChoices =
sizeof( m_radioBox1Choices ) /
sizeof( wxString );
43 m_radioBox1 =
new wxRadioBox(
this, wxID_ANY, wxT(
"Video Mode"), wxDefaultPosition, wxDefaultSize, m_radioBox1NChoices, m_radioBox1Choices, 1, wxRA_SPECIFY_COLS );
47 gSizer1->Add( bSizer1, 1, wxEXPAND, 5 );
50 bSizer4 =
new wxBoxSizer( wxVERTICAL );
52 m_grid1 =
new wxGrid(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
56 m_grid1->EnableEditing(
false );
57 m_grid1->EnableGridLines(
true );
58 m_grid1->EnableDragGridSize(
false );
62 m_grid1->EnableDragColMove(
false );
63 m_grid1->EnableDragColSize(
false );
65 m_grid1->SetColLabelValue( 0, wxT(
"Value") );
66 m_grid1->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
69 m_grid1->EnableDragRowSize(
false );
71 m_grid1->SetRowLabelValue( 0, wxT(
"tilt") );
72 m_grid1->SetRowLabelValue( 1, wxT(
"x") );
73 m_grid1->SetRowLabelValue( 2, wxT(
"y") );
74 m_grid1->SetRowLabelValue( 3, wxT(
"z") );
75 m_grid1->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
78 m_grid1->SetLabelBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNHIGHLIGHT ) );
81 m_grid1->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
82 bSizer4->Add(
m_grid1, 0, wxALL, 5 );
84 gSizer1->Add( bSizer4, 1, wxEXPAND, 5 );
87 bSizer41 =
new wxBoxSizer( wxVERTICAL );
89 m_button1 =
new wxButton(
this, wxID_ANY, wxT(
"Load Calibration xml"), wxDefaultPosition, wxDefaultSize, 0 );
92 m_button5 =
new wxButton(
this, wxID_ANY, wxT(
"Toggle Depth Stream"), wxDefaultPosition, wxDefaultSize, 0 );
95 m_button6 =
new wxButton(
this, wxID_ANY, wxT(
"Hide"), wxDefaultPosition, wxDefaultSize, 0 );
98 gSizer1->Add( bSizer41, 1, wxEXPAND, 5 );
101 bSizer3 =
new wxBoxSizer( wxVERTICAL );
103 m_button2 =
new wxButton(
this, wxID_ANY, wxT(
"Up +5"), wxDefaultPosition, wxDefaultSize, 0 );
106 m_button3 =
new wxButton(
this, wxID_ANY, wxT(
"Level"), wxDefaultPosition, wxDefaultSize, 0 );
109 m_button4 =
new wxButton(
this, wxID_ANY, wxT(
"Down -5"), wxDefaultPosition, wxDefaultSize, 0 );
112 gSizer1->Add( bSizer3, 1, wxEXPAND, 5 );
114 this->SetSizer( gSizer1 );
117 timer_ =
new wxTimer(
this, ID_Timer);
169 wxFileDialog fileDialog(
171 wxT(
"Load internal calibration file for IR camera (BIAS Projection xml)"),
174 wxT(
"Projection files (proj;xml)|*.proj;*.xml|All files (*.*)|*.*"),
177 if (fileDialog.ShowModal() == wxID_OK) {
178 wxString wxStr = fileDialog.GetPath();
180 p.
Load(WxToAscii(wxStr));
183 wxMessageDialog messageDialog(
this, wxT(
"Sorry, no Projection Parameters found!"), wxT(
"ShowCamWx - Kinect Calibration file"), wxICON_ERROR | wxOK);
184 messageDialog.ShowModal();
186 double fx, fy, px, py;
196 int id =
event.GetInt();
211 OnUp( wxCommandEvent& event ) {
241 if (curTilt_ == -64) {
250 m_grid1->SetCellValue(0,0,tilts);
Defines a common interface to different devices.
virtual int CreateDepthLookupTable(double px, double py, double fx, double fy)=0
virtual int SetVideoModeIR()=0
virtual int Load(const std::string &filename)
convenience wrapper which tries to read different formats
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
virtual void OnToggleDepth(wxCommandEvent &event)
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
virtual int GetPrincipal(double &PrincipalX, double &PrincipalY) const
Get principal point (in pixels relative to top left corner).
virtual int SetSwitchVideoModeAfterGrab()=0
~VideoSource_Controller_Kinect()
virtual int GetAccelerometer(double &tilt, double &x, double &y, double &z)=0
virtual void OnClose(wxCloseEvent &event)
virtual void OnLevel(wxCommandEvent &event)
BIAS::VideoSource_Kinect_Base * Cam_
virtual int ToggleDepthStream()=0
virtual int SetVideoModeColor()=0
virtual int SetTilt(double degrees)=0
virtual void OnDown(wxCommandEvent &event)
const ProjectionParametersBase * GetParameters(unsigned int cam=0) const
const parameter access function
This class hides the underlying projection model, like projection matrix, spherical camera...
virtual double GetAspectratio() const
Return aspectratio (i.e.
void GetFocalLength(double &f) const
Get the current camera focal length.
virtual void OnSelectVideoMode(wxCommandEvent &event)
virtual void OnLoadCalib(wxCommandEvent &event)
virtual void OnHide(wxCommandEvent &event)
virtual void OnTimer(wxTimerEvent &event)
Use Kinect just like the ToF Cameras.
void SetVideoSource(BIAS::VideoSource *cam)
virtual void OnUp(wxCommandEvent &event)