# Moving objects with hand detection

**URL:** <https://discourse.processing.org/t/moving-objects-with-hand-detection/10999>\
**Category:** Libraries\
**Created:** [May 7, 2019, 1:14pm UTC](https://discourse.processing.org/t/moving-objects-with-hand-detection/10999 "2019-05-07T13:14:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxcvbs](https://avatars.discourse-cdn.com/v4/letter/z/ecae2f/32.png) [@zxcvbs](https://discourse.processing.org/u/zxcvbs)\
**Post date:** [May 7, 2019, 1:14pm UTC](https://discourse.processing.org/t/moving-objects-with-hand-detection/10999/1 "2019-05-07T13:14:11Z")

</div>

Hi, I’m trying to do something like this:

[![](https://img.youtube.com/vi/MIYt1yNwoZU/hqdefault.jpg "Optical Flow Exercise 7") ](https://www.youtube.com/watch?v=MIYt1yNwoZU)

Track each hand motion, and move objects around.

I can detect hand blobs with blob scanner, but there are too many blobs. And I don’t know how to differentiate each hand. Saw some videos using optical flow but don’t know how to apply individual zones to move objects.  
I read something about lk optical flow but I’m lost. Thanks

---

<div class="post-metadata">

**Author:** ![zxcvbs](https://avatars.discourse-cdn.com/v4/letter/z/ecae2f/32.png) [@zxcvbs](https://discourse.processing.org/u/zxcvbs)\
**Post date:** [May 10, 2019, 3:57pm UTC](https://discourse.processing.org/t/moving-objects-with-hand-detection/10999/2 "2019-05-10T15:57:12Z")

</div>

Update, I adapted some code from [https://www.apress.com/gp/book/9781484227749](https://www.apress.com/gp/book/9781484227749)  
Chapter 6\_07:  
[https://github.com/Apress/pro-processing-images-and-computer-vision-opencv/tree/master/Chapter%206/Chapter06\_07](https://github.com/Apress/pro-processing-images-and-computer-vision-opencv/tree/master/Chapter%206/Chapter06_07)

Basically it creates blobs on motion detected change between two frames.

I mapped those x,y blob position coordinates to a rectangle that has an arrive function.  
But i cannot make it to work well, it moves the rectangle but it doesnt get fixed to that position, just wanders through all the screen.

I just want to associate detected blobs with a moving object, that in case if the blob dissapears it would stay in the last blob position, and just if it is near that blob area.  
My idea is to use 2 objects one for each hand, and move one or another only if it is nearby the detected movement area.

here is the code:

> **[zxcvbs/processing](https://github.com/zxcvbs/processing)**
>
> Contribute to zxcvbs/processing development by creating an account on GitHub.
