7 #include "PlusConfigure.h" 8 #include "vtksys/CommandLineArguments.hxx" 9 #include "vtkPlusIntelRealSenseCamera.h" 10 #include "vtkImageData.h" 11 #include "vtkImageViewer2.h" 12 #include "vtkRenderWindowInteractor.h" 13 #include "vtkRenderer.h" 14 #include "vtkSmartPointer.h" 15 #include "vtkCommand.h" 16 #include "vtkCallbackCommand.h" 18 void PrintLogsCallback(vtkObject* obj,
unsigned long eid,
void* clientdata,
void* calldata);
20 class vtkMyCallback :
public vtkCommand
23 static vtkMyCallback *New()
24 {
return new vtkMyCallback;}
25 virtual void Execute(vtkObject *caller,
unsigned long,
void*)
30 iren->CreateTimer(VTKI_TIMER_UPDATE);
33 vtkRenderWindowInteractor *
iren;
42 int main(
int argc,
char **argv)
44 bool printHelp(
false);
46 vtksys::CommandLineArguments args;
47 args.Initialize(argc, argv);
49 int verboseLevel = vtkPlusLogger::LOG_LEVEL_UNDEFINED;
51 args.AddArgument(
"--help", vtksys::CommandLineArguments::NO_ARGUMENT, &printHelp,
"Print this help.");
52 args.AddArgument(
"--verbose", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &verboseLevel,
"Verbose level (1=error only, 2=warning, 3=info, 4=debug, 5=trace)");
56 std::cerr <<
"Problem parsing arguments" << std::endl;
57 std::cout <<
"\n\nvtkIntelRealSenseCamTest help:" << args.GetHelp() << std::endl;
65 std::cout <<
"\n\nvtkIntelRealSenseCamTest help:" << args.GetHelp() << std::endl;
70 vtkSmartPointer<vtkPlusIntelRealSenseCamera> infraredIntelRealsenseCam = vtkSmartPointer<vtkPlusIntelRealSenseCamera>::New();
72 infraredIntelRealsenseCam->CreateDefaultOutputChannel();
75 vtkSmartPointer<vtkCallbackCommand> callbackCommand = vtkSmartPointer<vtkCallbackCommand>::New();
77 infraredIntelRealsenseCam->AddObserver(
"WarningEvent", callbackCommand);
78 infraredIntelRealsenseCam->AddObserver(
"ErrorEvent", callbackCommand);
80 LOG_INFO(
"Initialize...");
81 infraredIntelRealsenseCam->Connect();
83 if ( infraredIntelRealsenseCam->GetConnected() )
85 LOG_INFO(
"Start recording...");
86 infraredIntelRealsenseCam->StartRecording();
90 infraredIntelRealsenseCam->Disconnect();
91 LOG_ERROR(
"Unable to connect to IC capture device");
95 LOG_INFO(
"Stop recording...");
96 infraredIntelRealsenseCam->StopRecording();
97 infraredIntelRealsenseCam->Disconnect();
98 LOG_INFO(
"Exit successfully");
106 if ( eid == vtkCommand::GetEventIdFromString(
"WarningEvent") )
108 LOG_WARNING((
const char*)calldata);
110 else if ( eid == vtkCommand::GetEventIdFromString(
"ErrorEvent") )
112 LOG_ERROR((
const char*)calldata);
vtkRenderWindowInteractor * iren
int main(int argc, char **argv)
void PrintLogsCallback(vtkObject *obj, unsigned long eid, void *clientdata, void *calldata)
static vtkIGSIOLogger * Instance()