Hello all openF-Forum
I’m trying out this ofxMSKinect on a project I had some time ago that used the old ofxKinect in order to get the Depth Pixels into ofxOpenCv. It used to work like this:
nothing?
Please help, I don’t understand why I get Format not supported and the ofxMSKinect mentions that it does support depth to video ( https://github.com/simonhr/ofxMSKinect )
[tt]
Feature list:
4. transform depth to video[/tt]
I managed to get the depth data onto an ofTexture, now how can I get that onto an openCV ofxCvColorImage? xD
setFromPixels is not made for this now is it?
if you have a ‘size mismatch’ it’s probably because it’s 640x480, not 320x240
if you have ‘format not supported’ it might be because the raw ofxmskinect depth is unsigned short rather than unsigned byte, which would mean you need to use an ofShortPixels instead of ofPixels.
if you want to get data from an ofTexture to an ofPixels you need to use ofTexture::loadData() to set some ofPixels.
but i’m still not sure exactly what you’re trying to do, the more code you can post, the better.
Sure, I will upload the code. It is just ofxOpenCv blob detection using ofxMSKinect depth image as source, that is to say… a mix of two examples you guys already have, nothing too fancy.
It used to work without the Kinect SDK or ofxMSKinect but I wanted to try it out now.
I will rewrite the code from scratch just in case I made a big mistake.
BRB!
Here it is and as simple as I mentioned.
I use Visual C++ 2010 Express in Windows x64, I get no error when compiling but you can see that in the attached image the code is not working. When I used the old ofxKinect it never failed.
This time I get no format or size errors in the console and I used this:
May I also ask how I can get the old depth grey gradient? All the colors may be discared later by openCV but I don’t want to add distortion to analysis.<–I’m not sure that happens.
Thank you Kyle!
Correction… Why do I get no depth gradients at all?
i downloaded and looked through your code. my feeling is that these problems stem from trying to work with the kinect at 320x240. pretty much everyone uses 640x480, and 320x240 isn’t as rigorously tested.
right now you’re kind of mixing 320x240 and 640x480. i would switch all of your code to using 640x480 only, and see what happens.
also, try using GetofDepthPixels() instead of GetDepthPixels(). GetofDepthPixels() will return an ofPixels instead of an unsigned char*, so it should be formatted correctly already.
i would switch all of your code to using 640x480 only, and see what happens
Well, I had avoided that since this is what ofxMSKinect says in the code:
// default depth resolution is 320x240
isOk = firstDevice->StartDepth(IMAGE_RESOLUTION_320x240);
But I followed your advice. First I set everything to 640x480 with GetDepthPixels() and instead of the depth camera I get a black window.Then…
also, try using GetofDepthPixels() instead of GetDepthPixels(). GetofDepthPixels() will return an ofPixels instead of an unsigned char*, so it should be formatted correctly already.
I don’t know how to do this and I’d like to learn more about it. Could you explain a bit more of how one could manage this?
Thank you for your time Kyle.
the comment that says “default depth resolution is 320x240” is just about the way the MS SDK example is set up. it doesn’t have anything to do with the kinect defaults, and there’s no reason you have to use it unless you really want to.
I’m sorry… I’m not getting it.
I’ll set everything to 640x480, but I cannot get it to work now, so I’d like to review the process.
1.-In the *.h file declare:
What I did learn is the firstDevice->DrawDepthTexture will only draw depth if the resolution is set to 320x240, otherwise it just displays a black screen (I double checked).
Having changed every single resolution to 320x240 I did what you told me to do but I got the exact same result as the previous post I made with the attached image.
I’d like to be able to solve this problem myself but everything does seem to be correct and I get no compilation errors.
:o
hmm i can’t help you at this point because i don’t have access to a windows machine running ofxMSKinect. my suggestion is to post on the original ofxMSKinect thread, or message the creator of the addon.