Upload project files
This commit is contained in:
parent
f0ce523550
commit
61170855d2
121
checktrain.html
Normal file
121
checktrain.html
Normal file
@ -0,0 +1,121 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Train Schedule</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
background-color: #f4f4f4;
|
||||
color: #333;
|
||||
}
|
||||
h2 {
|
||||
color: #0056b3;
|
||||
}
|
||||
.train {
|
||||
background: white;
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 10px;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
text-align: left;
|
||||
}
|
||||
th {
|
||||
background: #007bff;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Train Schedule</h1>
|
||||
<div id="train-container"></div>
|
||||
|
||||
<script>
|
||||
const rawData = [
|
||||
[
|
||||
[59400, 148403369],
|
||||
"Gdynia Cisowa 3:36 3:37",
|
||||
"Gdynia Chylonia 3:39 3:40",
|
||||
"Gdańsk Stocznia 4:22 4:22",
|
||||
"Gdańsk Główny 4:25 4:26",
|
||||
"Gdańsk Śródmieście 4:28 4:28",
|
||||
],
|
||||
[
|
||||
[59486, 148403414],
|
||||
"Gdynia Cisowa 23:35 23:35",
|
||||
"Gdynia Chylonia 23:37 23:38",
|
||||
"Gdynia Leszczynki 23:39 23:40",
|
||||
"Gdańsk Stocznia 0:20 0:20",
|
||||
"Gdańsk Główny 0:23 0:23",
|
||||
],
|
||||
];
|
||||
|
||||
function parseTrainData(data) {
|
||||
return data.map(train => {
|
||||
const [trainInfo, ...stations] = train;
|
||||
const [trainId, trainCode] = trainInfo;
|
||||
|
||||
const parsedStations = stations.map(station => {
|
||||
const parts = station.match(/^(.*?)(\d{1,2}:\d{1,2}) (\d{1,2}:\d{1,2})$/);
|
||||
return parts ? {
|
||||
name: parts[1].trim(),
|
||||
arrival: parts[2],
|
||||
departure: parts[3]
|
||||
} : null;
|
||||
}).filter(Boolean);
|
||||
|
||||
return { trainId, trainCode, stations: parsedStations };
|
||||
});
|
||||
}
|
||||
|
||||
function displayTrains() {
|
||||
const trains = parseTrainData(rawData);
|
||||
const container = document.getElementById("train-container");
|
||||
container.innerHTML = "";
|
||||
|
||||
trains.forEach(train => {
|
||||
const trainDiv = document.createElement("div");
|
||||
trainDiv.classList.add("train");
|
||||
trainDiv.innerHTML = `<h2>Train ID: ${train.trainId} (Code: ${train.trainCode})</h2>`;
|
||||
|
||||
const table = document.createElement("table");
|
||||
table.innerHTML = `
|
||||
<tr>
|
||||
<th>Station</th>
|
||||
<th>Arrival</th>
|
||||
<th>Departure</th>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
train.stations.forEach(station => {
|
||||
const row = document.createElement("tr");
|
||||
row.innerHTML = `
|
||||
<td>${station.name}</td>
|
||||
<td>${station.arrival}</td>
|
||||
<td>${station.departure}</td>
|
||||
`;
|
||||
table.appendChild(row);
|
||||
});
|
||||
|
||||
trainDiv.appendChild(table);
|
||||
container.appendChild(trainDiv);
|
||||
});
|
||||
}
|
||||
|
||||
displayTrains();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
206
map.html
Normal file
206
map.html
Normal file
@ -0,0 +1,206 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Map with Smooth Path</title>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCcoovljMQbS-cflVninzLeUm_gxzqVKq8"></script>
|
||||
<script src="points.js"></script>
|
||||
<style>
|
||||
#map {
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
|
||||
<script>
|
||||
function initMap() {
|
||||
const center = { lat: 54.5208617, lng: 18.5293044 }; // Centered around Gdynia Główna
|
||||
const map = new google.maps.Map(document.getElementById("map"), {
|
||||
zoom: 10,
|
||||
center: center,
|
||||
});
|
||||
|
||||
const cameras = [
|
||||
{ name: "beta", lat: 54.596, lng: 18.343, link: 'https://www.google.com' },
|
||||
{ name: "beta", lat: 54.610556, lng: 18.181778, link: 'https://www.google.com' },
|
||||
{ name: "beta", lat: 54.604556, lng: 18.247722, link: 'https://www.google.com' },
|
||||
{ name: "beta", lat: 54.603806, lng: 18.261389, link: 'https://www.google.com' },
|
||||
];
|
||||
|
||||
const stations = [
|
||||
{ name: "Lębork", lat: 54.5336953, lng: 17.7505833 },
|
||||
{ name: "Lębork Mosty", lat: 54.5501508, lng: 17.7928783 },
|
||||
{ name: "Godętowo", lat: 54.5820128, lng: 17.8648961 },
|
||||
{ name: "Bożepole Wielkie", lat: 54.5692544, lng: 17.96556 },
|
||||
{ name: "Strzebielino Morskie", lat: 54.5627919, lng: 18.0297814 },
|
||||
{ name: "Luzino", lat: 54.5672303, lng: 18.1036106 },
|
||||
{ name: "Gościcino Wejherowskie", lat: 54.6054475, lng: 18.161305 },
|
||||
{ name: "Wejherowo", lat: 54.6058203, lng: 18.2292289 },
|
||||
{ name: "Wejherowo Nanice", lat: 54.6035731, lng: 18.2496314 },
|
||||
{ name: "Wejherowo Śmiechowo", lat: 54.6019864, lng: 18.2743514 },
|
||||
{ name: "Reda Pieleszewo", lat: 54.6027481, lng: 18.3180667 },
|
||||
{ name: "Reda", lat: 54.5950133, lng: 18.3532075 },
|
||||
{ name: "Rumia", lat: 54.5690953, lng: 18.3866003 },
|
||||
{ name: "Rumia Janowo", lat: 54.55944, lng: 18.4046489 },
|
||||
{ name: "Gdynia Cisowa", lat: 54.5497331, lng: 18.4473861 },
|
||||
{ name: "Gdynia Chylonia", lat: 54.54616, lng: 18.4624442 },
|
||||
{ name: "Gdynia Leszczynki", lat: 54.5413494, lng: 18.4782806 },
|
||||
{ name: "Gdynia Grabówek", lat: 54.5342378, lng: 18.4959956 },
|
||||
{ name: "Gdynia Stocznia", lat: 54.5254606, lng: 18.5192603 },
|
||||
{ name: "Gdynia Główna", lat: 54.5208617, lng: 18.5293044 },
|
||||
{ name: "Gdynia Wzgórze Św. Maksymiliana", lat: 54.5074792, lng: 18.5353856 },
|
||||
{ name: "Gdynia Redłowo", lat: 54.4914125, lng: 18.5383092 },
|
||||
{ name: "Gdynia Orłowo", lat: 54.4779422, lng: 18.5475819 },
|
||||
{ name: "Sopot Kamienny Potok", lat: 54.4575428, lng: 18.553505 },
|
||||
{ name: "Sopot", lat: 54.4418144, lng: 18.5617683 },
|
||||
{ name: "Sopot Wyścigi", lat: 54.4316644, lng: 18.565025 },
|
||||
{ name: "Gdańsk Żabianka-A WFiS", lat: 54.4206053, lng: 18.5684253 },
|
||||
{ name: "Gdańsk Oliwa", lat: 54.4094981, lng: 18.5719353 },
|
||||
{ name: "Gdańsk Przymorze-Uniwersytet", lat: 54.4007606, lng: 18.5764489 },
|
||||
{ name: "Gdańsk Zaspa", lat: 54.3899158, lng: 18.5911644 },
|
||||
{ name: "Gdańsk Wrzeszcz", lat: 54.3820017, lng: 18.6050972 },
|
||||
{ name: "Gdańsk Politechnika", lat: 54.3740778, lng: 18.6275386 },
|
||||
{ name: "Gdańsk Stocznia", lat: 54.364365, lng: 18.6420111 },
|
||||
{ name: "Gdańsk Główny", lat: 54.3553942, lng: 18.6439281 },
|
||||
{ name: "Gdańsk Śródmieście", lat: 54.3464492, lng: 18.6443958 }
|
||||
];
|
||||
|
||||
stations.forEach(station => {
|
||||
new google.maps.Marker({
|
||||
position: { lat: station.lat, lng: station.lng },
|
||||
map: map,
|
||||
icon: {
|
||||
url: "train_station.png",
|
||||
scaledSize: new google.maps.Size(30, 30)
|
||||
},
|
||||
title: station.name
|
||||
});
|
||||
});
|
||||
|
||||
cameras.forEach(camera => {
|
||||
const marker = new google.maps.Marker({
|
||||
position: { lat: camera.lat, lng: camera.lng },
|
||||
map: map,
|
||||
icon: {
|
||||
url: "camera.png",
|
||||
scaledSize: new google.maps.Size(50, 50)
|
||||
},
|
||||
title: camera.name
|
||||
});
|
||||
marker.addListener("click", () => {
|
||||
window.location.href = camera.link;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ROUTE
|
||||
const route = points.map(point => ({ lat: point.lat, lng: point.lng }));
|
||||
const path = new google.maps.Polyline({
|
||||
path: route,
|
||||
geodesic: true,
|
||||
strokeColor: "#FF0000",
|
||||
strokeOpacity: 0.5,
|
||||
strokeWeight: 5,
|
||||
});
|
||||
path.setMap(map);
|
||||
|
||||
// Moving marker (blue dot)
|
||||
const movingMarker = new google.maps.Marker({
|
||||
position: route[0],
|
||||
map: map,
|
||||
icon: {
|
||||
path: google.maps.SymbolPath.CIRCLE,
|
||||
scale: 6,
|
||||
fillColor: "blue",
|
||||
fillOpacity: 1,
|
||||
strokeWeight: 0,
|
||||
},
|
||||
});
|
||||
|
||||
function moveMarker(marker, route, speed) {
|
||||
let index = 0;
|
||||
let progress = 0;
|
||||
const updateInterval = 50; // ms
|
||||
const step = speed / (1000 / updateInterval); // Speed per frame
|
||||
|
||||
function animate() {
|
||||
if (index < route.length - 1) {
|
||||
const start = route[index];
|
||||
const end = route[index + 1];
|
||||
|
||||
const lat = start.lat + (end.lat - start.lat) * progress;
|
||||
const lng = start.lng + (end.lng - start.lng) * progress;
|
||||
|
||||
marker.setPosition({ lat, lng });
|
||||
|
||||
progress += step;
|
||||
if (progress >= 1) {
|
||||
progress = 0;
|
||||
index++;
|
||||
}
|
||||
|
||||
setTimeout(animate, updateInterval);
|
||||
}
|
||||
}
|
||||
animate();
|
||||
}
|
||||
|
||||
moveMarker(movingMarker, route, 100); // Adjust speed as needed
|
||||
}
|
||||
// Function to compute total route length
|
||||
function getTotalDistance(route) {
|
||||
let totalDistance = 0;
|
||||
for (let i = 0; i < route.length - 1; i++) {
|
||||
totalDistance += google.maps.geometry.spherical.computeDistanceBetween(
|
||||
new google.maps.LatLng(route[i].lat, route[i].lng),
|
||||
new google.maps.LatLng(route[i + 1].lat, route[i + 1].lng)
|
||||
);
|
||||
}
|
||||
return totalDistance;
|
||||
}
|
||||
// Function to get midpoint of the route
|
||||
function getMidpoint(route) {
|
||||
const totalDistance = getTotalDistance(route);
|
||||
let distanceCovered = 0;
|
||||
let midDistance = totalDistance / 2;
|
||||
|
||||
for (let i = 0; i < route.length - 1; i++) {
|
||||
let segmentDistance = google.maps.geometry.spherical.computeDistanceBetween(
|
||||
new google.maps.LatLng(route[i].lat, route[i].lng),
|
||||
new google.maps.LatLng(route[i + 1].lat, route[i + 1].lng)
|
||||
);
|
||||
|
||||
if (distanceCovered + segmentDistance >= midDistance) {
|
||||
let ratio = (midDistance - distanceCovered) / segmentDistance;
|
||||
let midLat = route[i].lat + (route[i + 1].lat - route[i].lat) * ratio;
|
||||
let midLng = route[i].lng + (route[i + 1].lng - route[i].lng) * ratio;
|
||||
return { lat: midLat, lng: midLng };
|
||||
}
|
||||
distanceCovered += segmentDistance;
|
||||
}
|
||||
return route[Math.floor(route.length / 2)]; // Fallback
|
||||
|
||||
// Place second blue dot at the midpoint of the route
|
||||
const midpoint = getMidpoint(route);
|
||||
const midpointMarker = new google.maps.Marker({
|
||||
position: midpoint,
|
||||
map: map,
|
||||
icon: {
|
||||
path: google.maps.SymbolPath.CIRCLE,
|
||||
scale: 60,
|
||||
fillColor: "blue",
|
||||
fillOpacity: 1,
|
||||
strokeWeight: 0,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
window.onload = initMap;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
69
rozklad.py
Normal file
69
rozklad.py
Normal file
@ -0,0 +1,69 @@
|
||||
from datetime import datetime
|
||||
import requests, json
|
||||
# nr wyjazdowe z pkp pdf
|
||||
trip_nr_list = [59400, 59402, 59404, 59406, 59408, 59410, 59412, 59414, 59416, 59418, 59420, 59422, 59424, 59426, 59428, 59430, 59432, 59434, 59436, 59438, 59440, 59442, 59444, 59446, 59448, 59450, 59452, 59454, 59456, 59458, 59460, 59462, 59464, 59466, 59468, 59470, 59472, 59474, 59476, 59478, 59480, 59482, 59484, 59486, 59600, 59602, 59604, 59606, 59608, 59610, 59612, 59620, 59690, 59692, 59694, 59696, 59698, 59702, 59706, 59708, 59710, 59712, 59714, 59716, 59718, 59720, 59722, 59724, 59726, 59728, 59730, 59732, 59734, 59736, 59738, 59740, 59742, 59744, 59746, 59748, 59750, 59752, 59754, 59756, 59758, 59760, 59762, 59764, 59766, 59768, 59770, 59772, 59774, 59776, 59778, 59780, 59782, 59784, 59786, 59788, 59790, 59792, 59794, 59796, 59798, 59800, 59802, 59804, 59806, 59808, 59810, 59812, 59814, 95401, 95403, 95405, 95407, 95409, 95411, 95413, 95415, 95417, 95419, 95421, 95423, 95425, 95427, 95429, 95431, 95433, 95435, 95437, 95439, 95441, 95443, 95445, 95447, 95449, 95451, 95453, 95455, 95457, 95459, 95461, 95463, 95465, 95467, 95469, 95471, 95473, 95475, 95477, 95479, 95481, 95483, 95485, 95487, 95489, 95601, 95603, 95605, 95607, 95609, 95633, 95687, 95689, 95691, 95693, 95695, 95697, 95699, 95703, 95707, 95709, 95711, 95713, 95715, 95717, 95719, 95721, 95723, 95725, 95727, 95729, 95731, 95733, 95735, 95737, 95739, 95741, 95743, 95745, 95747, 95749, 95751, 95753, 95755, 95757, 95759, 95761, 95763, 95765, 95767, 95769, 95771, 95773, 95775, 95777, 95779, 95781, 95783, 95785, 95787, 95789, 95791, 95793, 95795, 95797, 95799, 95801, 95803, 95805, 95807, 95809, 95811, 95813, 95815, 95817]
|
||||
trip_nr_list = [59400, 59402, 59486, 59600, 59602, 59604] # shor for testing
|
||||
|
||||
|
||||
def get_trips(date, trip_nr_list): # Date Y-M-D datetime.now().strftime("%Y-%m-%d")
|
||||
|
||||
trip_id_list = []
|
||||
for i in trip_nr_list:
|
||||
try: # get the train id using the train number, except KeyError as the given journey may not have a schedule for a given day (mostly sundays)
|
||||
trip_id_list.append([i, requests.get(f'https://koleo.pl/pl/train_calendars?&brand=SKMT&nr={i}').json()["train_calendars"][0]["date_train_map"][date]])
|
||||
except KeyError: print('no date for this train')
|
||||
# trip_id_list = [ (59400,148352609), (59400,148352609) ]
|
||||
all_trips_list = []
|
||||
for i in trip_id_list:
|
||||
one_trip = [i]
|
||||
for i in requests.get(f'https://koleo.pl/pl/trains/{i[1]}').json()["stops"]:
|
||||
one_trip.append(f'{i["station_name"]} {i["arrival"]["hour"]}:{i["arrival"]["minute"]} {i["departure"]["hour"]}:{i["departure"]["minute"]}')
|
||||
all_trips_list.append(one_trip)
|
||||
|
||||
return all_trips_list
|
||||
|
||||
print(get_trips(datetime.now().strftime("%Y-%m-%d"),trip_nr_list))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
def get_live_trains(date, trip_nr_list): # Date Y-M-D
|
||||
train_id = ''
|
||||
all_journeys = []
|
||||
|
||||
for i in train_number_list: # For each train number
|
||||
|
||||
#getting the train id using the train number and current date by parsing the json response from the koleo.pl server
|
||||
# request json data train numer = i parse the data - get the train ids
|
||||
train_id = requests.get(f'https://koleo.pl/pl/train_calendars?&brand=SKMT&nr={i}').json()["train_calendars"][0]["date_train_map"][date]
|
||||
all_stops = requests.get(f'https://koleo.pl/pl/trains/{train_id}').json()["stops"] # we turned the train number into a train id, now we are requesting the train ride data using the train id from koleo.pl
|
||||
journey = [i]
|
||||
|
||||
arrival = (all_stops[0]["arrival"]["hour"], all_stops[0]["arrival"]["minute"]) # get the arrival time from the first station (begining)
|
||||
departure = (all_stops[-1]["departure"]["hour"],all_stops[-1]["departure"]["minute"]) # get the departure time from the last station (end)
|
||||
|
||||
if arrival <= (datetime.now().time().hour,datetime.now().time().minute) <= departure: # check if the train is currently in a journey
|
||||
for i in all_stops:
|
||||
journey.append(f'{i["station_name"]} {i["arrival"]["hour"]}:{i["arrival"]["minute"]} {i["departure"]["hour"]}:{i["departure"]["minute"]}')
|
||||
|
||||
all_journeys.append(journey)
|
||||
return all_journeys
|
||||
|
||||
with open("LIVETRAIN.json", "w", encoding="utf-8") as file:
|
||||
json.dump([x for x in get_live_trains(datetime.now().strftime("%Y-%m-%d"),wyjazd)], file, indent=4, ensure_ascii=False)
|
||||
|
||||
print('DONE')
|
||||
|
||||
|
||||
#get_trains(datetime.now().strftime("%Y-%m-%d"),wyjazd):
|
||||
#print(f'https://koleo.pl/pociag/SKMT/{i}/{current_date}')
|
||||
|
||||
'''
|
58
stream.html
Normal file
58
stream.html
Normal file
@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Live Streams</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
||||
<style>
|
||||
body {
|
||||
background-color: black;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
.grid {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
}
|
||||
video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="grid">
|
||||
<video id="stream1" autoplay muted playsinline></video>
|
||||
<video id="stream2" autoplay muted playsinline></video>
|
||||
<video id="stream3" autoplay muted playsinline></video>
|
||||
<video id="stream4" autoplay muted playsinline></video>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function loadStream(videoElement, streamURL) {
|
||||
if (videoElement.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
videoElement.src = streamURL; // Safari (native HLS support)
|
||||
} else if (Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(streamURL);
|
||||
hls.attachMedia(videoElement);
|
||||
}
|
||||
}
|
||||
|
||||
loadStream(document.getElementById('stream1'), "https://ls.tkchopin.pl:9043/live/reda_jara_static.stream/playlist.m3u8");
|
||||
loadStream(document.getElementById('stream2'), "https://ls.tkchopin.pl:9043/live/wejherowo_skrzyzowanie_rybacka_k6_static.stream/playlist.m3u8");
|
||||
loadStream(document.getElementById('stream3'), "https://ls.tkchopin.pl:9043/live/bolszewo_skrzyzowanie_k6_zamostna_static.stream/playlist.m3u8");
|
||||
loadStream(document.getElementById('stream4'), "https://hoktastream1.webcamera.pl/wejherowo_cam_e071d5/wejherowo_cam_e071d5.stream/chunks.m3u8");
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
32
stream.py
Normal file
32
stream.py
Normal file
@ -0,0 +1,32 @@
|
||||
import cv2
|
||||
|
||||
# Stream URL
|
||||
stream_url = "https://ls.tkchopin.pl:9043/live/wejherowo_skrzyzowanie_rybacka_k6_static.stream/playlist.m3u8"
|
||||
|
||||
# Open video stream with reduced buffer size for low latency
|
||||
cap = cv2.VideoCapture(stream_url)
|
||||
cap.set(cv2.CAP_PROP_BUFFERSIZE, 1) # Reduce frame buffering for lower latency
|
||||
|
||||
if not cap.isOpened():
|
||||
print("Error: Could not open stream")
|
||||
else:
|
||||
# Read and discard old frames (capture only the latest available one)
|
||||
for _ in range(5): # Adjust this number for better latency
|
||||
ret, frame = cap.read()
|
||||
|
||||
if ret:
|
||||
# Define the cropping region (modify these values as needed)
|
||||
x, y, width, height = 640, 0, 640, 130 # Upper-right corner
|
||||
|
||||
# Crop the frame
|
||||
cropped_frame = frame[y:y+height, x:x+width]
|
||||
|
||||
# Save the cropped frame
|
||||
cv2.imwrite("cropped_frame.jpg", cropped_frame)
|
||||
print("Cropped frame saved as 'cropped_frame.jpg'")
|
||||
else:
|
||||
print("Error: Could not capture frame")
|
||||
|
||||
# Release resources
|
||||
cap.release()
|
||||
cv2.destroyAllWindows()
|
Loading…
x
Reference in New Issue
Block a user