I'm working with live video processing.
My problem is that I want to call a method and inside this method I want to have a loop that runs every frame just like Update() but after a defined time I want to break the loop and return something.
I know that there is a while loop but as far as I know, this loop does everything in just one frame and that's not quite what I'm searching for.
Does anybody have a solution? I added a small example (not real code) to clarify what I mean.
public void DetectFace()
{
int detectedFaces = 0;
Vector2 nosePos;
//loop that calls once a frame, I used while for demonstration
while (detectedFaces < 10)
if (FindFace())
{
detectedFaces++;
nosePos = GetNosePos();
}
else
{
detectedFaces = 0;
}
return nosePos;
}
↧