Asked — Edited
Resolved Resolved by Dunning-Kruger!

How To Detect Face And Motion Using The If-Else Statement In The Ez-Script Edito

Earlier, I have asked about the coding of detecting the colours using the EZ-Script. bhouston gave a very good code and I made a coding of my own similar to what bhouston gave. The coding was working but camera gave flop results for eg. I show Blue, it detects as Green.

So, I tried to do the If Else statement for Face and Motion but I cant find their default variables. Can anybody here help me out?


ARC Pro

Upgrade to ARC Pro

Discover the limitless potential of robot programming with Synthiam ARC Pro – where innovation and creativity meet seamlessly.

United Kingdom
#1  

Have you tried adjusting the brightness and contrast settings in the camera control until it recognises the correct colour? Also is the room you are in when you try this bright enough for the camera to detect correctly?

United Kingdom
#2  

The camera will detect the colour it sees.

Which default values are you looking for? Try adding the variable watcher, this will give realtime feedback on all variables, including default values (when the project is first loaded).

#3  

@NYP.Shank_95 The variables for face tracking are in the same place as for colour track.... All that stuff is in the camera control under the variables tab....

#4  

Steve G, I have done that also. Its still the same result. However, when I used the same colour in Color & MultiColor trackingmodes, I have found that Color tracking mode gives much,much better result than the MultiColor.

United Kingdom
#5  

Multicolour should give more accurate tracking if you set it up with the actual object in front of the camera... it'll display what's detected on the screen. You wont get more accurate than that (and the control for multicolour gives more options too).

United Kingdom
#6  

@NYP.Shank_95.

I have just seen your other thread about multi colour detection. When I initially set my camera up I had a couple of issues similar to yours at first. After playing around with the various settings, brightness, contrast ect, I ended up deleting the camera control from my project and selected a new camera control. I then did what Rich mentioned above by placing an object in front of the camera and adjusted the settings needed. After this everything worked fine and detection was pretty good.

In regards to your question regarding face and motion variables, I'm not quite sure what you are looking for, as Richard mentioned in post #4 all the variables needed are in the variables tab in the scripts menu. If it helps, I have supplied a script I use for motion tracking. Maybe what you are looking for is in there. :)


#Script for motion detection

$direction = 1
:START
ControlCommand("Camera", CameraMotionTrackingDisable)


IF ($direction = 1)
ServoUp(D19, 4)
ELSE 
  ServoDown(D19, 4)
ENDIF 
 
 
IF (GetServo(d19) > 100)
$direction = 0
ELSEIF (GetServo(d19) < 30)
$direction = 1
ENDIF 
sleep(1000)


ControlCommand("Camera", CameraMotionTrackingEnable)
$count = 0
:SCAN
IF ($count = 10)
goto(START)
ENDIF 


IF ($CameraIsTracking = 1)
SayEZB("Motion detected.")
Halt()
ENDIF 
sleep(500)
$count = $count + 1
goto(SCAN)

#7  

Hi Steve G, thank you for the immediate reply. I have done the face recognition if else statement by myself. I ll use the motion detect if else statement on my project and let you know ASAP if it works.

United Kingdom
#8  

No worries. Just remember to change the values needed such as servo ect, as the script above is set up for my bots head to turn left and right looking for motion.

#9  

Steve G, your D19 refers to which part of servo?

United Kingdom
#10  

D19 is the EZ-B port I have my servo connected to, that does the camera tracking movement (Sweeps from left to right until motion is detected).

#11  

I mean is it the head or hands or legs? & which robot r u using in this?

United Kingdom
#12  

Sorry I misunderstood you. It's for the neck/head (repeatedly looking left to right) on a custom made robot, but that shouldn't matter. Same princable applies. I see in your other thread that you have finished your smart camera project. So I take it you got everything working on ARC the way you wanted to in the end?