I’m trying to create a point cloud using the mesh format, like in the ofxKinect plugin demo. I seem to be getting strange results; see the attached screenshot (after some panning & zooming).
I use the following code:
//creating the mesh
int w = 320;
int h = 240;
ofMesh mesh;
mesh.setMode(OF_PRIMITIVE_POINTS);
for(int y = 0; y < h; y++) {
for(int x = 0; x < w; x++) {
float distance = kinect.getDistanceAt(x, y);
if(distance > 500 && distance < 4000){
ofVec3f t = kinect.getWorldCoordinateFor(x, y);
ofColor c = kinect.getColorAt(x,y);
mesh.addColor(ofFloatColor(c.r/255.0, c.g/255.0, c.b/255.0,1.0));
mesh.addVertex(t);
}
}
}
//the drawing and cam controls
easyCam.begin();
glPointSize(3);
ofPushMatrix();
// the projected points are 'upside down' and 'backwards'
ofScale(1, -1, -1);
glEnable(GL_DEPTH_TEST);
mesh.drawVertices();
glDisable(GL_DEPTH_TEST);
ofPopMatrix();
easyCam.end();
hey man, thanks for the awesome addons. I had it working perfectly with 1 Kinect. however, when I used 2 Kinects, I couldn’t see any depth image from the second Kinect. I tried using your first example and uncomment sections to use it with 2 Kinects, however I got errors in building it, something related with draw() and drawDepth() function. I figured that that example may not be the right one if I want to work with 2 Kinects, but I can’t find any way to make it work.
1>c:\users\cexp\desktop\of_v0071_vs2010_release\of_v0071_vs2010_release\addons\ofxkinectnui\src\kinect\nui\kinect.h(23): fatal error C1083: Cannot open include file: ‘MSR_NuiApi.h’: No such file or directory
Thx so much for your replies and sorry for my absence.
I tried SDK 1.5 and as you know it has many cool functions.
I will try to add some of them in near future. especially i want to try speech library and face tracking library.
OK, I reply though it’s crazy slow.
@alexlangberg
Thx for your suggestion. : )
I fixed the position so now it may be OK.
@jamesalliban
Thx so much for your trial.
I and co-developer tried to tune up the code.
I hope it’s ok now. : )
@prisonerjohn
Thank you for your report and reply to @jamessalliban. : )
@irregular
Sorry for this late reply…
You can filter which skeleton data you will use, but you can’t choose in advance.
@Kj1
Thanks for reply and sharing your trial. : )
Great work!
If somebody got this error, please download version3.0 of ofxKinectNui. : )
For some reasons, I uploaded zipped previous version on github, but it only works with Kinect SDK beta2.
@camilosw
Thx for your trial. : )
Good luck for your trial and please let me know if you succeed.
I will also try use on Code::Blocks when i have time…
I downloaded the addon and it looks really good. I have a problem however when trying to compile the KinectNuiCV example. It says
LINK : fatal error LNK1181: cannot open input file ‘…\addons\ofxOsc\libs\oscpack\lib\vs2010\oscpack.lib’
I checked the directory and indeed i dont have a lib folder in the oscpack. Im new to openframeworks, but i assumed all the libs would come when i downloaded the file. Im using of 7.1 for vs2010. I tried looking for ofxosc and i just found lots of addons with the same name, none of which have the cv2010 folder.
I dont have any problem compiling the KinectNui Example btw.
Yes, It’s because of my laziness of copying project from OpenCV example project.
I will fix this soon. (now I have short vacation and doesn’t have main machine here so it will be in a few days)
If you want to fix by yourself, please see the property of kinectNuiCvExample project, and remove oscpackd.lib and oscpack.lib from linker property.
(actually it may not need assimp.lib as well)
I attached where you should remove though it is in Japanese…
I thought that the files were necessary and for some reason i didnt have them. It never occurred to me that i could just take them out.
Just to let you know, there are 2 more libraries that are called by the linker but are not in the folders
LINK : fatal error LNK1181: cannot open input file ‘…\addons\ofxOpenCv\libs\opencv\lib\vs2010**opencv_ts*231.lib’
LINK : fatal error LNK1181: cannot open input file '…\addons\ofxOpenCv\libs\opencv\lib\vs2010*opencv_lapack.lib’
And also (this is probably a version problem) all the opencv calls are to xxx220, and my version of OF has xxx231 so i had to change them all.
Got it fixed by making the ofxKinectNui the first include in each file you use it. Seems odd, but this might prevent other people wasting half a day on cryptic VS errors
=> this works:
#pragma once
#include "ofxKinectNui.h" //must come first
#include "ofMain.h"
class testApp : public ofBaseApp {
I am running into this error when trying to compile ofxKinectNui.
1>AudioStream.obj : error LNK2019: unresolved external symbol _IID_IMediaBuffer referenced in function “public: virtual long __stdcall kinect::nui::StaticMediaBuffer::QueryInterface(struct _GUID const &,void * *)” (?QueryInterface@StaticMediaBuffer@nui@kinect@@UAGJABU_GUID@@PAPAX@Z)
1>AudioStream.obj : error LNK2019: unresolved external symbol _MoFreeMediaType@4 referenced in function “public: void __thiscall kinect::nui::AudioStream::Open(enum kinect::nui::AEC_SYSTEM_MODE)” (?Open@AudioStream@nui@kinect@@QAEXW4AEC_SYSTEM_MODE@23@@Z)
1>AudioStream.obj : error LNK2019: unresolved external symbol _MoInitMediaType@8 referenced in function “public: void __thiscall kinect::nui::AudioStream::Open(enum kinect::nui::AEC_SYSTEM_MODE)” (?Open@AudioStream@nui@kinect@@QAEXW4AEC_SYSTEM_MODE@23@@Z)
1>AudioStream.obj : error LNK2019: unresolved external symbol _IID_IMediaObject referenced in function “public: void __thiscall kinect::nui::AudioStream::Open(enum kinect::nui::AEC_SYSTEM_MODE)” (?Open@AudioStream@nui@kinect@@QAEXW4AEC_SYSTEM_MODE@23@@Z)
It seems to be a problem with linking. I think my settings are accurate.
The standard c++ project that comes with the KinectSDK compiles fine. I copied the include and linker settings regarding the Kinect SDK from that project into my oF project.
Thanks for your report.
I am sorry, it’s my mistake. Now it’s fixed.
Recently I merged this project and didn’t checked enough.
The following is the reason why you got error.
NUI_IMAGE_TYPE_COLOR_INFRARED is an enum defined only for 1.6 or higher.
So you couldn’t compile with your Kinect SDK (maybe version is lower than 1.6)
I fixed this bug so now you can compile without using NUI_IMAGE_TYPE_COLOR_INFRARED.
Thank you very much for sharing your library -I’m very excited to start working with it!
Any help with the build errors I’m receiving would be much appreciated (forgive me if this is a simple solution:):
1>------ Build started: Project: kinectNuiExample, Configuration: Debug Win32 ------
1>Build started 25/02/2013 19:38:18.
1>InitializeBuildStatus:
1> Touching "obj\Debug\kinectNuiExample.unsuccessfulbuild".
1>ClCompile:
1> testApp.cpp
1>d:\offroot\openframeworks\v0.7.4\of_v0.7.4_vs2010_release\apps\myapps\example\src\testapp.h(15): fatal error C1083: Cannot open include file: 'ofxKinectNui.h': No such file or directory
1> main.cpp
1>d:\offroot\openframeworks\v0.7.4\of_v0.7.4_vs2010_release\apps\myapps\example\src\testapp.h(15): fatal error C1083: Cannot open include file: 'ofxKinectNui.h': No such file or directory
1> ofxKinectNuiDraw.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\src\ofxKinectNuiDraw.cpp': No such file or directory
1> KinectContext.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\src\kinect\nui\KinectContext.cpp': No such file or directory
1> AudioStream.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\src\kinect\nui\AudioStream.cpp': No such file or directory
1> Event.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\..\..\addons\ofxKinectNui\src\win32\Event.cpp': No such file or directory
1> ofxKinectNuiRecorder.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\..\..\addons\ofxKinectNui\src\ofxKinectNuiRecorder.cpp': No such file or directory
1> ofxKinectNuiPlayer.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\..\..\addons\ofxKinectNui\src\ofxKinectNuiPlayer.cpp': No such file or directory
1> ofxKinectNui.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\..\..\addons\ofxKinectNui\src\ofxKinectNui.cpp': No such file or directory
1> SkeletonFrame.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\..\..\addons\ofxKinectNui\src\kinect\nui\SkeletonFrame.cpp': No such file or directory
1> SkeletonEngine.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\..\..\addons\ofxKinectNui\src\kinect\nui\SkeletonEngine.cpp': No such file or directory
1> Kinect.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\..\..\addons\ofxKinectNui\src\kinect\nui\Kinect.cpp': No such file or directory
1> ImageStream.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\..\..\addons\ofxKinectNui\src\kinect\nui\ImageStream.cpp': No such file or directory
1> ImageFrame.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\..\..\addons\ofxKinectNui\src\kinect\nui\ImageFrame.cpp': No such file or directory
1> Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.18
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
Please try release mode.
For some reason, debug mode is very slow.
I will try fix this bug later.
Thx. ; )
sadmb
[quote=“Curveau, post:41, topic:8360”]
Ok the below is resolved (it seems that when downloading the zip from github ofxKinectNui was named ofxKinectNui-master. Renaming fixed it
One last thing though: it does seem very slow, and I have a mid-powered GTX 660M, especially the point cloud. Can anyone clarify why this may be?