Detecting range proximity to screen

anxo's icon

Hello I am trying to do a video piece in wich the distance of the viewer from the screen will trigger 3 sounds, I tried several ways I was trying with arduino and a sonar sensor but the readings of the(multiples) sonar where no consistent and did not cover distance enough for (soft objects) people.
After this I was trying to do it with a camera and positioning the camera on top of the screen and reading the height and trigger a sound depending on the height reading.(for that I was using an example of this list that was using background substraction, I am still learning jitter), i thought this was the best method to detect short distance when you cannot control the whole room.
My problem is that I would like to achieve the same thing without the background substraction to just make it work easier in any type of enviroment.
Basically I would like to be able to cut the screen capture in 3 horizontal spaces, and make each triger a different sound, being the top the one wich cancels the rest and the second will cancel the first.
I was going a litle bit crazy trying to achieve this, and I really appreciatte if somebody could post an example of something similar to this.
thanks.

MIB's icon

maybe something like this...

Max Patch
Copy patch and select New From Clipboard in Max.

hope this helps point you in the right direction

anxo's icon

Hello I just saw your patch just now, thank you very much for the help it means a lot, sometimes trying to figurate everything by yourself is really difficult.
I did not have time to study it I am going to do it right now, one thing is I was thinking to split the screen in horizontal lines instead of vertical ones. Just from when I open it I had the impression that i could fix that changing the 3 jit.submatrix dimensions and offset.and also in the p lcdDrawing, Am I correct about this?.
I notice that in the lcddrawing patch the framerect numbers are the same than the offset numbers in the jitsubmatrix but the dimensions numbers are different I would try to check in jitsubmatrix help and in jitLcd help to see if there is a difference there.
But if you have a hint about this it would be welcome.
thanks again for the help.

MIB's icon

you got it. just be careful about the numbers... submatrix and lcd have different ways of defining size and location as you already noticed!! I think the help files will be your friends on this one.

I would be interested to see what you come up with so keep posting patches and ask questions!!

anxo's icon

thanks a lot for your help,