Hi,
my first post in this forum. I remember reading something about this topic some months ago, but I really could not find it anymore. So here my question.
I am working on a video installation using a kinect. In my project i use the SceneChanger component to change Scenes based on a timer. But this might not be relevant to the solution.
What I would like to achieve, is that the installation starts with playing a scene as soon as the first person enters the installation (and is detected by the kinect). And after a certain amount of time (let’s say 30 seconds) after the last person leaves (kinect detects no persons), the processing stops.
Any ideas on how to achieve this?
Thanks
Hello,
It depends on what you call “detection”.
– with skeleton, you can say that if someone is detected, there is a detection, so you can use a select Chop after the kinect Chop and wait for one person detected.
– with depth kinect top, using image analysis (treshold etc.), you can detect something is moving and that is “detection”.
– with point cloud kinect top and glsl top, you can analyse 3D image and “detect” presence and movement.
But you need to be more precise about the conditions of “detection” (space, light, distance etc.).
Jacques
Hi Jacques,
thanks for your reply.
I use a kinect chop for the detection. What i ended up doing (and it works) is using a timer chop with a length of 15 seconds, cycle on, and on done = Re-Start.
I then wrote some python code for the onCycle Event. I have a non interactive scene (id 9) that i want to start if no one is there.
No idea if something similar could be achieved without writing code, but this seemed the most straighforward manner to me.
Best,
def onCycle(timerOp, segment, cycle):
kinect_top = op('/project1/scenes/kinectChop')
chanel_names = ['p1/id', 'p2/id', 'p3/id', 'p4/id', 'p5/id', 'p6/id']
someonethere = False
for chanel_name in chanel_names :
channel = kinect_top.chan(chanel_name)
if channel is not None:
# Get the value of the channel at the current frame
value = channel[0]
if value != 0:
op('text1').par.text = 'Someone there'
someonethere = True
if someonethere == False:
op('text1').par.text = 'Noone there'
op('sceneChanger').par.Nextscene = 9
else:
op('text1').par.text = 'Someone there'
count1_done_channel = op('count1')['done']
op('sceneChanger').par.Nextscene = count1_done_channel
return
Here is another approach that is more generic:
Use a selectCHOP with channel names parameter set to p*/id
to select all channels that follow that schema. (So, basicly p1, p2, etc.)
Then, use a mathCHOP to add all channels together. This means, as long as there is any ID the value is > 0.
This means you can now use a chopExecuteDAT to react to a change. Using “onOffToOn” (0->x) will give you the event for someone entering and onOnToOff (x → 0) the event if someone should leave.
You could go one step further and implement a proper state-mashine (In some way it already is one.). This would be a much higher initital setup, but results in a much more reliable runtime!
Oh, thanks so much!!! Using the chopExecuteDAT and MathChop sounds great, will change my setup to this solution.