Skip to content

Commit f44e395

Browse files
committed
2 parents 5b4d329 + e6a6a13 commit f44e395

File tree

2 files changed

+82
-2
lines changed

2 files changed

+82
-2
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import cv2
2+
import pickle
3+
import cvzone
4+
import numpy as np
5+
6+
# Video feed
7+
cap = cv2.VideoCapture('carPark.mp4')
8+
9+
with open('CarParkPos', 'rb') as f:
10+
posList = pickle.load(f)
11+
12+
width, height = 107, 48
13+
14+
15+
def checkParkingSpace(imgPro):
16+
spaceCounter = 0
17+
18+
for pos in posList:
19+
x, y = pos
20+
21+
imgCrop = imgPro[y:y + height, x:x + width]
22+
# cv2.imshow(str(x * y), imgCrop)
23+
count = cv2.countNonZero(imgCrop)
24+
25+
26+
if count < 900:
27+
color = (0, 255, 0)
28+
thickness = 5
29+
spaceCounter += 1
30+
else:
31+
color = (0, 0, 255)
32+
thickness = 2
33+
34+
cv2.rectangle(img, pos, (pos[0] + width, pos[1] + height), color, thickness)
35+
cvzone.putTextRect(img, str(count), (x, y + height - 3), scale=1,
36+
thickness=2, offset=0, colorR=color)
37+
38+
cvzone.putTextRect(img, f'Free: {spaceCounter}/{len(posList)}', (100, 50), scale=3,
39+
thickness=5, offset=20, colorR=(0,200,0))
40+
while True:
41+
42+
if cap.get(cv2.CAP_PROP_POS_FRAMES) == cap.get(cv2.CAP_PROP_FRAME_COUNT):
43+
cap.set(cv2.CAP_PROP_POS_FRAMES, 0)
44+
success, img = cap.read()
45+
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
46+
imgBlur = cv2.GaussianBlur(imgGray, (3, 3), 1)
47+
imgThreshold = cv2.adaptiveThreshold(imgBlur, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
48+
cv2.THRESH_BINARY_INV, 25, 16)
49+
imgMedian = cv2.medianBlur(imgThreshold, 5)
50+
kernel = np.ones((3, 3), np.uint8)
51+
imgDilate = cv2.dilate(imgMedian, kernel, iterations=1)
52+
53+
checkParkingSpace(imgDilate)
54+
cv2.imshow("Image", img)
55+
# cv2.imshow("ImageBlur", imgBlur)
56+
# cv2.imshow("ImageThres", imgMedian)
57+
cv2.waitKey(10)

Website/css/styles.css

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,8 +1246,6 @@ body.dark-mode {
12461246
.dark-mode .milestone-card p{
12471247
color:black;
12481248
}
1249-
1250-
12511249
.testimonial-section {
12521250
background-color: #111151;
12531251
padding: 60px 20px;
@@ -1274,6 +1272,7 @@ body.dark-mode {
12741272
border-radius: 10px;
12751273
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
12761274
text-align: center;
1275+
transition: background-color 0.3s, box-shadow 0.3s;
12771276
}
12781277

12791278
.testimonial img {
@@ -1295,6 +1294,18 @@ body.dark-mode {
12951294
color: #ffd700;
12961295
}
12971296

1297+
/* Hover effect */
1298+
.testimonial:hover {
1299+
background-color: #ffd700; /* Change to a contrasting color */
1300+
color: #111151; /* Change text color */
1301+
box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); /* Brighter shadow */
1302+
}
1303+
1304+
.testimonial:hover p,
1305+
.testimonial:hover h3 {
1306+
color: #111151; /* Ensure text is visible against new background */
1307+
}
1308+
12981309
/* Light Mode for Testimonial Section */
12991310
.dark-mode .testimonial-section {
13001311
background-color: #f9f9f9;
@@ -1322,6 +1333,18 @@ body.dark-mode {
13221333
border: 2px solid #ddd;
13231334
}
13241335

1336+
/* Hover effect for dark mode */
1337+
.dark-mode .testimonial:hover {
1338+
background-color: #555; /* A darker color for light mode */
1339+
color: #fff;
1340+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
1341+
}
1342+
1343+
.dark-mode .testimonial:hover p,
1344+
.dark-mode .testimonial:hover h3 {
1345+
color: #fff; /* Ensure text remains visible */
1346+
}
1347+
13251348
body {
13261349
font-family: Arial, sans-serif;
13271350
background-color: #0a0266;

0 commit comments

Comments
 (0)