I had same problem. I think it is caused by MATLAB not recognizing Kinect. In my case, I do:
1. Connect Kinect to PC before running MATLAB/Simulink.
2. In Matlab run mux -setup and SETUP_KINECTSDK again.
3. Open Simulink.
I really appreciate your fast response. Thank you for advice.
I am throwing 80 mm ball which is about 2.5m/3m away from Kinect. As you advised, I tried throwing bigger object and it worked. Now depth camera can recognize and obtain correct Z coordinate of my flying object (I don't have bigger ball at the moment, so I used box).
(Size of throwed box: 240mm x 120mm x 80 mm).
Thank you very much for your help. You gave me fast and good solution for my problem which I was trying to solve for a big amount of time.
I only regret that I haven't asked you for help sooner, I would save a lot of time.
Thank you again.
Thank you for your fast reply, I really appreciate that you have found a moment for my problem.
I have looked at those check boxes and they are ON at all times. Also looked at sample that you recommended. I noticed that X, Y, Z coordinates of Depth are received form NID Depth block. In my program, for ball recognition and obtaining it coordinates, I am using Blob Analysis (Centroid) (just like in your "nid_cvst_pattern_tracking.mdl"). It gives me X and Y coordinates in pixels. In next step, I take those X,Y coordinates and use them to find Z coordinate form Depth data (output form NID Depth is given as "Depth").
Despite of usage "Adjust view point to Image", sometimes (especially in parallel to X axis throws) my Z coordinates are wrong.
Is it possible that coordinates from RGB image are not accurate enough, or Depth image has some kind of Delay ( maybe weak PC ) ?
I could use X,Y,Z coordinates from NID Depth block but in that case, I have severe fps drops, so fast flying ball is not recognized.
I have made system that can recognize red ball and calculate its trajectory. During tests, I noticed something: RBG image and Depth image are not well synchronized. It doesn't make much difference when I am throwing ball towards Kinect, but when ball is flying parallel to X axis, it is a problem. Z coordinates of ball are collected by mean of X and Y coordinates form RGB image. In this case, my Z coordinate colected forom Depth data is all wrong. Here is an image that will help you understand my problem:
Can you advise any solution ?
Thanks in advance,