Saturday, March 22, 2014

Behave, alive.

After some months of proper procrastination, finally Behave has a raw working version:

https://github.com/Kieleth/behave

I decided the re-do the version I had previously, it was giving problems with latency in the capture and image processing. So, I cut short and simplified as much as I could.

Also the fact that OpenCv documentation online is back, helped a lot, some nice articles for basics:

http://docs.opencv.org/trunk/doc/py_tutorials/py_gui/py_video_display/py_video_display.html

http://docs.opencv.org/trunk/doc/py_tutorials/py_objdetect/py_face_detection/py_face_detection.html

At the moment it runs smoothly thanks to some minor tweaks in the face-detection call:

    #Recognition:
    scale_factor = 1.3
    min_neigh = 4
    flags = cv2.CASCADE_SCALE_IMAGE
    minSize = (200, 200)

    faces = face_cascade.detectMultiScale(gray, scale_factor, min_neigh,minSize=minSize, flags=flags)

Where:

    cv2.cv.CV_HAAR_SCALE_IMAGE: Scales each windowed image region to match the feature data. (The default approach is the opposite: scale the feature data to match the window.) Scaling the image allows for certain optimizations on modern hardware. This flag must not be combined with others.

  • scaleFactor – Parameter specifying how much the image size is reduced at each image scale.
  • minNeighbors – Parameter specifying how many neighbors each candidate rectangle should have to retain it.
  • flags – Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
  • minSize – Minimum possible object size. Objects smaller than that are ignored.
  • maxSize – Maximum possible object size. Objects larger than that are ignored

The idea is to find optimal parameters automatically using frame times, but that's another day's work :D

I'll be working in adding functionality and cleaning up the first version of the code (in exploratory mode still).



No comments:

Post a Comment