I have a stereo webcam from which I compute disparities and project to 3D. I would like to be able to have a vtk viewing window continuously re-render these points. When I try to do so, however, I get inconsistent behavior. For one thing the points blink in and out. They should always be on the visible, but they are absent about half the frames. Also, there appears to be issues with the viewer such that when I approach the points too closely they disappear, something like a near culling distance, but this applies to the entire cloud, not just those points that would have been closest.
// Project disparity to 3D:
cv::Mat xyz;
cv::reprojectImageTo3D( disparity32, xyz, Q, false );
Points3DFrame points3DFrame( xyz, stereoframe.timestamp );
points3DBuffer->addFrame( points3DFrame );
My viewer thread looks like this:
/// Create a window
cv::viz::Viz3d myWindow("Coordinate Frame");
Points3DFrame points3DFrame;
while( points3DFrame.points.empty() ) {
this_thread::sleep_for(chrono::milliseconds(250));
points3DBuffer->getFrame( &points3DFrame );
}
unsigned long lastFrameTime = timeGetTime();
while( !myWindow.wasStopped() )
{
points3DBuffer->waitNewFrame( &points3DFrame, lastFrameTime );
lastFrameTime = points3DFrame.timestamp;
cloud_widget = cv::viz::WCloud( points3DFrame.points );
cloud_widget.setRenderingProperty( cv::viz::POINT_SIZE, 4 );
myWindow.showWidget( "Depth", cloud_widget );
myWindow.spinOnce( 33, true );
}
Any ideas on what I can do to achieve a stable cloud viewer?