none
What about v2 SDK for WinForms RRS feed

  • Question

  • I work for a company with software having a footprint in operating rooms. We have fast-tracked a project to provide surgeons with a simple gesture-based image viewing capability in the OR so that they need not memorize x-rays prior to surgery and remain sterile during the surgery. For this I purchased Microsoft Kinect Sensor for Xbox One and downloaded Kinect for Windows v2 SDK.

    I saw no WinForms samples among those in the SDK which all appear to be WPF and C++. Our tentative choice of SDK has richer WinForms capabilities motivating us to write a skeletal app for demonstrating gesture useability. I found a WinForms-based sample app here:

    https://code.msdn.microsoft.com/windowsdesktop/Beginning-Kinect-for-a198d400

    ...but, unfortunately it no longer builds with the v2 SDK. Certainly, WinForms is still compatible but without a little information that I can't seem to find I have little idea as to how it might work with WinForms. There is so little code involved with the existing v2 SDK WPF and v1.5 WinForms-based samples that implementation for WinForms is likely very simple but I can't very well guess at this.

    I've looked at both samples and the difference seems to be that with WPF you define a Kinect region within the application and that with WinForms such a region seems to be the entire app, by default. The WinForms sample has code to choose the sensor (huh? would there ever be more than one?) while the v2 WPF sample simply uses a default sensor. The code that has errors in the WinForms sample build pertains to support no longer available in the v2 Microsoft.Kinect.KinectSensor class. Most likely there is a simpler way to accomplish but I am hoping for basic working samples as opposed to a costly guessing game with which I may or may not get lucky.

    Can anyone offer help or guidance to compensate for missing information? For all I know I might have missed something and simply need to be pointed to it.

    Many thanks,
    Pat Pattillo


    Pat Pattillo

    Thursday, September 21, 2017 6:55 PM

Answers

  • 1) I understand the business logic, it's just that sometimes business requests weird things , and sometimes those requests go beyond or against the technology(SDK,Engine,whatever you want to call it) you've already decided upon and paid for, which makes them impossible. And I have had to hack my way out of it at times but it was painful and resulted in more problems down the road. So from that standpoint I thought it more important to have a way out and most of the time a proper one.

    2) I understood that, I wasn't clear on whether you were talking about a UI SDK ,for example Noesis UI.

    3) As to WinForms support in 1.5, it's been some time since the v1 sensor and the 1.5 version of the SDK and MS has moved most of its focus on WPF. I have no direct experience with this but it seems that you can use WPF controls in WinForms and vice versa. So the reason could be that you can just try to use the controls in WinForms and it would work.

    If someone else knows more they will comment but MS has pretty much abandoned this forum. Most of their engineers have moved to Hololens development and support. So don't expect any answers from them in here. You'd get more feedback if you were to contact them directly.

    4) I'm not aware of something you can write only in XAML that you can't also write in plain C#. XAML is just a convenience not a necessity. You can just as well instantiate a Kinect Region in the code behind file and assign children etc.

    WPF can get unwieldy so on that I agree. More so if you decide to avoid XAML and put everything in C#.

    Anyway, I've said my two cents. Hope someone with direct experience can comment. But my advice would be to inquire at MS directly. Don't just wait for another response here.Been on this forum since 2015 and I haven't seen a single thread about WinForms. Good luck.


    Thursday, September 21, 2017 10:18 PM

