In this article, I would like to introduce the source code of face recognition from webcam images shared from https://thigiacmaytinh.com/ . This is a very useful website to help develop your application.Source: https://thigiacmaytinh.com/
The program uses module FaceComp< /a> to recognize faces from webcam images.
Content (Nội dung chính)
1. Working principle
Each person will look at the webcam, the computer will automatically or manually identify whether this person has ever appeared. If you do not appear within the allotted time, the machine will give you rice.
After shooting, if the rice output conditions are satisfied, the software outputs a signal through the Arduino Nano circuit, which controls the relay for current to flow. In the software, there is a code to automatically detect the circuit board and control the signal to the board.
- Visual Studio 2015 or later
- C++ redistributable 2015 x64
- Download source code: targetK7CfVSSo”>reliano_fVS”>
- Arduino Nano and Nano USB cable
- Relay SSR-40-DA 3~32VDC FOTEH
3. Build software
After successful build, the software interface is as shown below
When operating the program will have the following processing flow:
- Take a picture from the webcam and save the jpg image to folder temp
- Extract the face feature (landmark) and save it as a *.bin file of the same name with images
- Feature comparison with images in folder images
- If no one is in the library, assign a new code
- If it already exists, calculate the number of days and update the time
- Move the image file & landmark .bin file into the folder corresponding to that person’s code
If your build fails, you can go to folder bin/Rice_ATM-x64/ run the program Rice_ATM.exe we built it. p>
The program uses database SQLite to store the photographer’s information.
4. Relay opening and closing circuit
The software automatically finds the COM ports to see which port the Arduino is connecting to. If detected, Arduino board will automatically connect to send signal.
You need to load the Arduino code to receive the signal from the computer to send it down, I convention that when there is an O (OK) character, the signal will be output to pin A0. When the A0 pin outputs a signal, it will generate a voltage of 5V to trigger the solid relay SSR-40-DA to generate rice.
Relay SSR-40-DA is a type of relay for AC power (220V residential). If you use 12V/24V DC power, you can use relays SSR-40-DD
Depending on the type of motor, it can be replaced with other suitable relays
- Install the Arduino Nano CH340 driver
- Load the code for the Arduino Nano in the folder Rice_ATM/Arduino/trigger_relay
- Connect the wires similar to the picture above
- The 2 pins above are connected in series in a 220V circuit similar to a switch
You should use the Arduino Nano pin output base as shown below for stability when using, not afraid of loose wires
5. Download pre-built program
If you don’t know how to build software, you can use pre-built software:
6. Article source and reference
Article sourced from: https://thigiacmaytinh.com/source-code-phan-mem-nhan-dien-khuon-mat-cho-atm-gao/