• OpenCV Exploration: Speeding up the Detect

    Ben Hoff04/17/2015 at 16:16 0 comments

    Hey I wanted to spend some time talking about what I did during this stream, but more importantly the logic of what I did. I think as we program some things become intuitive to us that aren't to the casual beginner, and since it's intuitive it's hard to explain using words.

    I had a camera class. Towards the beginning of the stream, I mentioned that the camera class was too "smart". What I meant by that was it was responsible for too many things. My camera class at the beginning of this stream was responsible for not only handling the camera feed (whether it be from a webcam or a video file) but also for handling the face detection logic. For what I'm trying to do these are two large pieces of functionality that should not be in the same class. For a smaller project that is scoped narrowly, this would be fine. But because I plan to use this code base to explore the OpenCV libraray, I need all of my classes to be as extensible (which means able to be added to/built upon) as possible.

    The problem with having too many large pieces of functionality in the same class is they become intertwined in weird ways that make a lot of sense at the time, but eventually become a chore to add on top of or to swap pieces out. So knowing that the haarcascade method for facial recognition is inherently slow and I'll want to look at different methods for doing the facial recognition, it becomes imperative to isolate the facial recognition logic in it's own class so that I don't have to untangle that logic out of a bloated camera class later down the road.

    This doesn't make sense all the time. If you're writing a quick script, or a program that is going to do one thing and one thing only, you're better off not breaking up your program because it's only going to make the logic harder to follow. So keep that in mind!

    Anywho... here's the first commit: https://github.com/benhoff/opencv/commit/086bf8c50d598db147dae5466c3484fc4586ba42

    and the second: https://github.com/benhoff/opencv/commit/edbe725800ffc730f589562ebaec12bc215fb36a

    and you can browse the files up to the end of this commit here: https://github.com/benhoff/opencv/tree/edbe725800ffc730f589562ebaec12bc215fb36a


  • OpenCV explorations, adding in ability to record from videofile

    Ben Hoff04/17/2015 at 16:14 0 comments

    Added in the ability to use either a video camera or a video file as our facial recognition source. You can select the video file from the GUI.

    Here's the latest commit for your browsing pleasure!


    and the video stream:


  • Working demo

    Ben Hoff04/10/2015 at 02:10 0 comments

    I fixed all of the bugs and added in a very basic camera selection methodolgy. I'll only promise that it'll be slightly functional on linux.

    I spent some time looking at the facebook api in hopes that it would be able to grab your friends photos in order to train a haarcascade. This is apparently not a thing. The best you can do is grab all of your photos and maybe make sure that it recognizes you. That is the next plan.

    I hope to eventually incorporate openBR into this project but could not get it to play with Qt 5.4 and openCV 3.0 beta.

    latest commit is here:


    Here's the video:


  • Captains Log

    Ben Hoff04/06/2015 at 01:54 0 comments

    So I spent six hours working on this with the viewers from the subreddit /r/WatchPeopleCode.

    I got to the stage where the GUI that I'm building to test out some OpenCV features will compile, but the functionality isn't working. Plans for the next stream will be to get the ability to select camera sources dynamically as well as fixing the file path loading for the haarcascade files. Browse the current code as of this post can be browsed here:


    Dependicies include Qt 5.4 and OpenCV 3.0 Beta.

    I'm looking for collaborators! Pull requests are welcome on github, you can find me on Reddit as /u/beohoff or here.

    The stream is located here: