Cinder Forums




Cinder-OpenNI/samples/kinectBasic/xcode/../src/kinectBasicApp.cpp:27: error: ISO C++ forbids declaration of 'OpenNIDeviceManager' with no type
V::OpenNIDeviceManager* _manager;
V::OpenNIDevice* _device;
Undefined symbols:
"V::OpenNIDevice::setPrimaryBuffer(int)", referenced from:
kinectBasicApp::setup() in kinectBasicApp.o
"V::OpenNIDeviceManager::start()", referenced from:
kinectBasicApp::setup() in kinectBasicApp.o
"V::OpenNIDeviceManager::createDevice(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)", referenced from:
kinectBasicApp::setup() in kinectBasicApp.o
"V::OpenNIDeviceManager::_singletonPointer", referenced from:
__ZN1V19OpenNIDeviceManager17_singletonPointerE$non_lazy_ptr in kinectBasicApp.o
(maybe you meant: __ZN1V19OpenNIDeviceManager17_singletonPointerE$non_lazy_ptr)
"V::OpenNIDeviceManager::update()", referenced from:
kinectBasicApp::update() in kinectBasicApp.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
OutputDebugStringA( ss.str().c_str() )
console() << ss.str().c_str() << std::endl;
mDepthTexture = _device->getDepthMap();
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
#include "cinder/gl/Texture.h"
#include "cinder/Surface.h"
#include "cinder/ImageIo.h"
#include "cinder/Utilities.h"
#include "cinder/Rand.h"
#include "Kinect.h"
#include "VOpenNIHeaders.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class kinectBasicApp : public AppBasic {
public:
void prepareSettings( Settings* settings );
void setup();
void mouseUp( MouseEvent event );
void update();
void draw();
ImageSourceRef getColorImage();
ImageSourceRef getUserColorImage(int id);
ImageSourceRef getDepthImage();
ImageSourceRef getDepthImage24();
/*Kinect mKinect;
*/
V::OpenNIDeviceManager* _manager;
V::OpenNIDevice* _device0;
gl::Texture mColorTexture, mDepthTexture;
};
void kinectBasicApp::prepareSettings( Settings* settings )
{
settings->setWindowSize( 1280, 480 );
}
void kinectBasicApp::setup()
{
/*
console() << "There are " << Kinect::getNumDevices() << " Kinects connected." << std::endl;
mKinect = Kinect( Kinect::Device() ); // the default Device implies the first Kinect connected
*/
_manager = V::OpenNIDeviceManager::InstancePtr();
_device0 = _manager->createDevice( "data/configIR.xml", true );
_device0->setPrimaryBuffer( V::NODE_TYPE_DEPTH );
_manager->start();
}
void kinectBasicApp::mouseUp( MouseEvent event )
{
/*
writeImage( getHomeDirectory() + "kinect_video.png", mKinect.getVideoImage() );
writeImage( getHomeDirectory() + "kinect_depth.png", mKinect.getDepthImage() );
*/
// set tilt to random angle
// mKinect.setTilt( Rand::randFloat() * 62 - 31 );
// make the LED yellow
// mKinect.setLedColor( Kinect::LED_YELLOW );
// toggle infrared video
/*
mKinect.setVideoInfrared( ! mKinect.isVideoInfrared() );
*/
}
void kinectBasicApp::update()
{
/*
if( mKinect.checkNewDepthFrame() )
mDepthTexture = mKinect.getDepthImage();
if( mKinect.checkNewVideoFrame() )
mColorTexture = mKinect.getVideoImage();
*/
//mDepthTexture = gl::Texture(_device->getDepthMap());
_manager->update();
// console() << "Accel: " << mKinect.getAccel() << std::endl;
}
void kinectBasicApp::draw()
{
gl::clear( Color( 0, 0, 0 ) );
gl::setMatricesWindow( getWindowWidth(), getWindowHeight() );
if( mDepthTexture )
gl::draw( mDepthTexture );
if( mColorTexture )
gl::draw( mColorTexture, Vec2i( 640, 0 ) );
}
ImageSourceRef kinectBasicApp::getColorImage()
{
// register a reference to the active buffer
uint8_t *activeColor = _device0->getColorMap();
return ImageSourceRef( new ImageSourceKinectColor( activeColor, KINECT_COLOR_WIDTH, KINECT_COLOR_HEIGHT ) );
}
ImageSourceRef kinectBasicApp::getUserColorImage( int id )
{
// register a reference to the active buffer
uint8_t *activeColor = _manager->getUser(id)->getPixels();
return ImageSourceRef( new ImageSourceKinectColor( activeColor, KINECT_COLOR_WIDTH, KINECT_COLOR_HEIGHT ) );
}
ImageSourceRef kinectBasicApp::getDepthImage()
{
// register a reference to the active buffer
uint16_t *activeDepth = _device0->getDepthMap();
return ImageSourceRef( new ImageSourceKinectDepth( activeDepth, KINECT_DEPTH_WIDTH, KINECT_DEPTH_HEIGHT ) );
}
ImageSourceRef kinectBasicApp::getDepthImage24()
{
// register a reference to the active buffer
uint8_t *activeDepth = _device0->getDepthMap24();
return ImageSourceRef( new ImageSourceKinectColor( activeDepth, KINECT_DEPTH_WIDTH, KINECT_DEPTH_HEIGHT ) );
}
CINDER_APP_BASIC( kinectBasicApp, RendererGl )
kinectBasicApp.cpp:103: error: expected primary-expression before '(' token
#include "cinder/app/AppBasic.h"
#include "cinder/imageio.h"
#include "cinder/gl/gl.h"
#include "cinder/gl/Texture.h"
#include "VOpenNIHeaders.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class ImageSourceKinectColor : public ImageSource
{
public:
ImageSourceKinectColor( uint8_t *buffer, int width, int height )
: ImageSource(), mData( buffer ), _width(width), _height(height)
{
setSize( _width, _height );
setColorModel( ImageIo::CM_RGB );
setChannelOrder( ImageIo::RGB );
setDataType( ImageIo::UINT8 );
}
~ImageSourceKinectColor()
{
// mData is actually a ref. It's released from the device.
/*if( mData ) {
delete[] mData;
mData = NULL;
}*/
}
virtual void load( ImageTargetRef target )
{
ImageSource::RowFunc func = setupRowFunc( target );
for( uint32_t row = 0; row < _height; ++row )
((*this).*func)( target, row, mData + row * _width * 3 );
}
protected:
uint32_t _width, _height;
uint8_t *mData;
};
class ImageSourceKinectDepth : public ImageSource
{
public:
ImageSourceKinectDepth( uint16_t *buffer, int width, int height )
: ImageSource(), mData( buffer ), _width(width), _height(height)
{
setSize( _width, _height );
setColorModel( ImageIo::CM_GRAY );
setChannelOrder( ImageIo::Y );
setDataType( ImageIo::UINT16 );
}
~ImageSourceKinectDepth()
{
// mData is actually a ref. It's released from the device.
/*if( mData ) {
delete[] mData;
mData = NULL;
}*/
}
virtual void load( ImageTargetRef target )
{
ImageSource::RowFunc func = setupRowFunc( target );
for( uint32_t row = 0; row < _height; ++row )
((*this).*func)( target, row, mData + row * _width );
}
protected:
uint32_t _width, _height;
uint16_t *mData;
};
class kinectBasicApp : public AppBasic
{
public:
static const int WIDTH = 1280;
static const int HEIGHT = 720;
static const int KINECT_COLOR_WIDTH = 640; //1280;
static const int KINECT_COLOR_HEIGHT = 480; //1024;
static const int KINECT_COLOR_FPS = 30; //15;
static const int KINECT_DEPTH_WIDTH = 640;
static const int KINECT_DEPTH_HEIGHT = 480;
static const int KINECT_DEPTH_FPS = 30;
void setup();
void mouseDown( MouseEvent event );
void update();
void draw();
ImageSourceRef getColorImage()
{
// register a reference to the active buffer
uint8_t *activeColor = _device0->getColorMap();
return ImageSourceRef( new ImageSourceKinectColor( activeColor, KINECT_COLOR_WIDTH, KINECT_COLOR_HEIGHT ) );
}
ImageSourceRef getUserColorImage( int id )
{
// register a reference to the active buffer
uint8_t *activeColor = _manager->getUser(id)->getPixels();
return ImageSourceRef( new ImageSourceKinectColor( activeColor, KINECT_COLOR_WIDTH, KINECT_COLOR_HEIGHT ) );
}
ImageSourceRef getDepthImage()
{
// register a reference to the active buffer
uint16_t *activeDepth = _device0->getDepthMap();
return ImageSourceRef( new ImageSourceKinectDepth( activeDepth, KINECT_DEPTH_WIDTH, KINECT_DEPTH_HEIGHT ) );
}
ImageSourceRef getDepthImage24()
{
// register a reference to the active buffer
uint8_t *activeDepth = _device0->getDepthMap24();
return ImageSourceRef( new ImageSourceKinectColor( activeDepth, KINECT_DEPTH_WIDTH, KINECT_DEPTH_HEIGHT ) );
}
public: // Members
V::OpenNIDeviceManager* _manager;
V::OpenNIDevice* _device0;
gl::Texture mColorTex;
gl::Texture mDepthTex;
};
void kinectBasicApp::setup()
{
_manager = V::OpenNIDeviceManager::InstancePtr();
//_device0 = _manager->createDevice( "data/configIR.xml" );
_device0 = _manager->createDevice( V::NODE_TYPE_IR | V::NODE_TYPE_DEPTH ); // Create manually.
if( !_device0 )
{
console() << "(App) couldn't init device0\n" << std::endl;
//OutputDebugStringA( "(App) Couldn't init device0\n" );
exit(0);
}
_device0->setPrimaryBuffer( V::NODE_TYPE_DEPTH );
_manager->start();
gl::Texture::Format format;
gl::Texture::Format depthFormat;
mColorTex = gl::Texture( KINECT_COLOR_WIDTH, KINECT_COLOR_HEIGHT, format );
mDepthTex = gl::Texture( KINECT_DEPTH_WIDTH, KINECT_DEPTH_HEIGHT, format );
}
void kinectBasicApp::mouseDown( MouseEvent event )
{
}
void kinectBasicApp::update()
{
// Update textures
mColorTex.update( getColorImage() );
mDepthTex.update( getDepthImage24() ); // Histogram
//mDepthTex.update( getDepthImage() ); // Raw depthmap
}
void kinectBasicApp::draw()
{
// clear out the window with black
gl::clear( Color( 0, 0, 0 ) );
float sx = 320;
float sy = 240;
float xoff = 10;
float yoff = 10;
glEnable( GL_TEXTURE_2D );
gl::color( cinder::ColorA(1, 1, 1, 1) );
gl::draw( mDepthTex, Rectf( xoff, yoff, xoff+sx, yoff+sy) );
gl::draw( mColorTex, Rectf( xoff+sx*1, yoff, xoff+sx*2, yoff+sy) );
}
CINDER_APP_BASIC( kinectBasicApp, RendererGl )
Warning: USB events thread - failed to set priority. This might cause loss of data...
But I think that is probably good because I always get that warning when I get the Kinect working with the openni sample programs or with openframeworks.
What should I do at this point?
OpenNI Error: Failed to set USB interface!
OpenNI Error: No match found
Can you help me somehow?
dyld: Library not loaded: @executable_path/./../../../data/openni/lib/libTinyXml.dylib
Referenced from: /Annat/Dropbox/programmering/cinder_master/blocks/OpenNI/samples/BlockOpenNISkeleton/xcode/build/Debug/libOpenNI.dylib
Reason: image not found
sharedlibrary apply-load-rules all
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Cannot call into the loader at present, it is locked.)
(gdb)
gl::setMatricesWindowPersp( WIDTH, HEIGHT, 60.0f, 1.0f, 1000.0f);
cam.lookAt(Vec3f(center.pos.x, center.pos.y, mParam_zoom), Vec3f(center.pos.x, center.pos.y, .0f));
gl::setMatrices(cam);
11768998 [WARNING] IR buffer is corrupt. There are left over bytes (invalid size)
11769025 [WARNING] IR frame is corrupt!
11769033 [WARNING] IR buffer is corrupt. Size is 389848 (!= 624640)
<Recording file="../../../_assets/Captured.oni" playbackSpeed="2.0"/>
_status = _context.CreateProductionTree( *nodeIt );
NodeInfo info = *nodeIt;
_status = _context.CreateProductionTree( info );
when I'm moving my arm the points cloud changes in depth. This might be due to the minimum distance but I was wondering if anybody had the same issue.
II. Requirements:
1) Mac OSX + Xcode 4.0.2 and iOS SDK 4.3
2) Git + Cinder + Boost + OpenCV
You must follow this tutorial: http://libcinder.org/docs/welcome/GitSetup.html
III. Install notes
We will follow the indications of Charles Dietrich on his blog ( http://blog.charlesdietrich.com/2011/04/cinder-openni-on-os-x-with-xcode4.html )
1) libusb + kinect patch
Follow just the "Manual Build under OSX" on this link: http://openkinect.org/wiki/Getting_Started#Manual_Build_under_OSX
Tips: - If you're previously already installed libusb-devel then use "sudo port uninstall libusb-devel"
- Use cmake instead Xcode to build OpenKinect
2) libusb universal
It seems to be that there is two ways to do it. You must check at the end the arch of your lib with this command: lipo -info libusb/.libs/libusb-1.0.0.dylib
If you succeed, the arch must be i386 and x86_64
First go with the terminal inside your libusb folder then do one of this way:
Fisrt way:env CFLAGS="-arch i386" ./configure; make
mv libusb/.libs/libusb-1.0.0.dylib /tmp/libusb-1.0.0.dylib.i386
make clean
env CFLAGS="-arch x86_64" ./configure; make
mv libusb/.libs/libusb-1.0.0.dylib /tmp/libusb-1.0.0.dylib.x86_64
lipo -create /tmp/libusb-1.0.0.dylib.i386 /tmp/libusb-1.0.0.dylib.x86_64 -output libusb/.libs/libusb-1.0.0.dylib (check now the arch)
sudo make installTips: Try to start with a "sudo make clean"Second way:sudo make clean
export CFLAGS="-arch i386" ./configure; make
mv libusb/.libs/libusb-1.0.0.dylib /tmp/libusb-1.0.0.dylib.i386
make clean
export CFLAGS="-arch x86_64" ./configure; make
mv libusb/.libs/libusb-1.0.0.dylib /tmp/libusb-1.0.0.dylib.x86_64
lipo -create /tmp/libusb-1.0.0.dylib.i386 /tmp/libusb-1.0.0.dylib.x86_64 -output libusb/.libs/libusb-1.0.0.dylib (check now the arch)
sudo make instal3) OpenNI + Sensor + NITE
Go on the OpenNI's site and download: OpenNI Binaries + OpenNI Compliant Middleware Binaries + OpenNI Compliant Hardware Binaries
Untar Binaries with the command "tar xvf" and install them with "sudo ./install.sh".
Tips: PrimeSense provided a free license for use. The key is: 0KOIk2JeIBYClPWVnMoRKn5cdY4=
More information on this tutorial: http://kinecthesis.bakedmac.com/2011/01/11/installing-openni-kinect-drivers-and-nite-on-mac-os-x-10-6/
4) SensorKinect
Download it on this link: https://github.com/avin2/SensorKinect then do that:
tar xzvf avin2-SensorKinect-0124bd2.tar.gz
cd avin2-SensorKinect-0124bd2/Bin/
tar xvf SensorKinect-MacOSX-5.0.0.tar.bz2
./install.shMore information inside the README.5) BlockOpenNI
Navigate to your Cinder's blocks directory with terminal then do:
git clone https://github.com/chazmatazz/BlockOpenNI.git
III. Run the Skeleton sample.
1) Open with Xcode 4 the project BlockOpenNISkeleton.xcodeproj .
2) You must configure your build location. From the Xcode menu on top, click preferences, select the locations tab, look at the build location option. Select "Place build products in location specified by targets".
3) Plug your Kinect.
4) You can now compile. However, you will get an xml error. Navigate to BlockOpenNI/samples/BlockOpenNISkeleton/data/ and edit the configIR.xml. Tou must insert this line: <License vendor="PrimeSense" key="0KOIk2JeIBYClPWVnMoRKn5cdY4="/> . After you need to copy BlockOpenNI/samples/BlockOpenNISkeleton/data to BlockOpenNI/samples/BlockOpenNISkeleton/xcode/build/Debug/ .
5) Run the project. Do the pose calibration. After few seconds, you must see your skeleton.
tar xzvf avin2-SensorKinect-0124bd2.tar.gz cd avin2-SensorKinect-0124bd2/Bin/ tar xvf SensorKinect-MacOSX-5.0.0.tar.bz2 ./install.sh
Undefined symbols for architecture i386:
(Device) Error! XN_STATUS_OS_FILE_NOT_FOUND
(Device) Error! XN_STATUS_OS_FILE_NOT_FOUND
[OpenNIDeviceManager] Couldn't create device from xml
(App) Couldn't init device0
I think I have tried everything that was discussed and suggested in this post.
If I set the device manually:
_device0 = _manager->createDevice( V::NODE_TYPE_IMAGE | V::NODE_TYPE_DEPTH );
I can get it run, but I can only see the Image and Depth, but not the skeletal information.
Any help?
Thanks!
Undefined symbols for architecture i386:
"_xnGetRefContextFromNodeHandle", referenced from:
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIDevice.o
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIDeviceManager.o
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIUser.o
"_xnContextUnregisterFromShutdown", referenced from:
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIDevice.o
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIDeviceManager.o
xn::Context::SetHandle(XnContext*) in VOpenNIDeviceManager.o
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIUser.o
"_xnContextRelease", referenced from:
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIDevice.o
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIDeviceManager.o
xn::Context::SetHandle(XnContext*) in VOpenNIDeviceManager.o
xn::Context::TakeOwnership(XnContext*) in VOpenNIDeviceManager.o
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIUser.o
"_xnContextRegisterForShutdown", referenced from:
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIDevice.o
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIDeviceManager.o
xn::Context::SetHandle(XnContext*) in VOpenNIDeviceManager.o
xn::NodeWrapper::SetHandle(XnInternalNodeData*) in VOpenNIUser.o
"_xnRegisterToUserExit", referenced from:
xn::UserGenerator::RegisterToUserExit(void (*)(xn::UserGenerator&, unsigned int, void*), void*, void*&)in VOpenNIDevice.o
"_xnRegisterToUserReEnter", referenced from:
xn::UserGenerator::RegisterToUserReEnter(void (*)(xn::UserGenerator&, unsigned int, void*), void*, void*&)in VOpenNIDevice.o
"_xnRegisterToCalibrationStart", referenced from:
xn::SkeletonCapability::RegisterToCalibrationStart(void (*)(xn::SkeletonCapability&, unsigned int, void*), void*, void*&)in VOpenNIDevice.o
"_xnRegisterToCalibrationComplete", referenced from:
xn::SkeletonCapability::RegisterToCalibrationComplete(void (*)(xn::SkeletonCapability&, unsigned int, XnCalibrationStatus, void*), void*, void*&)in VOpenNIDevice.o
"_xnRegisterToPoseDetected", referenced from:
xn::PoseDetectionCapability::RegisterToPoseDetected(void (*)(xn::PoseDetectionCapability&, char const*, unsigned int, void*), void*, void*&)in VOpenNIDevice.o
"_xnRegisterToCalibrationInProgress", referenced from:
xn::SkeletonCapability::RegisterToCalibrationInProgress(void (*)(xn::SkeletonCapability&, unsigned int, XnCalibrationStatus, void*), void*, void*&)in VOpenNIDevice.o
"_xnRegisterToPoseDetectionInProgress", referenced from:
xn::PoseDetectionCapability::RegisterToPoseInProgress(void (*)(xn::PoseDetectionCapability&, char const*, unsigned int, XnPoseDetectionStatus, void*), void*, void*&)in VOpenNIDevice.o
"_xnForceShutdown", referenced from:
xn::Context::SetHandle(XnContext*) in VOpenNIDeviceManager.o
"_xnContextAddRef", referenced from:
xn::Context::SetHandle(XnContext*) in VOpenNIDeviceManager.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
