我想用opencv的函数reprojectImageto3D()显示我自己生成的pointcloud。这个pointcloud的opencv类型是CV_32FC3,在我的代码中称为'xyz'。
我已经使用正确的库完成了正常main()的下一个内容:
...
/// Create a window
viz::Viz3d myWindow("Viz Demo");
/// Start event loop
myWindow.spin();
/// Event loop is over when pressed q, Q, e, E
cout << "First event loop is over" << endl;
/// Access window via its name
viz::Viz3d sameWindow = viz::getWindowByName("Viz Demo");
/// Start event loop
sameWindow.spin();
/// Event loop is over when pressed q, Q, e, E
cout << "Second event loop is over" << endl;
/// Event loop is over when pressed q, Q, e, E
/// Start event loop once for 1 millisecond
sameWindow.spinOnce(1, true);
while(!sameWindow.wasStopped())
{
/// Interact with window
/// Create a cloud widget
viz::WCloud cw(xyz, viz::Color::red());
/// Display it in a window
myWindow.showWidget("CloudWidget1", cw);
/// Event loop for 1 millisecond
sameWindow.spinOnce(1, true);
}
/// Once more event loop is stopped
cout << "Last event loop is over" << endl;
.......
问题是我无法在窗口中看到pointcloud但是没有编译错误。我按'q'退出正确的循环并等待,但窗口中没有任何内容。
答案 0 :(得分:0)
也许是你Mat的格式,它需要一个CV_32FC3,这意味着你需要一个3通道Mat,你应该看看reprojectImageTo3D的垫子是否是那种类型,或者你是否需要解析它,或者你已经解决了这个问题?