Win32 status

19 views
Skip to first unread message

Joshua Blake

unread,
Dec 7, 2010, 3:23:00 PM12/7/10
to OpenKinect
An update on Win32:
 
Hector architected the libfreenect code so that the usb library could be abstracted out. Libusb works on Linux and OS X but Windows requires libusb-win32, which uses an older API but mostly works. I investigated adding the libusb-win32 implementation to libfreenect. I was able to get the depth working decently but video was really buggy. I determined that to make this approach work well it would require diverging significantly from the rest of the libfreenect core.
 
Rather than do that, we decided to use Zephod's code (accidental API) that he contributed because it already solved the same problems and it works really really well. Zephod's code is written in C++ but has a C wrapper to make it implement the libfreenect.h header. This means the core codebase for Windows will be different than libfreenect but applications can still use the same API across the three platforms.
 
If a future release of libusb supports Windows properly then we could look at having a single codebase across the platforms but at this point it isn't feasible.
 
At this point I have moved the Zephod code around to the appropriate place and updated the C wrapper to have the latest libfreenect.h. I still need to implement a few of the methods that are missing in the core C++ module. As soon as this is done we should be able to add it to mainline.
 
Anyone who wants to see the latest code can check the zeph-win32 branch on my fork:
 
Thanks for everyone's help and patience!
 
Josh
 
---
Joshua Blake
Microsoft Surface MVP
OpenKinect Community Founder http://openkinect.org

(cell) 703-946-7176
Twitter: http://twitter.com/joshblake
Blog: http://nui.joshland.org
Multitouch on Windows book: http://manning.com/blake


likeBVH

unread,
Dec 7, 2010, 4:30:48 PM12/7/10
to OpenKinect
HI Josh;

In terms of implementing more freenect methods, EisernSchild's managed
OpenKinectCamera has more. Secondly, the USB library method names he
used are also more consistent with the latest freenect lib. Zephod
v17 seems to have a working IR.

My wish list:
a) EisernSchild figure out how to make IR work.
b) By using freenect_raw_tilt_state* raw_state in EisernSchild's
code,
the missing freenect methods can be implemented
e.g. freenect_raw_device_state* freenect_get_device_state();
int freenect_update_device_state();

Summary, it is unfortunate Zephod is busy right now, such that we do
not have v18 or v19 that align closer to the ongoing development.

Once EisernSchild has figured out the IR part, the next step is to
introduce the "Standard" Freenect methods (That taps into his
framework). Currently, I am able (Vista cSharp env) to get good video
and depth framerates from his method. The next step will be to link up
with LostInCake OpenTK (Mono compatible) tripple buffer to see the
framerate performance while manipulating the pointcloud or texture
triangle. Once the IR is working, it will be possible to use e.g.
OpenCVsharp (Mono compatible) for semi/auto calibration.

It is important to stick as close as possible to the standard methods
names - (BOTH at the levels of freenet and usblib calling methods)
to encourage community effort to bring the Csharp platform closer to
the ongoing development.



Missing Methods in Zephod's and EisernSchild's codes:

freenect_raw_device_state*
freenect_get_device_state();
int freenect_update_device_state();


Methods in Zephod's codes that are not implemented yet:
__declspec(dllexport) int __cdecl
freenect_set_depth_format(freenect_device *dev, freenect_depth_format
fmt)
{
return 0;
};

__declspec(dllexport) int __cdecl
freenect_set_video_format(freenect_device *dev, freenect_video_format
fmt)
{
return 0;
};


__declspec(dllexport) int __cdecl
freenect_update_tilt_state(freenect_device *dev)
{
return 0;
}

__declspec(dllexport) freenect_raw_tilt_state* __cdecl
freenect_get_tilt_state(freenect_device *dev)
{
return NULL;
}

__declspec(dllexport) double __cdecl
freenect_get_tilt_degs(freenect_raw_tilt_state *state)
{
return 0.0;
}


__declspec(dllexport) void __cdecl
freenect_get_mks_accel(freenect_raw_tilt_state *state, double* x,
double* y, double* z)
{
return;
}

Joshua Blake

unread,
Dec 7, 2010, 8:00:53 PM12/7/10
to openk...@googlegroups.com
likeBVH:
 
Not sure if you're confusing the core win32 C/C++ effort with the managed wrappers.
 
I'm working on implementing the missing methods (which you list) that were added since v17. It is using the same exact libfreenect.h file as the rest of libfreenect so the method names by definition are the same.
 
I haven't looked at EisernSchild's latest code but the earlier version was a ported version of a very early Zephod drop (v8 or so?)  Either way, lostincake has a pretty complete managed wrapper that uses P/Invoke and works on Mono and .NET. I don't think EisernSchild's code will end up in the main repository as is. Once the Win32 (modified Zephod) core is done maybe it can be modified to wrap that for C++/CLI, if there is a performance benefit over P/Invoke.
 
Josh

EisernSchild

unread,
Dec 7, 2010, 9:46:29 PM12/7/10
to OpenKinect
Josh:

Youre absoulutely right that my first built was most part Zephods
code.

And so the last build is as close (as possible in managed class) to
the main repository.

So i absolutely look forward to LostInCakes work to get that all
together..

salut

likeBVH

unread,
Dec 8, 2010, 2:44:37 AM12/8/10
to OpenKinect

HI Josh;

For me, the key issue is that someone has made a decision on how to
drive a concerted effort to continue Zephod's pioneering work that
aligns with the main stream to keep up with the ongoing development.
Although EisernSchild's code is a variant of Zephod's earliar version,
he has made available a workable opensource CSharp wrapper version
that allows direct access to both the RGB and Depth buffers (hopefully
soon the IR buffer). One step further than the win32 NUI Driver.
Reply all
Reply to author
Forward
0 new messages