PCL CloudViewer - eiichiromomma/CVMLAB GitHub Wiki
PCL) CloudViewer
(MacだとVTKの問題でCloudViewerが使えない
発生するエラー
Region Growingのチュートリアルで発生する。
2017-06-13 13:07:37.990 project[81345:35709505] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1349.81/Misc.subproj/NSUndoManager.m:363
2017-06-13 13:07:37.991 project[81345:35709505] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff927df2cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fffa75ea48d objc_exception_throw + 48
2 CoreFoundation 0x00007fff927e4042 +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fff9422cc80 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 Foundation 0x00007fff941b7323 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
5 AppKit 0x00007fff902444ed -[NSApplication run] + 1200
6 libvtkRenderingOpenGL2-7.1.1.dylib 0x0000000110d66285 _ZL30VTKStartNSApplicationEventLoopv + 53
7 libvtkRenderingOpenGL2-7.1.1.dylib 0x0000000110d66241 _ZN30vtkCocoaRenderWindowInteractor14StartEventLoopEv + 17
8 libvtkRenderingCore-7.1.1.dylib 0x0000000113f07435 _ZN25vtkRenderWindowInteractor5StartEv + 165
9 libpcl_visualization.1.8.dylib 0x000000010be32328 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 200
10 libpcl_visualization.1.8.dylib 0x000000010be5addf _ZN3pcl13visualization11CloudViewer16CloudViewer_implclEv + 1199
11 libboost_thread-mt.dylib 0x0000000104a15b84 _ZN5boost12_GLOBAL__N_1L12thread_proxyEPv + 164
12 libsystem_pthread.dylib 0x00007fffa80e893b _pthread_body + 180
13 libsystem_pthread.dylib 0x00007fffa80e8887 _pthread_body + 0
14 libsystem_pthread.dylib 0x00007fffa80e808d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
のような感じでCloudViewerが呼ばれたところで必ず死ぬ。
解決方法
CloudViewerは使わずにPCLVisualizerを使う
@@ -63,10 +138,11 @@
std::cout << std::endl;
pcl::PointCloud <pcl::PointXYZRGB>::Ptr colored_cloud = reg.getColoredCloud ();
- pcl::visualization::CloudViewer viewer ("Cluster viewer");
- viewer.showCloud(colored_cloud);
+ pcl::visualization::PCLVisualizer viewer ("Cluster viewer");
+ viewer.addPointCloud<pcl::PointXYZRGB>(colored_cloud, "result");
while (!viewer.wasStopped ())
{
+ viewer.spinOnce(0);
}
のような感じ。
#include <pcl/visualization/pcl_visualizer.h>
も勿論必要