Under certain conditions (see below), the Viz3d
window is completely white until it is is moved with the mouse. Consider the following example code:
#include <cmath>
#include <opencv2/viz.hpp>
using namespace std;
using namespace cv;
using namespace viz;
int main()
{
Viz3d visualization("Test");
/*const Mat image(10, 10, CV_32FC3, Scalar(0));
WCloud cloud(image);
visualization.showWidget("Point cloud", cloud);*/ //Uncomment me
visualization.spinOnce(1, true);
while (!visualization.wasStopped())
visualization.spinOnce(1, true);
}
It works fine, i.e., shows a regular Viz3d window. However, when uncommenting the three lines as indicated, the Viz3d
window is completely white:
When it is moved with the mouse (clicking and holding over the title bar), everything works as expected again, i.e., the window shows its contents.
While the issue is reproducible with the code above, slight variations of the code seem to work fine. I was not able to figure out yet what sets this code apart from those which work fine (cf. documentation and the code in the issues that I submitted previously), but it does not depend on the widget type or the window name passed the the Viz3d
constructor.
Using vs2015 opencv 3.3-dev (windows 10-64 bits) vtk 8.1 using this source code :
viz::Viz3d visualization("Test");
const Mat image(10, 10, CV_32FC3, Scalar(0));
viz::WCloud cloud(image);
visualization.showWidget("Point cloud", cloud); //Uncomment me
visualization.spinOnce(1, true);
while (!visualization.wasStopped())
visualization.spinOnce(1, true);
I have got this
It looks like a platform-specific issue then.
Update: I added the VTK version that I am using above. It is the default package provided by Ubuntu.
The issue seems to be caused by VirtualBox's 3-D acceleration. Disabling it makes the problem go away. Thus, I don't think that this issue is an OpenCV issue.
Most helpful comment
The issue seems to be caused by VirtualBox's 3-D acceleration. Disabling it makes the problem go away. Thus, I don't think that this issue is an OpenCV issue.