我想让我的getFrames()
函数可以访问以下侦听器。我怎样才能做到这一点?我通过将侦听器添加到我的私有字段来尝试此操作,但我仍然收到以下错误listener(libfreenect2::Frame::Color | libfreenect2::Frame::Depth | libfreenect2::Frame::Ir);
:
调用不匹配 '(libfreenect2::SyncMultiFrameListener) (int)
请查看示例应用程序代码
源文件:
int KinectConnector::connect() {
//! [listeners]
listener(libfreenect2::Frame::Color | libfreenect2::Frame::Depth | libfreenect2::Frame::Ir);
dev->setColorFrameListener(&listener);
dev->setIrAndDepthFrameListener(&listener);
}
void KinectConnector::getFrames() {
while (!protonect_shutdown) {
listener.waitForNewFrame(frames);
}
}
头文件:
class KinectConnector {
public:
KinectConnector();
virtual ~KinectConnector();
int connect();
void getFrames();
private:
libfreenect2::SyncMultiFrameListener listener
libfreenect2::FrameMap frames;
};
来自github的示例应用程序:
/// [listeners]
int types = 0;
if (enable_rgb)
types |= libfreenect2::Frame::Color;
if (enable_depth)
types |= libfreenect2::Frame::Ir | libfreenect2::Frame::Depth;
libfreenect2::SyncMultiFrameListener listener(types);
libfreenect2::FrameMap frames;
dev->setColorFrameListener(&listener);
dev->setIrAndDepthFrameListener(&listener);
/// [listeners]