forums.naturalpoint.com

Discussion and Support for the OptiTrack, SmartNav and TrackIR brands by NaturalPoint

.net wrappers for c++ SDK

by leith » Wed Dec 01, 2010 2:20 pm

Howdy.

Hey NP type people:

Is NP planning on releasing .net wrappers for the new c++ SDK? I started writing one today. Got it to the point that I'm getting a list of cameras, their IDs and setting up the NumericLEDs. Main test program is in C#, so its definitely working.

I'm wondering if I should start an open source project for these wrappers, or if you guys are in the middle of doing a wrapper yourselves? If you are planning on releasing something I wont muddy the waters. If you are not, I'd like to get a project up and running ASAP. Thks.

-brad
leith
 
Posts: 192
Joined: Tue Jan 02, 2007 2:17 pm

by beckdo » Wed Dec 01, 2010 7:13 pm

Hey Brad,

We're not currently working on a wrapper. In fact, I was really hoping that the community would put together a wrapper. Clearly you are thinking along the same lines.

Please let me know what I can do to be of assistance.

-Doug
beckdo
NaturalPoint Employee
NaturalPoint Employee
 
Posts: 519
Joined: Tue Jan 02, 2007 2:02 pm

by leith » Wed Dec 01, 2010 10:16 pm

Good to know. I'm going to keep kicking it around for a few more days. I'll likely release a half finished (but runnable) version under the lgpl next week. License decision isn't final.

Good opportunity to get over my fear of C++.

Thks.
leith
 
Posts: 192
Joined: Tue Jan 02, 2007 2:17 pm

by leith » Wed Dec 01, 2010 11:29 pm

or maybe sooner... just got it capturing frames in precision grayscale mode.
leith
 
Posts: 192
Joined: Tue Jan 02, 2007 2:17 pm

by leith » Wed Dec 01, 2010 11:47 pm

My gosh this is fast. My first gen quad core intel is processing 20 cams at full 100fps and not even pinning a single core.

Very impressive. Great job NP folk.

-brad
leith
 
Posts: 192
Joined: Tue Jan 02, 2007 2:17 pm

by beckdo » Thu Dec 02, 2010 1:43 am

Thanks Brad. The new SDK is a complete rewrite with the intent of making something simple & powerful for end users. All of the image processing code has been optimized to squeeze out every bit of performance while leaving as much CPU as possible for the user application.
beckdo
NaturalPoint Employee
NaturalPoint Employee
 
Posts: 519
Joined: Tue Jan 02, 2007 2:02 pm

by leith » Thu Dec 02, 2010 9:41 am

I think I saw somewhere that parts of the SDK are thread safe?

Is that to the point that say... I could spawn a thread for each camera and poll each camera for its own frames independently? Or is it better to address the cams from a single thread?
leith
 
Posts: 192
Joined: Tue Jan 02, 2007 2:17 pm

by beckdo » Thu Dec 02, 2010 12:19 pm

The Camera SDK has been designed to be thread-safe. In that you can pass around camera pointers between threads set & get camera settings from different threads, fetch and process frames from different threads, etc.

However, I wouldn't suggest spawning a thread for each camera. The reasoning is that the processing load is already spread evenly across the machines cores whether you thread or not. Since this is the case, it seems reasonable to keep things as simple as possible. Additionally, there's finally a simple approach for receiving callbacks when a new frame arrives so having a thread to poll is probably overkill.

I think if done right, the wrapper layer can be kept very thin.
beckdo
NaturalPoint Employee
NaturalPoint Employee
 
Posts: 519
Joined: Tue Jan 02, 2007 2:02 pm

by leith » Thu Dec 02, 2010 2:04 pm

Ok. That's what I wanted to know. The wrapper layer, as you say, is super thin. Wasn't going to thread it. Its my client app I was curious about. But if its multi threaded behind the SDK then as you say, not worth breaking up again unless its for other reasons.

Thanks Doug.

The wrapper is to the point that I was able to update my open source app to use the new SDK rather than the old one.

http://code.google.com/p/kinearx2dotserver/

so... generally, I'd say its pretty functional already for less than 12 hours work.

I'll likely release soon. When I do, I'd be curious as to your feedback. Mostly, I'm taking the header files, copying them over and modifying them. Which is really just manual labor. I'm not a very experienced c++ guy so if you take a look and see any shortcuts I could take, it will be much appreciated.
leith
 
Posts: 192
Joined: Tue Jan 02, 2007 2:17 pm

by beckdo » Thu Dec 02, 2010 5:35 pm

Excellent Brad. Sounds like good progress. I'd be happy to review the wrapper and give feedback as it comes along.
beckdo
NaturalPoint Employee
NaturalPoint Employee
 
Posts: 519
Joined: Tue Jan 02, 2007 2:02 pm

Next

Return to Camera SDK