All replies

  • The link you provide is related to Kinect v1 sensor(basically the Xbox 360 equivalent).Kinect v2 is the equivalent of Xbox One. Kinect v1 and Kinect v2 are totally different sensors therefore the SDKs backing them are different as well. So if the SDK Browser for Kinect v2 does not contain samples for WinForms then it probably doesn't support them(as in having controls and regions that can directly listen to Kinect capabilities) and they probably won't.

    Not entirely sure what you mean by "Our tentative choice of SDK has richer WinForms capabilities" but I doubt you can't find an equivalent of those capabilities in WPF. WPF is much more flexible than WinForms.

    It should be possible to port code from the WPF samples to WinForm, though it all depends on what you need. And I think you need flexibility. If something is not possible using WinForms and is not supported out of the box in WPF, you can always roll your own. This is a whole other topic, but all in all WPF , in my humble opinion, has more potential if you want to do something fancy or taxing.

    Thursday, September 21, 2017 7:46 PM
  • Panning, rotation and a few other features pose problems (specifically image clipping with some implementations) when the underlying window is not WPF. That is the "fancy or taxing" I am trying to avoid. Yes, I can implement and may but it makes more business sense to use WinForms if WPF proves unwieldy or requires a major effort. My team has not shied away from WPF challenges with a major WPF PRISM-based application but you have to understand that for this project we are seeking the path of least resistance for what I think are obvious reasons, the same reason we seek an SDK for medical imaging -- because it costs far less than rolling our own.

    As for "Our tentative choice of SDK has richer WinForms capabilities" we decided on an SDK and that particular SDK had severe problems with functions we require in its WPF "flavor". Hopefully that is clear.

    First paragraph I knew already. The WPF approach does delimit a "kinectRegion" which may or may not be a necessity with v2 WinForms. I was hoping someone knowledgeable might comment as to the correct approach, possible provide an updated sample (hey, it was thought to be reasonable enough to provide in 1.5) or provide authoritative recommendation over and above guessing. If no one can provide such an answer then I hack a bit. If hacking is unsuccessful then I find another sensor. In my experience Microsoft has been far more responsive to endeavors by major corporations than home users, particularly those with humanitarian ends that might garner publicity. So I asked.

    We are only trialing the SDK and are considering another. This is a simple application and the UI shell was quickly written using WinForms to test with Kinect due to SDK WPF shortcomings and there is no WinForms guidance as in the past.

    All but one of many Kinect-related statements in WPF samples are possible given v1.5 and v2 SDK differences. It is impossible to port the bulk of the WPD code to WinForms due to lack of App class, App.xaml, and xaml for UI in WinForms. Not asking you to look but this would become apparent if you did. But what the heck, I am trying the one statement to instantiate default sensor in WinForms to see if it works. The bulk of code I'd use from WPF sample cannot be used outside of WPF. Winforms and WPF are different animals.

    I'm doubtful that even the single statement I thought applicable would do the trick:

    this.kinectRegion.KinectSensor = KinectSensor.GetDefault();

    what would you suggest at the WinForms equivalent of this.kinectRegion, which is a xaml tag in the http://schemas.microsoft.com/kinect/2014 namespace? I'm fresh out of ideas. I suspect different code is needed for WinForms rather than a subset of what can be found in WPF sample. Wouldn't you agree? The "Should be able to port" seems to be doubtful. I've done a lot of research already and that was said of 1.8 ==> 2.0 but the WinForms example is from 1.5, I believe.


    Pat Pattillo



    • Edited by SixFootGlass Thursday, September 21, 2017 9:32 PM more info
    Thursday, September 21, 2017 8:04 PM
  • 1) I understand the business logic, it's just that sometimes business requests weird things , and sometimes those requests go beyond or against the technology(SDK,Engine,whatever you want to call it) you've already decided upon and paid for, which makes them impossible. And I have had to hack my way out of it at times but it was painful and resulted in more problems down the road. So from that standpoint I thought it more important to have a way out and most of the time a proper one.

    2) I understood that, I wasn't clear on whether you were talking about a UI SDK ,for example Noesis UI.

    3) As to WinForms support in 1.5, it's been some time since the v1 sensor and the 1.5 version of the SDK and MS has moved most of its focus on WPF. I have no direct experience with this but it seems that you can use WPF controls in WinForms and vice versa. So the reason could be that you can just try to use the controls in WinForms and it would work.

    If someone else knows more they will comment but MS has pretty much abandoned this forum. Most of their engineers have moved to Hololens development and support. So don't expect any answers from them in here. You'd get more feedback if you were to contact them directly.

    4) I'm not aware of something you can write only in XAML that you can't also write in plain C#. XAML is just a convenience not a necessity. You can just as well instantiate a Kinect Region in the code behind file and assign children etc.

    WPF can get unwieldy so on that I agree. More so if you decide to avoid XAML and put everything in C#.

    Anyway, I've said my two cents. Hope someone with direct experience can comment. But my advice would be to inquire at MS directly. Don't just wait for another response here.Been on this forum since 2015 and I haven't seen a single thread about WinForms. Good luck.


    Thursday, September 21, 2017 10:18 PM
  • Could you please explicitly list the features / use cases you need Kinect for? It might not be that hard to implement your own cursor / Kinect region for win forms.

    Kinect for Windows 2 SDK supports only a single sensor per computer - this is the reason why you have only GetDefault() static method exposed in v2 SDK.  

    Gestures and skeleton tracking are not tied to WPF in any way. It is that only a few controls are being exposed to ease integration into a WPF-based applications (through toolkit / controls supplemental libraries)

    Friday, September 22, 2017 7:46 AM
  • Thanks for considering it. The path of least resistance was to switch SDKs. I was dismayed that a medical imaging SDK for WPF had fundamental problems with basic imaging functions. That should have been warning sign from the start. I'm marking it as an answer based on :

    Don't just wait for another response here.Been on this forum since 2015 and I haven't seen a single thread about WinForms. Good luck."

    I think that answer served me well, as I have most of this done with WPF using a better SDK.


    Pat Pattillo

    Tuesday, October 3, 2017 3:26 AM