0

I'm building an attendence check system using face recognization technique. So far I can detect and recognize the face from the camera and terminate the program after the recognization.

I want to let the program wait 2 seconds after the camera initialize, as the accuracy of face recognization is poor in the first two seconds(caused by abnormal brightness etc.). Adding a count down or similar method might help, but I don't know how to achieve. Could anyone give me some hints? My code is a little bit long. I will edit the question if anyone want to see the code. Thanks a lot!

Miki
  • 40,887
  • 13
  • 123
  • 202
newinjava
  • 27
  • 6

1 Answers1

0

Question is if you have some experiences via (multi)threading. One way is to freeze actual thread (put it after all init method of camera done):

Thread.currentThread().sleep(2000);

If you will face problem that all going to freeze and you dont want, you have to split your code to more thread and sleep only one or some thread you need.

Majlanky
  • 198
  • 2
  • 9
  • just tried to sleep the thread for 2 seconds, but it seems the whole programe freeze 2 seconds. My target is to run the camera first, and grab the face rectangles after two seconds. I guess I have to learn more about multi threading. Thanks for your reply! – newinjava Dec 12 '17 at 09:05
  • No problem. It is good attitude. One hint i can give you is to create new Thread for camera initialization and sleep it. The rest of program you let run in different thread... – Majlanky Dec 12 '17 at 09:17