Paul Rodolf P. CastorApple Rose
Published

Face Detection Attendance System with RT-Thread Vision Board

This project is about a face detection-based attendance system using RT-Thread Vision Board and OpenMV.

BeginnerFull instructions providedOver 1 day297
Face Detection Attendance System with RT-Thread Vision Board

Things used in this project

Hardware components

RT-Thread Vision Board
×1
USB Cable, USB Type C Plug
USB Cable, USB Type C Plug
×1

Software apps and online services

RT-Thread IoT OS
RT-Thread IoT OS
RT-Thread Studio IDE

Story

Read more

Schematics

RT-Thread Vision Board Camera Schematics

RT-Thread Vision Board Schematics

RT-Thread Vision Board Size Dimension

Code

Face Detection-based Attendance System using RT-Thread Vision Board

MicroPython
import sensor
import image
import random
import machine
import time  # Import time module for timestamping

sensor.reset()  # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE)  # Set pixel format to GRAYSCALE
sensor.set_framesize(sensor.QVGA)  # Set frame size to QVGA
sensor.skip_frames(time=2000)  # Wait for settings take effect.

led = machine.LED("LED_RED")

# Load up a face detection HaarCascade.
face_cascade = image.HaarCascade("frontalface", stages=25)

while True:
    print("About to start detecting faces...")
    sensor.skip_frames(time=2000)  # Give the user time to get ready.

    print("Now detecting faces!")
    diff = 10  # We'll say we detected a face after 10 frames.

    while diff:
        img = sensor.snapshot()
        # Find faces
        faces = img.find_features(face_cascade, threshold=0.5, scale_factor=1.5)

        if faces:
            diff -= 1
            for r in faces:
                img.draw_rectangle(r)

    led.on()
    print("Face detected! Saving image...")

    # Get current time for timestamp
    current_time = time.localtime()
    timestamp = "%04d-%02d-%02d_%02d-%02d-%02d" % (current_time[0], current_time[1], current_time[2],
                                                    current_time[3], current_time[4], current_time[5])

    # Save the image with the timestamp in the filename
    sensor.snapshot().save("snapshot_%s.jpg" % timestamp)
    led.off()

RT-Thread Vision Board Board Support Package

Credits

Paul Rodolf P. Castor
5 projects • 2 followers
Contact
Apple Rose
3 projects • 2 followers
Hi! I’m Apple from Philippines. I teach Electronics and Programming at MSU-IIT.
Contact

Comments

Please log in or sign up to comment.