Head detection using depth map - kinect

This is my first interaction with kinect xbox, i have to count the number of people getting in and out from a door, what i have learned to do is to get a depth map,
Detect the top of head closer to sensor and track it
Increment/decrement count when head crosses a specifuc region
I am able to get the depth image, but totally blank that how would detect head from depth image.
I am using xbox 360 kinect, and Kinect for windows SDK v1.8 in c#
Thanks in advance

Kinect SDK by default gives you the coordinates for body part tracking, such as the head. Also, the SDK can track up to 2 individual people (for Kinect v1 / SDK 1.8) and 6 different people (for Kinect v2 / SDK 2.0).
For starters, you can get the location of the head as reported by the SDK and count when it crosses the region maybe? Simply search for Kinect Head tracking and you can see that it's easy to locate the head in a scene using the SDK (instead of a depth map directly).
An example for the 1.8 SKD is given here.

Related

Defining a tracking area for the Kinect

Is it possible to specify a (rectangular) area for skeleton tracking with the Kinect (using any of the available SDKs)? I want to make sure that only users inside that designated area are tracked and that the sensor is not distracted by people outside it. Think of a game zone, in which a player interacts with the Kinect and where bystanders outside of the zone should be ignored lest they confuse the sensor.
The reason I want this is that many times the Kinect "locks" onto someone or even something, whether it should or not, and then it's difficult for the sensor to track other individuals, who come into tracking range. I want to avoid that by defining this zone.
It's not possible to specify a target area for the skeleton tracking with Microsoft's official SDKs, but there are some potential workarounds.
(Note that I'm not familiar with other SDKs for the Kinect, and note that I'm not sure if you are using the Kinect v1 or v2.)
If you are using the Kinect v1, note that it can track 6 players simultaneously (with a skeleton body position), but it can only provide full-body skeletal tracking for 2 players at a time. It's possible to specify which 2 players you want full skeletal tracking for in the official SDK, and you can do this based on which skeletons are in your target game zone.
If this isn't the problem, and the problem is that the Kinect (v1 or v2) has already detected 6 players and it can't detect a 7th individual that's in your game zone, then that is a more difficult problem. With the official SDK, you have no control over which 6 players are selected to be tracked. The sensor will lock onto the first 6 players it finds, so if a 7th player walks in, there is no simple way to lock onto that player.
However, there are some possible workarounds that involve resetting the sensor to clear all skeletons to re-select the 6 tracked skeletons (see the thread Skeleton tracking in crowds - Kinect v2):
Kinect body tracking is always scanning and finding candidate bodies
to track. The body tracking only locks on when it detects head and
shoulders of the person facing the camera. You could do something like
look for stable blob points in the target area and if there isn't a
tracked body, reset the Kinect Monitor service.
The SDK is resilient to this type of failure of the runtime, but it is
a hard approach. Additionally, you could employ a way to cover the
depth camera (your hand) to reset the tracking since this will make
all depth/ir invalid and will need to rebuild.
-- Carmine Sirignano - MSFT
In the same thread, RobAcheson points out that restarting the sensor is another workaround:
I've been using the by-hand method successfully for a while and that
definitely works - when I'm in the crowd :)
I have started calling KinectSensor.Close() and KinectSensor.Open()
when there are >6 skeletons if none are in the target area. That seems
to be working well too. Now I just need a crowd to test with.
-- RobAcheson

Finger Position Detection using Kinect

Are there any open libraries or opensource codes available for finger position detection using Kinect ?
I have tried searching OpenNI and other libraries for Kinect but could'nt find one.
I was looking into this a few years ago, you can check out this post from then which includes a few options.
Links may be a bit outdates, for example Apple bought OpenNI, so the Forth ICS project can now be found here
You didn't mention which version of the kinect, so I'll assume it's the original kinect for xbox 360.
If you're not constrained to using kinect only, you might actually want to try the Intel RealSense SDK as it already includes hand tracking(pdf tutorial link) and the c++ sdk has wrappers for c#/java and makes the data available through websockets.

Why does Kinect2 Fusion produce worst results, then Kinect1?

At my university we have several Kinect 1's and Kinect 2's. I am testing the quality of the Kinect Fusion results on both device and unexpectedly Kinect 2 produces worst results.
My testing environment:
Static camera scanning a static scene.
In this case if I check both results from Kinect 1 and 2, then it looks like Kinect 2 has a way smoother and nicer resulting point cloud, but if I check the scans from a different angle, then you can see the that Kinect 2 result is way worst even if the point cloud is smoother. As you can see on the pictures if I check the resulting point cloud from the same view as the camera was, then it looks nice, but as soon as I check it from a different angle then the Kinect 2 result is horrible, can't even tell that in the red circle there is a mug.
Moving camera scanning a static scene
In this case Kinect 2 has even worst results, then in the above mentioned case compared to Kinect 1. Actually I can't even reconstruct with Kinect 2 if I am moving it. On the other hand Kinect 1 does a pretty good job with moving camera.
Does anybody have any idea why is the Kinect 2 failing these tests against Kinect 1? As I mentioned above we have several Kinect cameras at my university and I tested more then one of them each, so this should not be a hardware problem.
I've experienced similar results when I was using Kinect for 3D reconstruction. Kinect 2 produced worse results compared to Kienct 1. In fact, I tried the InfiniTAM framework for doing 3D reconstruction. It too yielded similar results. What was different in my case compared to yours was that I was moving the camera around and the camera tracking was awful.
When I asked the authors of InfiniTAM about this, they provided the following likely explanation:
... the Kinect v2 has a time of flight camera rather than a structured
light sensor. Due to imperfections in the modulation of the active
illumination, it is known that most of these time of flight sensors
tend to have biased depth values, e.g. at a distance of 2m, everything
is about 5cm closer than measured, at a distance of 3m everything is
about 5cm further away than measured...
Apparently, this is not an issue with structured light cameras (Kinect v1 and the like). You can follow the original discussion here.

Kinect Infrared Camera Not working

I am using the Kinect 2 with the newest available SDK version 2.0. Everything works except IR, tested it with both SDK infrared demo example and Kinect Studio, both result in a black screen. I also looked at the code and capturing Kinect IR frames does not result in any errors, it just consists of all minimum values.
This is quite weird, as I thought IR was used to calculate depth and I can successfully read depth information. Also, I checked (with my cellphone camera) that the IR emitter is turned on and off correctly, just data is not received correctly for some reason.
After encountering the problem I made a fresh install on another computer, as I suspected I had broken my system somehow. I got exactly the same results after installing Kinect SDK. Everything except infrared works.
Has anyone seen this kind of behaviour before?
check this out
https://social.msdn.microsoft.com/Forums/en-US/70dcceb7-8d2f-485f-b3e9-f2d4b399fbe7/kinect-v2-infrared-not-working?forum=kinectv2sdk
try updating graphics card drivers

Can the Kinect SDK be run with saved Depth/RGB videos, instead of a live Kinect?

This question relates to the Kaggle/CHALEARN Gesture Recognition challenge.
You are given a large training set of matching RGB and Depth videos that were recorded from a Kinect. I would like to use the Kinect SDK's skeletal tracking on these videos, but after a bunch of searching, I haven't found a conclusive answer to whether or not this can be done.
Is it possible to use the Kinect SDK with previously recorded Kinect video, and if so, how? thanks for the help.
It is not a feature within the SDK itself, however you can use something like the Kinect Toolbox OSS project (http://kinecttoolbox.codeplex.com/) which provides Skeleton record and replace functionality (so you don't need to stand in front of your Kinect each time). You do however still need a Kinect plugged in to your machine to use the runtime.