Asked — Edited

Camera Facedetection Threadable?

Hello all,

I have a question concerning the camera usage in visual studio 10, C#.

Is it possible to use this with a thread?

The problem is that my program is starting to run very very slowly when the camera is activated for facial detections

This is my code



            if (!ezb.Camera.IsActive)
			{
				return;
			}

			ObjectLocation objectLocation = ezb.CameraFaceDetection.GetFaceDetection();

			if (!objectLocation.isFound)
			{
				turnAway = true;
				timer2.Start();
				timer4.Stop();
				timer4.Dispose();
			}

			if (objectLocation.isFound)
			{
				interactie();
				textBox1.AppendText(Environment.NewLine);
				textBox1.AppendText("Face found");
				textBox1.AppendText(Environment.NewLine);
			}


When the program sees a face it goes to the method "interact();" or in English "interaction();"

But then the program seems to halt and running slowly

Thanks in advance for the help.

Cheers,

Laurens


ARC Pro

Upgrade to ARC Pro

Synthiam ARC Pro is a new tool that will help unleash your creativity with programming robots in just seconds!

PRO
Synthiam
#9  

Everytime you run interaction(), there is a new method being assigned to the event. By adding multiple methods, there will be multiple peices of code executed one on command. The stack wiill continue to build up and up.

ZIP up your project file and attach it. i'll take a look at it if i have a moment

#10  

Please see the attachment.

And thank you for your help!

V6.zip

EDIT:

NOTE: that when you say "sing" the speaker that is connected to the EZ-B Board starts to play. But whenever you can go out the loop of the speech recognition/ synthesis, the speaker starts to play the random tones

#11  

Hi, I've cleaned up the code and the code is once again better then before. Now we only have 1 problem, and that problem is when you say "resume" to the robot to continue on his own ("automaton") the robot won't start.

When I debug the code I see that the code returns to the "SpeechSynth_OnPhraseRecognized(, )" method, however in the method for resuming the robot, it clearly states to start the timer

Enclosed is the project.

Thank you for your help!

V7.zip

#12  

Hey, I'm trying to make a camera scanner like the ping radar scanner. Not sure what I'm doing wrong here but I'm using the c# script editor that comes with the add control menu. I'm trying to read the face detection coordinates from the camera but am getting this error:

I'm able to read a servo position and have the machine speak it but the line of code to read the camera doesn't work. I don't have MS Visual Studio or any other compilers so I'm trying to familiarize myself with the that script editor being that I don't see any commands in the EZ-Script for reading from the camera etc. Prior to my most recent update, I used another program that would read from the debug window for face detection data and then it would manually move the controles in the ARC. But the Float controls option has now been removed. But learning the other scripting methods seemed easier in the long run.

using System;
using System.IO;
using System.Windows.Forms;
using EZ_B;

namespace VName {

  public class VClass {

    public void Main(EZB ezb0, EZB ezb1, EZB ezb2, EZB ezb3, EZB ezb4) {

int servoPos = ezb0.Servo.GetServoPosition(Servo.ServoPortEnum.D5);
int Facewhere = ezb0.CameraDetection.FaceDetection.GetFaceDetection;
ezb0.SpeechSynth.Say("Servo 5 is at position " + servoPos.ToString());

ezb0.SpeechSynth.Say("Face Found at " + Facewhere.ToString());


}
}
}

Here's the error I'm getting: Cannot compile assembly. 1 Errors: Line: 13 - 'EZ_B.EZB' does not contain a definition for 'CameraDetection'

If anyone has some sample code that works in the ARC for reading the camera that will solve everything.

Thanks

PRO
Synthiam
#13  

I'll make an example for you:)

I removed the Float Windows because I didn't know anyone used it lol. Some people complained about it even being there. It caused more issues during development than it was worth.

#14  

Thanks a lot DJ. BTW I so love the auto positioner and now the dance routines... What a scream!

Something I do in cases like that when I remove features for our providers, I'll create a ctrl key command for those who ask, "where's my ?" I'll tell them to hit CTRL ALT F or something.

Best, Bill