Pedestrian Crossing Radar Management System


FileName – fayl nomi filter -


Download 3.29 Mb.
bet23/27
Sana19.10.2023
Hajmi3.29 Mb.
#1709325
1   ...   19   20   21   22   23   24   25   26   27
Bog'liq
Pedestrian Crossing Radar Management System full - для слияния

FileName – fayl nomi
filter - tozalagich, filtr, filterlamoq, tozalamoq
find – topmoq
font – shrift
index - 1) ko`rsatkich, alfavit korsatkichi; 2) katalog, ro`yxat; indeks; 3) strelka (ko`rsatkich),
length - 1) uzunlik, masofa; 2) ketgan vaqt, davom etish muddati
modified - biror narsaning o`zgargan shakli, turlanish
no – yo`q
pate – qo`yish
share - (with, among, between) vt 1) taqsimlamoq, bo`l(ish)moq; 2) paylashmoq
ShowMessage – habarni ko`rsatmoq
simple - oson, oddiy, soda
size – hajm, kattalik, o`lchov
switch - birdan fikrini o`zgartirmoq
text – matn
type - ~ of n [c] 1) tur; 2) bosma harf; 3) tip, xil, nusxa
visible - 1) ko`zga ko`rinadigan, ko`z ilg`aydigan; 2) aniq, oshkora
yes – ha
true – rost
false – yolg‘on


Glossary

T/r

English

Uzbek

1

Sign In

Tizimga kiring

2

Processor Id

Protsessor identifikatori

3

Base Board Id

Bazaviy kengash identifikatori

4

BIOS Date

BIOS sanasi

5

Password

Maxfiy soʻz

6

Login

Kirish

7

Enter Password

Maxfiy soʻzni kiriting

8

Invalid Password

Maxfiy soʻz haqiqiy emas

9

Face Recognition Employee Attendance System

Yuzni tanib olish xodimlarining qatnashish tizimi

10

Reason Software Corporation

Reason dasturiy ta'minot korporatsiyasi

11

Developed by Sherzod Khoja Sulaiman Siddik

Sherzod Xo'ja Sulaymon Siddiq tomonidan ishlab chiqilgan

12

Register Employee

Xodimni ro'yxatdan o'tkazish

13

Clock In

Kirish soati

14

Clock Out

Chiqish soati

15

Report

Hisobot

16

Glossary

Glossariy

17

About

Dastur haqida

18

Logout

Tizimdan chiqish

19

Exit

Chiqish

20

Face Detection Using WebCamera

Web Camera yordamida yuzni aniqlash

21

Device

Uskuna(qurilma)

22

Start

Boshlash

23

Reset

Qayta tiklash(tozalash)

24

Pause

Toʻxtatish

25

Capture

Qoʻlga kiritish(rasmga olish)

26

Image Name

Rasmning nomi

27

File Name

Faylning nomi

28

Save

Saqlash

29

Employee Attendance Report Form

Xodimlarning qatnashish to'g'risidagi hisoboti shakli

30

Open CSV File

CSV faylini ochish

31

Employee Clock In

Xodimlar kirish soati

32

Employee Clock Out

Xodimlar chiqish soati

33

Open Excel File

Excel faylini ochish

34

File Name

Faylning nomi

35

Select Table

Jadvalni tanlash

36

Sheet

Varaq

37

Name

Nom

38

Time

Vaqt

39

Employee Clock In and Clock Out

Xodimlarning kirish va chiqish soati

40

Select Employee Clock In:

Xodimlar kirish soatini tanlang

41

Select Employee ClockOut:

Xodimlar chiqish soatini tanlang

42

Date

Sana

43

Monday

Dushanba

44

Tuesday

Seshanba

45

Wednesday

Chorshanba

46

Thursday

Payshanba

47

Friday

Juma

48

Saturday

Shanba

49

Sunday

Yakshanba

50

January

Yanvar

51

February

Fevral

52

March

Mart

53

April

Aprel

54

May

May

55

June

Iyun

56

July

Iyul

57

August

Avgust

58

September

Sentabr

59

October

Oktabr

60

November

Noyabr

61

December

Dekabr

Python dasturida “Pedestrian Crossing Radar Management System” dasturini yaratish


