LightBuzz / Vitruvius

A set of easy-to-use Kinect utilities that will speed-up the development of your projects.
http://vitruviuskinect.com
Apache License 2.0
229 stars 82 forks source link

Bug at KinectViewer control #13

Open birbilis opened 8 years ago

birbilis commented 8 years ago

Please pull-in https://github.com/LightBuzz/Vitruvius/pull/12 - fixed a bug at _SizeChanged event handler of WPF KinectViewer control

Have done the fix at Kinect v1 version only since I don't have a v2 Kinect device yet to try it out. Probably the same fix is needed to v2 WPF and WinRT controls if they share similar logic

the bug was that when you resize you were setting two width value to 0 which would cause next frame to get again the Kinect frame size - but if the canvas size isn't also reset in the _SizeChanged event, then at the next frame event an if clause skips the recalculation of ratio parameter, so the skeleton is smaller / not aligned with the person.

Note that in the V1 test app have also done XAML changes to allow KinectViewer (that I've added to it) to take all empty space when resizing

have also added commented block at XAML of the v1 test app and conditional compilation checks at codebehind, so that one can switch to using a viewbox>grid>image,canvas block instead of the KinectViewer control with almost identical code. However, I noticed that the code in KinectViewer control is producing a bit better aligned results than the extensions to Canvas after resizing the application window. It might be my impression, but I've noticed they use quite different code. Haven't checked the v2 version if it has unified such code (e.g. I'd expect all that drawing code from KinectViewer control in v1 version to be in the Canvas extensions instead of being inside the WPF control's code)

Vangos commented 8 years ago

Thanks for this update. Kinect v1 and v2 controls are slightly different. I'll integrate all of your code. We are working on a quite big update in the next few weeks. On Fri, 20 Nov 2015 at 17:51, George Birbilis notifications@github.com wrote:

Please pull-in #12 https://github.com/LightBuzz/Vitruvius/pull/12 - fixed a bug at _SizeChanged event handler of WPF KinectViewer control

Have done the fix at Kinect v1 version only since I don't have a v2 Kinect device yet to try it out. Probably the same fix is needed to v2 WPF and WinRT controls if they share similar logic

the bug was that when you resize you were setting two width value to 0 which would cause next frame to get again the Kinect frame size - but if the canvas size isn't also reset in the _SizeChanged event, then at the next frame event an if clause skips the recalculation of ratio parameter, so the skeleton is smaller / not aligned with the person.

Note that in the V1 test app have also done XAML changes to allow KinectViewer (that I've added to it) to take all empty space when resizing

have also added commented block at XAML of the v1 test app and conditional compilation checks at codebehind, so that one can switch to using a viewbox>grid>image,canvas block instead of the KinectViewer control with almost identical code. However, I noticed that the code in KinectViewer control is producing a bit better aligned results than the extensions to Canvas after resizing the application window. It might be my impression, but I've noticed they use quite different code. Haven't checked the v2 version if it has unified such code (e.g. I'd expect all that drawing code from KinectViewer control in v1 version to be in the Canvas extensions instead of being inside the WPF control's code)

— Reply to this email directly or view it on GitHub https://github.com/LightBuzz/Vitruvius/issues/13.

Vangos Pterneas http://pterneas.com