Dear vtk users,<br>
<br>
I'm newbie in VTK library. I decided to use it as a renderer of a content<br>
captured by the Kinect sensor. I grab first the depth maps using opencv<br>
after that I render it by VTK. All working fine until now. However I wanna<br>
add some keyboard buttons to interact easily with the displayed content (3D<br>
cloud): it's really basic:<br>
<br>
1-Push '*d*' to display the 3D point cloud by VTK.<br>
2-Push *'k*' to return to default camera settings.<br>
3-Push '*q*' to quite.<br>
<br>
here is a snapping code that I wrote:<br>
<br>
// VTK headers<br>
*#include <vtkSmartPointer.h><br>
.... etc*<br>
*int main()<br>
{*<br>
<br>
// 3D rendering rotines<br>
<br>
//VTK Pipeline<br>
*vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::<div id=":10g">New();<br>
renwin = vtkSmartPointer<vtkRenderWindow>::New();<br>
renwin1 = vtkSmartPointer<vtkRenderWindow>::New();<br>
<br>
vtkSmartPointer<vtkRenderWindowInteractor> iren =<br>
vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
<br>
renwin->AddRenderer(ren);<br>
renwin->SetInteractor(iren);<br>
renwin->SetSize(1280,800);<br>
iren->Initialize();*<br>
<br>
// Main loop<br>
while (1)<br>
// To capture the content from the kinect<br>
.....<br>
key= cvWaitKey(1); // for opencv capture<br>
<br>
*if (key == 'q')* break; // To quite<br>
switch(key) {<br>
/* '1' pressed, display the original image */<br>
* case 'd':*<br>
cout<<"The decomposition is running..."<<endl;<br>
<br>
Display_cloud( renwin,pDepthMap); // a function to display a cloud<br>
points<br>
renwin->Render();<br>
<br>
//Set up camera<br>
ren->ResetCamera();<br>
ren->GetActiveCamera()->Roll(180.0);<br>
ren->GetActiveCamera()->Azimuth(180.0);<br>
ren->GetActiveCamera()->Zoom(2.0);<br>
<br>
iren->Start();<br>
<br>
*case 'k':* // to return to default camera settings.<br>
ren->ResetCamera();<br>
ren->GetActiveCamera()->Roll(180.0);<br>
ren->GetActiveCamera()->Azimuth(180.0);<br>
ren->GetActiveCamera()->Zoom(2.0);<br>
<br>
iren->Start();<br>
break;<br>
}<br>
}<br>
<br>
So I have two problems:<br>
1-When I push *'q'* the program doesn't close correctly, visual studio send<br>
me to the vtkInformation.cxx to the line " *i->first->Report(this,<br>
collector);*" in "void<br>
*vtkInformation::ReportReferences(vtkGarbageCollector* collector)"*<br>
function?!<br>
How can I avoid that?<br>
<br>
2-When push 'k' to return to default camera paramters it doesn't work..<br>
could you help me please?<br>
Thank you so much and sorry if my post is very long for you .<br>
<br>
Cheers for everyone<br>
Jo<br>
</div>