Asosiy Formaga:
Label
Timer
Panel
PictureBox
Button
komponentalarini tashlaymiz.

Pedestrian Crossing Radar Management System” dasturining kodlari.


Umumiy kod: MainForms.py faylining kodlari:


import cv2 as cv
import numpy as np
import imutils
import time
import datetime
import os

t = time.strftime("%Y-%m-%d_%H-%M-%S")


#timeFolder = time.strftime("%Y-%m-%d")
dateTime = str(datetime.datetime.now())
#pathFolder = os.system(f'cmd /k "mkdir" folder_{timeFolder}')
img_counter = 0

# setting parameters


CONFIDENCE_THRESHOLD = 0.4
NMS_THRESHOLD = 0.3

#==================================================


timeFolder = time.strftime("%Y-%m-%d")

def createFolder(directory):


try:
if not os.path.exists(directory):
os.makedirs(directory)
except OSError:
print("Error: Creating directory. " + directory)

#createFolder('./test/')


createFolder(timeFolder)
#==================================================

#==================================================


import mediapipe as mp

width=640


height=480

mp_drawing = mp.solutions.drawing_utils


mp_face = mp.solutions.face_detection.FaceDetection(model_selection=1,min_detection_confidence=0.5)

def obj_data(img):


global img_counter, pathFolder
image_input = cv.cvtColor(img, cv.COLOR_BGR2RGB)
results = mp_face.process(image_input)
if not results.detections:
print("NO FACE")
else:
for detection in results.detections:
bbox = detection.location_data.relative_bounding_box
#print(bbox)
x, y, w, h = int(bbox.xmin*width), int(bbox.ymin * height), int(bbox.width*width),int(bbox.height*height)
start_point = (x-100, y-100)
end_point = (x+w+80, y+h+80)
#cv.rectangle(img,(x-100,y-100),(x+w+80,y+h+80),(0,0,255),2)
cv.rectangle(img, start_point, end_point,(0,0,255),2)
#print(cv.rectangle(img,(x-100,y-100),(x+w+80,y+h+80),(0,0,255),2))
#if yuz is True:
## img_name = f"{pahtFolder}/detect_"+t+"_{img_counter}.png"#.format(pathFolder, img_counter)
## cv.imwrite(img_name, frame)
## #print("screeenshot taken")
## img_counter += 1
#==================================================

# colors for object detected


COLORS = [(0,255,255), (255,255,0), (0,255,0), (255,0,0), (255,0,255), (255,0,0)]
GREEN = (0,255,0)
RED = (0,0,255)
PINK = (147,20,255)
ORANGE = (0,69,255)
BLACK = (0,255,0)
# defining fonts
fonts = cv.FONT_HERSHEY_COMPLEX

# reading class name from text file


class_names = []

with open("dnn_model/classes.txt", "r") as f:


class_names = [cname.strip() for cname in f.readlines()]

# setting up opencv net


yoloNet = cv.dnn.readNet('dnn_model/yolov4-tiny.weights', 'dnn_model/yolov4-tiny.cfg')

yoloNet.setPreferableBackend(cv.dnn.DNN_BACKEND_CUDA)


yoloNet.setPreferableTarget(cv.dnn.DNN_TARGET_CUDA_FP16)

model = cv.dnn_DetectionModel(yoloNet)


model.setInputParams(size=(416,416), scale=1/255, swapRB=True)

def color_detect():


