none
WPF aplication detecting QR Code Slowly RRS feed

  • Question

  • I have made a custom user control , modifing the KinectColorViewer in the Windows SDK Samples. In the code there is a Event :

           private void ColorImageReady(object sender, ColorImageFrameReadyEventArgs e)

    called at 30 fps to draw the kinect camera rgb in wpf image control.

    I have added a few lines in this function that calls Zxing library to decode Qr codes with kinect,selecting frames from 0.5 sec and work fine... but the problem is that de image is not fluid. I have tried using a a DispatcherTimer 0.5 sec too but its the same, the video freeze a 0.2  - 0.5 sec during Zxing call i supose and continue.

    What it's the correct form to have fluid video and calculate in background from a frame the qr code? Create background thread?



    AntCandal


    • Edited by acandaldev Wednesday, March 7, 2012 10:36 PM bad write
    Wednesday, March 7, 2012 10:35 PM

Answers

  • Basically, yes. You want something like:

    Thread t = new Thread(frameToQCCode);

    t.start();

    then define frameToQCCode() somewhere.

    • Proposed as answer by Michael Osthege Friday, March 9, 2012 8:42 AM
    • Marked as answer by acandaldev Monday, March 12, 2012 11:46 AM
    Wednesday, March 7, 2012 10:49 PM

All replies

  • Basically, yes. You want something like:

    Thread t = new Thread(frameToQCCode);

    t.start();

    then define frameToQCCode() somewhere.

    • Proposed as answer by Michael Osthege Friday, March 9, 2012 8:42 AM
    • Marked as answer by acandaldev Monday, March 12, 2012 11:46 AM
    Wednesday, March 7, 2012 10:49 PM
  • As tcqwerty suggests, create a thread to process the frame. In the callback from Kinect, you do not want to do anything overly complicated or takes a long time to process. You need to copy out the data as fast as possible and work on the data on a background thread.

    Friday, March 9, 2012 12:56 AM
  • Ok, i understand that i have to use Threading, with dispatcher maybe?

    how to do the code not reentrant, because if i make a thread  witch 0.5 seconds, when the routine is unfinished ,other thread can be starting the same routine??


    acandaldev

    Friday, March 9, 2012 9:19 AM