none
Swapping from faceReader to faceReaderHD RRS feed

  • Question

  • I would like to swap between faceReaderHD and faceReader I worry that if both are open simultaneously then that would use unnecessary resources. Is there a way to close reader after opening it or would subscribing and unsubscribing via faceReader.FrameArrived += (-=) FaceReader_FrameArrived be the best bet? I've been playing with faceReader.Dispose() and faceReaderHD.Dispose() but I keep getting crashes. What exactly does the Dispose function do and when should it be used?

    Thanks

    Richard

    Thursday, September 7, 2017 3:49 PM

All replies

  • Dispose should always be used at the end to release the resources. You ideally want to open the readers once at the beginning and Dispose once at the end. Are you trying to access the readers after disposing them? If so then that's probably why you see crashes.

    Subscribing and unsubscribing should work , provided you only use the FrameArrived function to process any data from those sources.

    Thursday, September 7, 2017 5:15 PM
  • thanks. Would there be a drain on resources if you have open readers even without subscription? Is there anyway to "close" a reader/faceSource rather than dispose?

    • Edited by Richard218 Friday, September 8, 2017 8:55 AM
    Friday, September 8, 2017 8:13 AM
  • I'm not sure, I haven't checked it out.The part that does drain resources is the part that processes the data you get from the reader when a frame arrives. Basically what you do with the data frame after getting it using AcquireLatestFrame. The data frames (Color,Body,Depth etc) are quite sizeable so copying and/or modifying them for use, takes time. Mostly it depends on what you need to do.

    Kinect has a Windows Service running in the background all the time and it handles the communication with the sensor device. It also handles the processing of raw data like IR to produce the Skeleton Tracking data. All of that though are costs paid by the service. The readers should only be a gateway to the data , imho, and without subscription, it's probably just handles or sockets or something like that. I wouldn't worry about it too much. Of course this is all just guesswork on my part but I can't see that they do more than that.

    So long as you can disable the processing of data from the HD module, and only process data from the regular one, you won't do duplicate work and you won't drain unnecessary resources, or at least a noticeable amount.
    Friday, September 8, 2017 9:03 AM