You are task to add a yawning detection to the programme below;i.pdf
1. You are task to add a yawning detection to the programme below;
import numpy as np
from pygame import mixer
import time
import cv2
from tkinter import *
import tkinter.messagebox
import mysql.connector
from datetime import datetime
root = Tk()
root.geometry('500x570')
frame = Frame(root, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH, expand=1)
root.title('Drive Main')
frame.config(background='#74B0D6')
label = Label(frame, text="Drive Care", bg='#74B0D6', font='Garcedo 25 bold')
label.pack(side=TOP)
filename = PhotoImage(file="picco.png")
background_label = Label(frame, image=filename)
background_label.pack(side=TOP)
from mysql.connector import Error
def connect():
""" Connect to MySQL database """
conn = None
try:
conn = mysql.connector.connect(host='localhost',
database='drive_main',
user='root',
password='')
mySql_insert_query = """INSERT INTO tbl_drivers(id, name, event_time)
VALUES (%s, %s, %s) """
2. cursor = conn.cursor()
current_Date = datetime.now()
# convert date in the format you want
formatted_date = current_Date.strftime('%Y-%m-%d %H:%M:%S')
insert_tuple = (5, 'meleda ulett', current_Date)
result = cursor.execute(mySql_insert_query, insert_tuple)
conn.commit()
print("Date Record inserted successfully")
if conn.is_connected():
print('Connected to MySQL database')
except Error as e:
print(e)
except mysql.connector.Error as error:
conn.rollback()
print("Failed to insert into MySQL table {}".format(error))
finally:
if conn is not None and conn.is_connected():
conn.close()
connect()
def hel_doc():
help(cv2)
def Contri():
tkinter.messagebox.showinfo("Contributors", "n1.Romairo Reidn2. Kayla-Marie Sooman n3.
Bradly Walcott n4. Lee Hinds n")
def anotherWin():
tkinter.messagebox.showinfo("About",
'Drive Care version 01.1n Made Usingn-OpenCVnpn-Tkintern In Python
3')
menu = Menu(root)
root.config(menu=menu)