michael ma
Created September 4, 2024

Traffice Sense Tip with Vision AI

Using visual AI technology and TTS technology to help visually impaired people perceive traffic obstacles.

14
Traffice Sense Tip with Vision AI

Things used in this project

Hardware components

Seeed Studio Vision AI 2
×1
Seeed Studio OV5647-62 FOV Camera
×1
Seeed Studio XIAO ESP32S3
×1
DFRobot Gravity Text to Speech Voice Synthesizer Module
×1

Story

Read more

Code

Traffic Sense App

Arduino
analysis vision stream realtime and report with speech.
#include <Arduino.h>
#include <Seeed_Arduino_SSCMA.h>
#include "DFRobot_SpeechSynthesis.h"
//define the forward direction area between 80-140
#define LEFT 80
#define RIGHT 140
DFRobot_SpeechSynthesis_I2C ss;
SSCMA AI;
void setup()
{
    //initial and setup Grove Vision 2
    AI.begin();
    //initial and setup Speech Synthesis module
    ss.begin();
    //set speech volume.
    ss.setVolume(5);
    //set speech speed.
    ss.setSpeed(5);
    //set speech type female.
    ss.setSoundType(ss.eFemale1);
    //set speech tone.
    ss.setTone(5);
    //set speech in english word mode.
    ss.setLanguage(ss.eEnglishl);
    //initial serial for debug and monitor
    Serial.begin(9600);
    //message application started
    Serial.print("Traffic Sensor App start!");
}
void loop()
{
    String analysis = "";
    // invoke once, no filter , get image
    if (!AI.invoke(1, false, true))
    {
        analysis += String("Detected ");
        for (int i = 0; i < AI.boxes().size(); i++)
        {
            if(AI.boxes()[i].x > LEFT && AI.boxes()[i].x < RIGHT)
            {
                analysis += String(i);
                analysis += String(" target is ");
                analysis += String(AI.boxes()[i].target);
                analysis += String(" score is ");
                analysis += String(AI.boxes()[i].score);
            }
        }
        ss.speak(analysis.c_str());
    }
    //interval 3 seconds.
    delay(3000);
}

Credits

michael ma

michael ma

6 projects • 2 followers

Comments