# color detection
hsv = cv.cvtColor(frame, cv.COLOR_BGR2HSV)
lower_red = np.array([0,50,120])
upper_red = np.array([10,255,255])
mask3 = cv.inRange(hsv, lower_red, upper_red)
cnts3 = cv.findContours(mask3, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
cnts3 = imutils.grab_contours(cnts3)

for c in cnts3:


area3 = cv.contourArea(c)
if area3 > 5000:

cv.drawContours(frame, [c], -1, (0,255,0), 3)


M = cv.moments(c)

cx = int(M["m10"]/M["m00"])


cy = int(M["m01"]/M["m00"])

cv.circle(frame, (cx, cy), 7, (255,255,255), -1)


cv.putText(frame, "Red", (cx-20, cy-20), cv.FONT_HERSHEY_SIMPLEX, 2.5, (255,255,255), 3)

# setting camera


#def ObjectDetector(image):
## classes, scores, boxes = model.detect(image, CONFIDENCE_THRESHOLD, NMS_THRESHOLD)
##
## # creating empty list to add objects data
## data_list = [] #[classid[0], classid[67]]
## for (classid, score, box) in zip(classes, scores, boxes):
## img_counter = 0
## # define color of each, object based on ito class id
## color = COLORS[int(classid) % len(COLORS)]
## foiz = (score*100)
## label = "%s : %f" % (class_names[classid], foiz)
## #lbl = 100 * label
##
## # draw rectangle on and label on object
## #if (classid == 0 and classid == 67):
## cv.rectangle(image, box, color, 2)
## cv.putText(image, label, (box[0], box[1]-14), fonts, 0.5, color, 2)
## for timeFrame in t:
## timeFrame = cv.putText(image, t, (10, 20), cv.FONT_HERSHEY_SIMPLEX, 0.6, (0,0,255), 1)
##
## if (classid == 67):
## cv.rectangle(image, box, color, 2)
## cv.putText(image, label, (box[0], box[1]-14), fonts, 0.5, color, 2)
##
## img_name = "detect_person_image/detect_"+t+"_{}.png".format(img_counter)
## cv.imwrite(img_name, image)
## #print("screeenshot taken")
## img_counter += 1
##
## elif (classid == 9):
## cv.rectangle(image, box, color, 2)
## cv.putText(image, label, (box[0], box[1]-14), fonts, 0.5, color, 2)
## color_detect()
##
## img_name = "detect_person_image/detect_"+t+"_{}.png".format(img_counter)
## cv.imwrite(img_name, image)
## #print("screeenshot taken")
## img_counter += 1
## # getting the data
# 1: class name 2: object width in pixels, 3: position where have to draw text(distance)
## if classid == 0 and 67: #person class id
## data_list.append([class_names[classid[0]], box[2], (box[0], box[1]-2)])
## elif classid == 9:
## data_list.append([class_names[classid[0]], box[2], (box[0], box[1]-2)])
## # return list
## return data_list

# load the cascade


face_cascade = cv.CascadeClassifier('haarcascade_frontalface_default.xml')

cap = cv.VideoCapture(0)


while(cap.isOpened()):
ret, frame = cap.read()
frame = cv.putText(frame, dateTime, (10, 20), cv.FONT_HERSHEY_SIMPLEX, 0.6, (0,0,255), 1)
#ObjectDetector(frame)
classes, scores, boxes = model.detect(frame, CONFIDENCE_THRESHOLD, NMS_THRESHOLD)

# creating empty list to add objects data


data_list = [] #[classid[0], classid[67]]
for (classid, score, box) in zip(classes, scores, boxes):
# define color of each, object based on ito class id
color = COLORS[int(classid) % len(COLORS)]

## foiz = round(score, 2)*100


## label = "%s : %f" % (class_names[classid], foiz)
label = class_names[classid]
foiz = round(score, 2)

# draw rectangle on and label on object


#if (classid == 0 and classid == 67):
cv.rectangle(frame, box, color, 2)
cv.putText(frame, label + " {:.2f}".format(foiz*100)+"%", (box[0], box[1]-14), fonts, 0.5, color, 2)

# convert to grayscale


gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)

# Detect the faces


faces = face_cascade.detectMultiScale(gray, 1.1, 4)

## def facesDetect():


## for (x,y,w,h) in faces:
## cv.rectangle(frame, (x,y), (x+w,y+h), (255,0,0), 2)
## img_name = "detect_person_image/detect_"+t+"_{}.png".format(img_counter)
## cv.imwrite(img_name, frame)
## #print("screeenshot taken")
## img_counter += 1
print(box)
#print(score)

if (classid == 67):


cv.rectangle(frame, box, color, 2)
cv.putText(frame, label, (box[0], box[1]-14), fonts, 0.5, color, 2)
cv.imshow('Person Radar | Developed by Sherzod Khoja Sulaiman Siddik', frame)

key = cv.waitKey(1)


if key == ord('q') or key == 27:
break
cap.release()
cv.destroyAllWindows()



Download 3.29 Mb.

Do'stlaringiz bilan baham:
1   ...   19   20   21   22   23   24   25   26   27




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling