Project Type
Languages/Packages Used
Primary Roles
Main Skills Developed
|
Personal Project
C++, SQL, OpenCV, wxWidgets, SQLAPI
Everything - this was a solo project.
C++, SQL, Technical Knowledge especially that of external packages used (OpenCV, wxWidgets, SQLAPI) and databases.
|
I've always found computer vision extremely interesting and so I wanted to research it and begin learning how to use it in my own projects. Therefore, I decided to make a CCTV system that could detect and store faces! I decided to use C++ as this was the language I was learning at the time, and due to it's tight integration with the OpenCV package. I started by creating just a facial detection program, and then eventually connected it to a database so that it could store images remotely. After, I developed a UI using the wxWidgets package and had a working program!
Please note that I have considered the ethical and legal issues associated with this project and so have not used it on anyone other than myself. It is merely a proof of concept - not something to be actually used.
Please note that I have considered the ethical and legal issues associated with this project and so have not used it on anyone other than myself. It is merely a proof of concept - not something to be actually used.
This is the first screen the user is presented with.
This screen shows the current camera output as well as some statistics. This is where the face detection takes place (this is done on a separate thread to avoid slowing down the camera stream). Please excuse my less than ideal camera quality! The face detection itself is done using Haar Cascades. Going forwards, I may investigate other face detection methods to broaden my knowledge.
The user has the option to go back and look at the faces that the system has discovered when the camera was on.
Once the program is closed, locally stored faces are uploaded to a database, like so:
Here we can see the nine face photos captured above in the database. They are stored as the type 'longblob'. If I had more time I would investigate a way of uploading the image to a server and having the database hold a link to that image, as this would take far less room in the database itself. This solution works in the meantime however.
Finally, this is the program running on a separate machine. As we can see, it has connected to the database, downloaded the faces and is displaying them accordingly!
Challenges faced during development
This project is quite different from my other projects in that it is not focused on games. Therefore, this project brought many challenges, with the main one being the challenge of integrating OpenCV and wxWidgets together. Being two completely separate packages, they did not have much integration at all. I spent a long time researching and trying different methods to convert between one and another, and eventually found some solutions (with some online help along the way). In the end, I made various conversion functions from one software package to another. This made it easy to convert from (for example) OpenCV's Mat type to wxWidgets' wxImage and back again.
Additionally, with facial detection being a computationally expensive task, it would introduce a large delay every time the computer tried to detect faces in an image. This meant that my program would freeze every 2-3 seconds while it tried to find faces. As mentioned previously, I solved this by multithreading the program, so that the facial detection was performed on a separate thread, therefore removing the freeze and performing the face detection without the user noticing any slowdown.
Finally, one of the most challenging parts was integrating the database aspect. I had barely used databases before, and so everything to do with SQL was new to me. I quickly found the resource 'freesqldatabase.com' which provided a free database for anyone to use quickly and easily. I set up my database on this, researched SQL and SQLAPI and eventually created my database integration. While this part was difficult for me due to the use of new packages, languages and concepts, I learned a lot and was very happy with the software I had created. While I understand that there is always much more to learn, I am happy that I am now able to perform basic database functions from C++.
Additionally, with facial detection being a computationally expensive task, it would introduce a large delay every time the computer tried to detect faces in an image. This meant that my program would freeze every 2-3 seconds while it tried to find faces. As mentioned previously, I solved this by multithreading the program, so that the facial detection was performed on a separate thread, therefore removing the freeze and performing the face detection without the user noticing any slowdown.
Finally, one of the most challenging parts was integrating the database aspect. I had barely used databases before, and so everything to do with SQL was new to me. I quickly found the resource 'freesqldatabase.com' which provided a free database for anyone to use quickly and easily. I set up my database on this, researched SQL and SQLAPI and eventually created my database integration. While this part was difficult for me due to the use of new packages, languages and concepts, I learned a lot and was very happy with the software I had created. While I understand that there is always much more to learn, I am happy that I am now able to perform basic database functions from C++.
Source Code
The source code to this project can be found here:
WillRose6/FaceDetectorCCTV (github.com)
WillRose6/FaceDetectorCCTV (github.com)