Kinect is not firing MultiSourceFrameArrived event after some time

Hi,
I am using Kinect v2 with EmguCV in my application. I am performing some image processing task on the acquired frame. I noticed that after some time (1-2 minutes) the Kinect is not firing MultiSourceFrameArrived event.
Below is the snippet of the code-
public partial class KinectForm : Form
KinectSensor kinect;
MultiSourceFrameReader reader;
CoordinateMapper coordinateMapper;
public KinectForm()
kinect = KinectSensor.GetDefault();// Get the connected kinect Sensor
coordinateMapper = this.kinect.CoordinateMapper;
reader = kinect.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth);
kinect.Open();// Start reading the data from kinect
InitializeComponent();
private void FrameArrivedDisplayMode(object sender, MultiSourceFrameArrivedEventArgs e)
var reference = e.FrameReference.AcquireFrame(); // Get a reference to the arrived frame
ColorFrame colorFrame = reference.ColorFrameReference.AcquireFrame(); // Access color frame
DepthFrame depthFrame = reference.DepthFrameReference.AcquireFrame(); // Access depth frame
if (colorFrame != null && depthFrame != null)// Do not proceed, if any frame is expired
RenderColorPixels(colorFrame);
RenderDepthPixels(depthFrame);
// Lots of image processing is being performed here
if (colorFrame != null) colorFrame.Dispose();
if (depthFrame != null) depthFrame.Dispose();
private void KinectForm_FormClosing(object sender, FormClosingEventArgs e)
if (this.reader != null)
this.reader.Dispose();
this.reader = null;
if (this.kinect != null)
this.kinect.Close();
this.kinect = null;
private void displayModeRadioButton_CheckedChanged(object sender, EventArgs e)
if (displayModeRadioButton.Checked)
reader.MultiSourceFrameArrived += FrameArrivedDisplayMode;
else
reader.MultiSourceFrameArrived -= FrameArrivedDisplayMode;
The above code was working earlier, but later on once I added more processing on the data, the event was not fired at all after some point of time.
I am disposing the frame every time. Why this is happening? How to fix this problem?
Thanks

Carmine, Thanks a lot for prodding the references. I am in the process of designing it.
Meanwhile, since as you said the above code was holding the frame data and disposing the frame after processing it, so I though of changing the style little bit. Please see the code below-
private void FrameArrivedDisplayMode(object sender, MultiSourceFrameArrivedEventArgs e)
var reference = e.FrameReference.AcquireFrame(); // Get a reference to the arrived frame
ColorFrame colorFrame = reference.ColorFrameReference.AcquireFrame(); // Access color frame
DepthFrame depthFrame = reference.DepthFrameReference.AcquireFrame(); // Access depth frame
if (colorFrame != null && depthFrame != null) // Do not proceed, if any frame is expired
ColorFrame.CopyConvertedFrameDataToArray(ColorFramePixels, ColorImageFormat.Bgra);
depthFrame.CopyFrameDataToArray(DepthFrameData);
colorFrame.Dispose();
depthFrame.Dispose();
//Here I am doing image processing
Now, this way I am not using some of the frames but it should work, since the frame is disposed earlier.
But still after some time, the event is not fired out.
Why? Can you tell me the reason?
Thanks
Ravi

Similar Messages

  • Urgent:WebLogic 5.1 is not listening to requests After some time...!!

    Hello,
    I'm experiencing a strange problem.As the subject states the Server not
    listning to the requests...!! After starting the server we are connecting that
    server using "getInitialContext" .
    Initially we are able to get the context and working fine...But, If the Server
    left idle for some time(approxmately 30 min)...after that it is not able to get
    the Context and more over I'm not able to PING the WebLogic also...After that
    the server not at all pinging....!!And in the log files it is not showing any
    errors.
    Environment:
    SPARC,Solaris7,WebLogic5.1 with Sp6,
    Java version 1.3.0.
    Any one Please help me...!!
    Thanks in Advance,
    Raja.

    Hello,
    I'm experiencing a strange problem.As the subject states the Server not
    listning to the requests...!! After starting the server we are connecting that
    server using "getInitialContext" .
    Initially we are able to get the context and working fine...But, If the Server
    left idle for some time(approxmately 30 min)...after that it is not able to get
    the Context and more over I'm not able to PING the WebLogic also...After that
    the server not at all pinging....!!And in the log files it is not showing any
    errors.
    Environment:
    SPARC,Solaris7,WebLogic5.1 with Sp6,
    Java version 1.3.0.
    Any one Please help me...!!
    Thanks in Advance,
    Raja.

  • When i download any file it start in a second but when i pause the downloading file & after some time when i open it amessage flash 'download error' source file could not be read please try again later or contact the server administrator.

    when i download any file it works frequently and downloading start in a second but when i pause the downloading file & after some time when i open it,The downloading not start proper and after some time a message flash 'download error' source file could not be read please try again later or contact the server administrator.

    I downloaded the Microsoft Autoruns package and ran it.  There are no programs in the LSA Providers tab, and Apple's Bonjour is the only program in the Winsock Providers tab.  I also did the "netsh winsock reset" and rebooted.  It didn't fix the problem.  Any more ideas?

  • Socket connection dies after some time being idle w/o firing event

    Hi,
    I use this code to connecto my server from my Client
              if (socket == null){
                   try{
                        if (pwd.length > 0)
                             System.out.println("opening connection...to "+host+" at port "+port);
                             socket = new Socket(host, port);          
                             toServer = new ObjectOutputStream(socket.getOutputStream());
                             fromServer = new ObjectInputStream(socket.getInputStream());
                             System.out.println("Connection established!");
                             fireClientEvent(new ClientEvent(this, ClientEvent.CONNECTION_ESTABLISHED, ""));
                             this.connected = true;
                             Hashtable<String, String> table = new Hashtable<String, String>();
                             table.put("action", "login");
                             table.put("key", convertToString(pwd));
                             sendObject(table);
                   }catch(IOException e){
                        try{
                             if (socket != null)
                                  socket.close();
                             System.out.println("Error while connecting... Server does not exist!");
                             this.connected = false;                         
                             fireClientEvent(new ClientEvent(this, ClientEvent.SERVER_DOES_NOT_EXIST, getHost()+":"+getPort()));
                        }catch(IOException x){
                             System.out.println("I/O ERROR @ CLIENT CONNECT!");
                             removeAllListeners();
                             x.printStackTrace();
              }And this is how my server responds to client requests:
         public void run()
              ServerSocket server = null;
              Socket socket           = null;
              Hashtable<String, String> ClientInfo = new Hashtable<String, String>(); 
              try{
                   server = new ServerSocket(getPort());
                   //listen for connections
                   while (!stopServer)
                        try{
                             System.out.println("Starting Server at port: "+getPort());
                             socket = server.accept();
                             ClientInfo.put("remoteip", socket.getInetAddress().toString());
                             fireServerEvent(new ServerEvent(ClientInfo, ServerEvent.CONNECTION_REQUESTED, null));
                             ThreadedSocket tsocket = getThreadedSocket(socket);
                             tsocket.addSocketListener(this);
                             tsocket.setMaxSolvingTime(maxSolvingTime);
                             Sockets.add(tsocket);
                             executor.execute(tsocket);
                             fireServerEvent(new ServerEvent(ClientInfo, ServerEvent.CONNECTION_ESTABLISHED, null));
                        }catch (IOException ioe){
                             fireServerEvent(new ServerEvent(ClientInfo, ServerEvent.UNEXPECTED_CONNECTION_ERROR, null));
                             exceptionThrown(ioe);
              }catch(Exception x){
                   exceptionThrown(x);
              }finally{
                   try{
                        server.close();
                        socket.close();
                   }catch (Exception e){
                        exceptionThrown(e);
         }It seems that after some time (aprox. 10-15 minutes) being idle, my client gets disconnected withougt firing any event so the Server thinks the client is still connected but it does not get any messages because the client has closed the connection (I think)
    Am I doing/thinking something wrong?

    Thanks It seems that I am doing something completely wrong.
    I created this object:
    package main;
    import java.util.Hashtable;
    import java.util.Vector;
    public class SocketPinger implements Runnable {
        private Vector<ThreadedSocket> sockets = null;
        Hashtable<String, Object> action = new Hashtable<String, Object>();
        public SocketPinger()
            action.put("action", "scheduled_ping");
        public SocketPinger(Vector<ThreadedSocket> socks)
            this.sockets = socks;
            action.put("action", "scheduled_ping");
        public void run()
             process();
        public void process()
             if (sockets != null)
                  for (ThreadedSocket socket : this.sockets)
                       try
                            socket.sendObject(action);
                       }catch(Exception e){
                            sockets.remove(socket);
        public void setSockets(Vector<ThreadedSocket> socks)
             this.sockets = socks;
    }which I call with this command:
         public class ThreadScheduler
             private SocketPinger pinger;
             private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
             public void activate()
                 pinger = new SocketPinger(Sockets);
                 scheduler.scheduleWithFixedDelay (pinger, 5, 10, TimeUnit.SECONDS);            
             public void deactivate() {
                 scheduler.shutdown();
         }This makes the Scheduler object wake up every 10 secs and ping all the clients. This works and since then everything seemed to work fine. Today I noticed that when I shut down the client abnormaly (System.exit(0);) the server doesn't understand it. The sendObject() method works fine.
    This is my ThreadedSocket with the sendObject() method:
    public class ThreadedSocket extends Thread
         protected Socket socket;     
         protected ObjectOutputStream toClient;
         protected ObjectInputStream fromClient;
         protected ConnectionPool Pool;
         protected DBManager db;
         public ThreadedSocket(Socket sock, int priority, ConnectionPool pool) throws IOException
              socket = sock;
              this.Pool = pool;
              toClient = new ObjectOutputStream(socket.getOutputStream());
              fromClient = new ObjectInputStream(socket.getInputStream());                    
              setPriority(priority);     
              db = new DBManager(Pool);
         public void sendMessage(String message)
              try{
                   toClient.writeUnshared(message);
                   toClient.flush();
              }catch(Exception e){
         public void sendObject(Hashtable<String, Object> table)
              try{               
                   toClient.writeUnshared(table);
                   toClient.flush();
                   toClient.reset();
              }catch(Exception e){
         }and this is how I initialize the ThreadedSocket on my Server object
         public void run()
              ServerSocket server = null;
              Socket socket           = null;
              Hashtable<String, String> ClientInfo = new Hashtable<String, String>(); 
              try{
                   server = new ServerSocket(getPort());
                   //listen for connections
                   while (!stopServer)
                        try{
                             System.out.println("Starting Server at port: "+getPort());
                             socket = server.accept();
                             ClientInfo.put("remoteip", socket.getInetAddress().toString());
                             fireServerEvent(new ServerEvent(ClientInfo, ServerEvent.CONNECTION_REQUESTED, null));
                             ThreadedSocket tsocket = getThreadedSocket(socket);
                             tsocket.addSocketListener(this);
                             tsocket.setMaxSolvingTime(maxSolvingTime);
                             Sockets.add(tsocket);
                             executor.execute(tsocket);
                             fireServerEvent(new ServerEvent(ClientInfo, ServerEvent.CONNECTION_ESTABLISHED, null));
                        }catch (IOException ioe){
                             fireServerEvent(new ServerEvent(ClientInfo, ServerEvent.UNEXPECTED_CONNECTION_ERROR, null));
                             exceptionThrown(ioe);
              }catch(Exception x){
                   exceptionThrown(x);
              }finally{
                   try{
                        server.close();
                        socket.close();
                        if (scheduler != null)
                             scheduler.deactivate();
                   }catch (Exception e){
                        exceptionThrown(e);
              So I have to make this question unanswered, because it is actually partially answered. Although the server can wake up and ping the clients, I still find it difficult to see if the client really exists after some abnormal termination (i.e. computer dies, or sth similar).

  • After install snow leopard, ical does not show the events of some calendars

    After I install snow leopard, ical does not show all the events, or simple does not show the events of some calendars that I created.
    Can somebody solve this problem? Is there some update for ical?

    Try the following:
    1 - Go to your user account home folder, and open the library folder within it.
    Look for the folder named "Calendars" and inside you might find a bunch of different folders with weird names. If they are there that means your calendars might not be lost.
    2 - Look for the file "Calendar Cache". That file might be corrupted. Trash it. You may want to save a copy of it elsewhere. Once trashed, re-open ical. This should force it to rebuild its library based on those folders with weird names you saw. Your calendars should be back. Good luck

  • How can i Delete all foto from my iphone and after some time get them one more time on it but not as a new album :)?

    How can i Delete all foto from my iphone and after some time get them one more time on it but not as a new album, i want them in the camera roll ?

    How can I delete EVERY THING off my Mac and have it like new?
    Boot from the software install DVD and do an "erase and install" when prompted.

  • Why new contacts are not appearing after some time?

    I Am using iPhone6, iPad New and iPad mini. The contacts which I saved in iPhone are not appearing after some time. I don't know whether it is related with synchronisation of other devices. Please help me if you know the reason.

    Hi, 
    Have you checked the filtering option in contacts? Open contact menu button > filter. Perhaps you have a filter hiding the contacts. 
    What are your thoughts about this forum? Let us know by doing this short survey.

  • I've tried to update my ipad 2 with IOs 6 but it was not possible. An error message always appear after some time during e download. Is there an solution?

    I've tried to update my ipad 2 with IOs 6 but it was not possible. An error message always appear after some time during e download. Is there an solution?

    Are you trying to update via wifi or connected to your computer?
     Cheers, Tom

  • BC4j/JSP Application not responding after some time - when deployed on 9ias

    Hi,
    We are using BC4j/jsp application on 9ias. The application is not responding
    after some time. We have installed 9ias on PIII(384MB RAM). We tried to accesses
    with 10 users, and server is not responding to BC4J/JSP application.
    However the server could able to publish the JSP pages with standerad JDBC code even after that.
    many many thanks in advance
    null

    When the application deployed by BC4J/JSP not responding, does the sample JSP application still works? i.e. does any other application respond? Does 1 user respond? Is the database source (JDBC), running Oracle 8.1.7? What is the platform running the database (e.g. local NT database)?

  • BC4j/JSP Application not responding after some time - when deployed on 9ias BC4j/JSP

    Hi,
    We are using BC4j/jsp application on 9ias. The application is not responding
    after some time. We have installed 9ias on PIII(384MB RAM). We tried to accesses
    with 10 users, and server is not responding to BC4J/JSP application.
    However the server could able to publish the JSP pages with standerad JDBC code even after that.
    Please....help us.........
    many many thanks in advance

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Is there any mechanism that cleans up these connections (back down to the initial or some other minimum I would guess) or do they hang around until either the app server or database shuts down?<HR></BLOCKQUOTE>
    There is currently no mechanism for reducing the connection pool size after a period of high activity. Recently this has been frequently requested and as such will be implemented in the next production release.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>We have verified this in manual testing. However, when the load tool script exits it doesn't seem to release resources. We know this because we keep seeing our database connections go up and up as more tests are run. Further, we also seem to see more than one connection per "virtual user". For example, when I connect 5 users to the app in manual testing, I get 5 connections. But, when we run a test using the tool, we get 395 database sessions for 200 users. We are having a bit of difficulty understanding why the behavior is different.<HR></BLOCKQUOTE>
    Assuming that the you are performing your manual testing against the same instance of the application on which you are performing your load testing, I would assume that the connections are being released to the pool at the end of the request. One possible reason for the approximate 2:1 ratio between connections and virtual users may be BC4J's use of internal connections. What version of BC4J are you using?
    BC4J requires an internal connection to support state management and spill to disk. The internal connections are pooled with the transaction connection and only held for the duration of the persistence operation. However, if the web server is very busy then a large number of synchronous persistence requests may be received which would explain the eventual 2:1 ratio in the pool's high water mark.
    If the user start times and think times are staggered in order to reduce the incidence of synchronous persistence requests does the ratio of connections to web sessions stabilize at some lower number (i.e. 1.5:1)

  • HT1476 when i charged my iphone on y pc after some time showing charger not supported with this accessory what have to do to solve it

    when i charged my iphone on y pc after some time showing charger not supported with this accessory what have to do to solve it

    If you did not do a reset of your iPod please try that (you will not lose any data)
    Reset iPod touch:  Press and hold the On/Off button and the Home button at the same time for at least ten seconds, until the Apple logo appears.
    If this does not work inspect the opening in your iPod where the cable connects. Look for any debris and clean it (a magnifying glass may be required).

  • HT201412 i have facing a problem, my i phone is not workin properly, when i powered on then apper passcode window but after putting passcode then after some time automaiclly restart but from passcode window i can not enter further.

    i have facing a problem, my i phone is not workin properly, when i powered on then apper passcode window but after putting passcode then after some time automaiclly restart but from passcode window i can not enter further.

    Okay. You are not entering the correct passcode. If you forgot or it is not taking your passcode then you will have to restore.
    See http://support.apple.com/kb/HT4113

  • TS1814 i wana restore my iphone 3g but when i restore it with itunes after some time is say  '' iphone could not restored unknow error 1015 '' help me please

    i wana restore my iphone 3g but when i restore it with itunes after some time is say  '' iphone could not restored unknow error 1015 '' help me please

    99% because your iPhone was hacked/jailbroken. We cannot help you, see terms of use.
    Error 1015: This error is typically caused by attempts to downgrade the software for an iPhone, iPad, or iPod touch. This can occur when you attempt to restore using an older .ipsw file. Downgrading to a previous version isn't supported. To resolve this issue, attempt to restore with the latest iPhone, iPad, or iPod touch software available from Apple. This error can also occur when an unauthorized modification of the iOS has occurred and you're now trying to restore to an authorized, default state.

  • My new i phone 6 plus some time not connecting wifi after switching off it start and after some time gain its stop connection please advice

    my new i phone 6 plus some time not connecting wifi after switching off it start and after some time gain its stop connection please advice

    settings - general - reset - reset network settings.

  • The menu screen does not appear on the apple tv but after some time my photos appearing

    When I turn on my apple TV nothing come up but after some time my photo's from my iCloud account start to appear. Why would this be?

    Welcome to the Apple Community mecarroll.
    The following article(s) may help you.
    Troubleshooting AirPlay
    Troubleshooting Wi-Fi networks and connections
    Recommended Wi-Fi settings
    Wifi Diagnostic Software (for Mac users)
    You may also find some help on this page, where I’ve collected some of the more unusual solutions to network issues.

Maybe you are looking for

  • Will not load any page after upgrading to latest vesion.

    After upgrading to the latest version of firefox, my browser no longer loads any pages.

  • Opening illustrator cs3 file in Fireworks changes color, but not code

    I created a vector graphic in Illustrator CS3, with RGB. I then opened the file in Fireworks and everything looks fine because it's still vector. But the color is not right. It's close, but much lighter. The RGB values are exactly the same. Anyone ha

  • Samson C03U USB Microphone

    For some reason, my USB microphone is not being recognized by Logic Express...I had it working before but now nothing? The only options I see under my Core Audio prefs are Internal Microphone and Line-In? Any ideas why the mic isn't working now even

  • Customize bapi for sales orders with customer fields

    The situation is a following. Customer has added a structure on table VBAP. They used Append but without include. Now I have to make a BAPI that will be able to write on those fields. I have used several posts and documentation, but with on change :

  • Play To device error / libraries are showing up empty

    Media is not fine yet. When i try to use Play To another device (different Windows 7 pc) it fails. (failed to retrieve media information) The WMP instances are seeing each other and the libraries are showing up, but no Play to  The libraries are also