All Tutorials / JustinRatliff / Use Camera As A Button

Use Camera As A Button

Description

You can use a Camera in EZ-Builder as a button without any external code. I created a custom multicolor named "Dark" and set it a orange/red range and I set it to the maximum size for detection. This is what worked best for me as I discovered the orange/red color range was reflected off my hand as it moved toward the camera to block the view. I started out using the darkest shade of blue possible but...

Controls

This tutorial uses the following controls. Select a control to view the manual page.

Step 1

You can use a Camera in EZ-Builder as a button without any external code. I created a custom multicolor named "Dark" and set it a orange/red range and I set it to the maximum size for detection. This is what worked best for me as I discovered the orange/red color range was reflected off my hand as it moved toward the camera to block the view.

I started out using the darkest shade of blue possible but that color did not perform as well for me. I encourage you to experiment as skin tone, lighting conditions and even the type of camera will very from user to user.

Below is my script which I named CamBlocked It only looks for the $CameraObjectColor value to change and so this scripts acts as a sort of "hair trigger".

Code:


#updated 7/21/14
$CameraObjectColor = ""

:Start
IF ($CameraObjectColor = "Dark")
ControlCommand("Bender Sounds", Track_19)
sleep(500)
ENDIF

$CameraObjectColor = ""
sleep(500)

goto(start)



The line below is the action I have chosen to perform when my "Dark" multicolor object is detected.

Code:

ControlCommand("Bender Sounds", Track_19)



Video Tutorial:



Here is an alternative take on the script. Rich's modified script uses the WaitForChange function and $CameraIsTracking value. My tests showed that I had to wave my hand slowly more closely in front of the camera for 1-3 seconds in order to trigger the event.

Code:


#from Rich 7/21/2014
$CameraObjectColor = ""
WaitForChange($CameraObjectColor)

:Start
IF ($CameraObjectColor = "Dark")
ControlCommand("Bender Sounds", Track_19)
EndIf

WaitForChange($CameraIsTracking)

$CameraObjectColor = ""

WaitForChange($CameraObjectColor)

Goto(start)



If you test the two scripts, please let us know the results.

Steps